state: parse +r/+Z channel modes

This commit is contained in:
StalkR 2013-01-10 22:22:19 +01:00
parent a4028ee669
commit 68005e1845
1 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,7 @@ type Channel struct {
// A struct representing the modes of an IRC Channel // A struct representing the modes of an IRC Channel
// (the ones we care about, at least). // (the ones we care about, at least).
// http://www.unrealircd.com/files/docs/unreal32docs.html#userchannelmodes
type ChanMode struct { type ChanMode struct {
// MODE +p, +s, +t, +n, +m // MODE +p, +s, +t, +n, +m
Private, Secret, ProtectedTopic, NoExternalMsg, Moderated bool Private, Secret, ProtectedTopic, NoExternalMsg, Moderated bool
@ -25,6 +26,9 @@ type ChanMode struct {
// MODE +i, +O, +z // MODE +i, +O, +z
InviteOnly, OperOnly, SSLOnly bool InviteOnly, OperOnly, SSLOnly bool
// MODE +r, +Z
Registered, AllSSL bool
// MODE +k // MODE +k
Key string Key string
@ -49,6 +53,8 @@ var ChanModeToString = map[string]string{
"InviteOnly": "i", "InviteOnly": "i",
"OperOnly": "O", "OperOnly": "O",
"SSLOnly": "z", "SSLOnly": "z",
"Registered": "r",
"AllSSL": "Z",
"Key": "k", "Key": "k",
"Limit": "l", "Limit": "l",
} }
@ -152,12 +158,16 @@ func (ch *Channel) ParseModes(modes string, modeargs ...string) {
ch.Modes.NoExternalMsg = modeop ch.Modes.NoExternalMsg = modeop
case 'p': case 'p':
ch.Modes.Private = modeop ch.Modes.Private = modeop
case 'r':
ch.Modes.Registered = modeop
case 's': case 's':
ch.Modes.Secret = modeop ch.Modes.Secret = modeop
case 't': case 't':
ch.Modes.ProtectedTopic = modeop ch.Modes.ProtectedTopic = modeop
case 'z': case 'z':
ch.Modes.SSLOnly = modeop ch.Modes.SSLOnly = modeop
case 'Z':
ch.Modes.AllSSL = modeop
case 'O': case 'O':
ch.Modes.OperOnly = modeop ch.Modes.OperOnly = modeop
case 'k': case 'k':