Merge pull request #17 from StalkR/chanmodes

state: parse +r/+Z channel modes
This commit is contained in:
Alex Bee 2013-01-11 13:55:12 -08:00
commit f4b53dfb24
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
// (the ones we care about, at least).
// http://www.unrealircd.com/files/docs/unreal32docs.html#userchannelmodes
type ChanMode struct {
// MODE +p, +s, +t, +n, +m
Private, Secret, ProtectedTopic, NoExternalMsg, Moderated bool
@ -25,6 +26,9 @@ type ChanMode struct {
// MODE +i, +O, +z
InviteOnly, OperOnly, SSLOnly bool
// MODE +r, +Z
Registered, AllSSL bool
// MODE +k
Key string
@ -49,6 +53,8 @@ var ChanModeToString = map[string]string{
"InviteOnly": "i",
"OperOnly": "O",
"SSLOnly": "z",
"Registered": "r",
"AllSSL": "Z",
"Key": "k",
"Limit": "l",
}
@ -152,12 +158,16 @@ func (ch *Channel) ParseModes(modes string, modeargs ...string) {
ch.Modes.NoExternalMsg = modeop
case 'p':
ch.Modes.Private = modeop
case 'r':
ch.Modes.Registered = modeop
case 's':
ch.Modes.Secret = modeop
case 't':
ch.Modes.ProtectedTopic = modeop
case 'z':
ch.Modes.SSLOnly = modeop
case 'Z':
ch.Modes.AllSSL = modeop
case 'O':
ch.Modes.OperOnly = modeop
case 'k':