]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modes/umode_w.cpp
9115a67862132911759ef1e9eb298a26fae7e977
[user/henk/code/inspircd.git] / src / modes / umode_w.cpp
1 #include "inspircd.h"
2 #include "mode.h"
3 #include "channels.h"
4 #include "users.h"
5 #include "modes/umode_w.h"
6
7 ModeUserWallops::ModeUserWallops() : ModeHandler('w', 0, 0, false, MODETYPE_USER, false)
8 {
9 }
10
11 ModeAction ModeUserWallops::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
12 {
13         /* Only opers can change other users modes */
14         if ((source != dest) && (!*source->oper))
15                 return MODEACTION_ALLOW;
16
17         /* Set the bitfields */
18         adding ? dest->modebits |= UM_WALLOPS : dest->modebits &= ~UM_WALLOPS;
19
20         /* Use the bitfields to build the user's mode string */
21         ModeParser::BuildModeString(dest);
22
23         /* Allow the change */
24         return MODEACTION_ALLOW;
25 }