]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modes/umode_o.cpp
861fb62dc0bbcde8efe480fefc8ee178108d0a6d
[user/henk/code/inspircd.git] / src / modes / umode_o.cpp
1 #include "inspircd.h"
2 #include "mode.h"
3 #include "channels.h"
4 #include "users.h"
5 #include "modes/umode_o.h"
6
7 ModeUserOperator::ModeUserOperator() : ModeHandler('o', 0, 0, false, MODETYPE_USER, true)
8 {
9 }
10
11 ModeAction ModeUserOperator::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
12 {
13         /* Only opers can execute this class at all */
14         if (!*source->oper)
15                 return MODEACTION_DENY;
16
17         /* Not even opers can GIVE the +o mode, only take it away */
18         if (adding)
19                 return MODEACTION_DENY;
20
21         /* Set the bitfields.
22          * Note that oper status is only given in cmd_oper.cpp
23          * NOT here. It is impossible to directly set +o without
24          * verifying as an oper and getting an opertype assigned
25          * to your userrec!
26          */
27         dest->UnOper();
28
29         return MODEACTION_ALLOW;
30 }