]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/umode_w.cpp
Change to using Instance->Log (InspIRCd::Log) rather than log() macro
[user/henk/code/inspircd.git] / src / modes / umode_w.cpp
index 9115a67862132911759ef1e9eb298a26fae7e977..af00ac17eaa7abdcc9ee987894ed059317e7d5c6 100644 (file)
@@ -4,7 +4,7 @@
 #include "users.h"
 #include "modes/umode_w.h"
 
-ModeUserWallops::ModeUserWallops() : ModeHandler('w', 0, 0, false, MODETYPE_USER, false)
+ModeUserWallops::ModeUserWallops(InspIRCd* Instance) : ModeHandler(Instance, 'w', 0, 0, false, MODETYPE_USER, false)
 {
 }
 
@@ -12,14 +12,15 @@ ModeAction ModeUserWallops::OnModeChange(userrec* source, userrec* dest, chanrec
 {
        /* Only opers can change other users modes */
        if ((source != dest) && (!*source->oper))
-               return MODEACTION_ALLOW;
+               return MODEACTION_DENY;
 
        /* Set the bitfields */
-       adding ? dest->modebits |= UM_WALLOPS : dest->modebits &= ~UM_WALLOPS;
-
-       /* Use the bitfields to build the user's mode string */
-       ModeParser::BuildModeString(dest);
+       if (dest->modes[UM_WALLOPS] != adding)
+       {
+               dest->modes[UM_WALLOPS] = adding;
+               return MODEACTION_ALLOW;
+       }
 
        /* Allow the change */
-       return MODEACTION_ALLOW;
+       return MODEACTION_DENY;
 }