]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modes/umode_i.cpp
08af105cabbc3a05d0565dfdf2eab8f15fa3a808
[user/henk/code/inspircd.git] / src / modes / umode_i.cpp
1 #include "inspircd.h"
2 #include "mode.h"
3 #include "channels.h"
4 #include "users.h"
5 #include "modes/umode_i.h"
6
7 ModeUserInvisible::ModeUserInvisible() : ModeHandler('i', 0, 0, false, MODETYPE_USER, false)
8 {
9 }
10
11 ModeAction ModeUserInvisible::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_INVISIBLE : dest->modebits &= ~UM_INVISIBLE;
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 }