diff options
Diffstat (limited to 'src/mode.cpp')
-rw-r--r-- | src/mode.cpp | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index 0436d04be..fa3ccd88d 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -653,7 +653,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int break; previously_set_k = true; - if (!*chan->key) + if (!chan->custom_modes[CM_KEY]) { MOD_RESULT = 0; FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'k', parameters[param], true, 1)); @@ -664,6 +664,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int strlcpy(key,parameters[param++],32); outpars[pc++] = key; strlcpy(chan->key,key,MAXBUF); + chan->custom_modes[CM_KEY] = 1; k_set = true; } else param++; @@ -688,6 +689,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int { *outl++ = 'k'; *chan->key = 0; + chan->custom_modes[CM_KEY] = 0; outpars[pc++] = key; } } @@ -705,10 +707,11 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int FOREACH_RESULT(I_OnRawMode,OnRawMode(user, chan, 'l', "", false, 0)); if (!MOD_RESULT) { - if (chan->limit) + if (chan->custom_modes[CM_LIMIT]) { *outl++ = 'l'; chan->limit = 0; + chan->custom_modes[CM_LIMIT] = 0; } } } @@ -753,6 +756,7 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int if (chan->limit) { *outl++ = 'l'; + chan->custom_modes[CM_LIMIT] = 1; outpars[pc++] = parameters[param++]; l_set = true; } @@ -766,13 +770,13 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int { if (mdir) { - if (!(chan->binarymodes & CM_INVITEONLY)) *outl++ = 'i'; - chan->binarymodes |= CM_INVITEONLY; + if (!(chan->custom_modes[CM_INVITEONLY])) *outl++ = 'i'; + chan->custom_modes[CM_INVITEONLY] = 1; } else { - if (chan->binarymodes & CM_INVITEONLY) *outl++ = 'i'; - chan->binarymodes &= ~CM_INVITEONLY; + if (chan->custom_modes[CM_INVITEONLY]) *outl++ = 'i'; + chan->custom_modes[CM_INVITEONLY] = 0; } } break; @@ -784,13 +788,13 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int { if (mdir) { - if (!(chan->binarymodes & CM_TOPICLOCK)) *outl++ = 't'; - chan->binarymodes |= CM_TOPICLOCK; + if (!(chan->custom_modes[CM_TOPICLOCK])) *outl++ = 't'; + chan->custom_modes[CM_TOPICLOCK] = 1; } else { - if (chan->binarymodes & CM_TOPICLOCK) *outl++ = 't'; - chan->binarymodes &= ~CM_TOPICLOCK; + if (chan->custom_modes[CM_TOPICLOCK]) *outl++ = 't'; + chan->custom_modes[CM_TOPICLOCK] = 0; } } break; @@ -802,13 +806,13 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int { if (mdir) { - if (!(chan->binarymodes & CM_NOEXTERNAL)) *outl++ = 'n'; - chan->binarymodes |= CM_NOEXTERNAL; + if (!(chan->custom_modes[CM_NOEXTERNAL])) *outl++ = 'n'; + chan->custom_modes[CM_NOEXTERNAL] = 1; } else { - if (chan->binarymodes & CM_NOEXTERNAL) *outl++ = 'n'; - chan->binarymodes &= ~CM_NOEXTERNAL; + if (chan->custom_modes[CM_NOEXTERNAL]) *outl++ = 'n'; + chan->custom_modes[CM_NOEXTERNAL] = 0; } } break; @@ -820,13 +824,13 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int { if (mdir) { - if (!(chan->binarymodes & CM_MODERATED)) *outl++ = 'm'; - chan->binarymodes |= CM_MODERATED; + if (!(chan->custom_modes[CM_MODERATED])) *outl++ = 'm'; + chan->custom_modes[CM_MODERATED] = 1; } else { - if (chan->binarymodes & CM_MODERATED) *outl++ = 'm'; - chan->binarymodes &= ~CM_MODERATED; + if (chan->custom_modes[CM_MODERATED]) *outl++ = 'm'; + chan->custom_modes[CM_MODERATED] = 0; } } break; @@ -838,11 +842,11 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int { if (mdir) { - if (!(chan->binarymodes & CM_SECRET)) *outl++ = 's'; - chan->binarymodes |= CM_SECRET; - if (chan->binarymodes & CM_PRIVATE) + if (!(chan->custom_modes[CM_SECRET])) *outl++ = 's'; + chan->custom_modes[CM_SECRET] = 1; + if (chan->custom_modes[CM_PRIVATE]) { - chan->binarymodes &= ~CM_PRIVATE; + chan->custom_modes[CM_PRIVATE] = 0; if (mdir) { *outl++ = '-'; *outl++ = 'p'; *outl++ = '+'; @@ -851,8 +855,8 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int } else { - if (chan->binarymodes & CM_SECRET) *outl++ = 's'; - chan->binarymodes &= ~CM_SECRET; + if (chan->custom_modes[CM_SECRET]) *outl++ = 's'; + chan->custom_modes[CM_SECRET] = 0; } } break; @@ -864,14 +868,14 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int { if(mdir) { - if(!(chan->binarymodes & CM_PRIVATE)) + if(!(chan->custom_modes[CM_PRIVATE])) *outl++ = 'p'; - chan->binarymodes |= CM_PRIVATE; + chan->custom_modes[CM_PRIVATE] = 1; - if(chan->binarymodes & CM_SECRET) + if(chan->custom_modes[CM_SECRET]) { - chan->binarymodes &= ~CM_SECRET; + chan->custom_modes[CM_SECRET] = 0; *outl++ = '-'; *outl++ = 's'; @@ -880,10 +884,10 @@ void ModeParser::ProcessModes(char **parameters,userrec* user,chanrec *chan,int } else { - if(chan->binarymodes & CM_PRIVATE) + if(chan->custom_modes[CM_PRIVATE]) *outl++ = 'p'; - chan->binarymodes &= ~CM_PRIVATE; + chan->custom_modes[CM_PRIVATE] = 0; } } break; |