]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modes/umode_n.cpp
Snomask support cometh! and it leave a sticky white mess all over the floor :(
[user/henk/code/inspircd.git] / src / modes / umode_n.cpp
1 #include "inspircd.h"
2 #include "mode.h"
3 #include "channels.h"
4 #include "users.h"
5 #include "modes/umode_n.h"
6
7 ModeUserServerNoticeMask::ModeUserServerNoticeMask(InspIRCd* Instance) : ModeHandler(Instance, 'n', 1, 0, false, MODETYPE_USER, true)
8 {
9 }
10
11 ModeAction ModeUserServerNoticeMask::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_DENY;
16
17         /* Set the bitfields */
18         if (adding)
19         {
20                 parameter = dest->ProcessNoticeMasks(parameter.c_str());
21                 return MODEACTION_ALLOW;
22         }
23         else if (dest->modes[UM_SNOMASK] != false)
24         {
25                 dest->modes[UM_SNOMASK] = false;
26                 return MODEACTION_ALLOW;
27         }
28
29         /* Allow the change */
30         return MODEACTION_DENY;
31 }
32