]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modes/umode_o.cpp
OOPS! We try again, since I'm smoking craq. LF is 0x0a NOT CR.
[user/henk/code/inspircd.git] / src / modes / umode_o.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15 #include "mode.h"
16 #include "channels.h"
17 #include "users.h"
18 #include "modes/umode_o.h"
19
20 ModeUserOperator::ModeUserOperator(InspIRCd* Instance) : ModeHandler(Instance, 'o', 0, 0, false, MODETYPE_USER, true)
21 {
22 }
23
24 ModeAction ModeUserOperator::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
25 {
26         /* Only opers can execute this class at all */
27         if (!*source->oper)
28                 return MODEACTION_DENY;
29
30         /* Not even opers can GIVE the +o mode, only take it away */
31         if (adding)
32                 return MODEACTION_DENY;
33
34         /* Set the bitfields.
35          * Note that oper status is only given in cmd_oper.cpp
36          * NOT here. It is impossible to directly set +o without
37          * verifying as an oper and getting an opertype assigned
38          * to your userrec!
39          */
40         ServerInstance->SNO->WriteToSnoMask('o', "User %s de-opered (by %s)", dest->nick, source->nick);
41         dest->UnOper();
42
43         return MODEACTION_ALLOW;
44 }
45
46 unsigned int ModeUserOperator::GetCount()
47 {
48         return ServerInstance->all_opers.size();
49 }