]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modes/cmode_o.cpp
Get rid of ModePair
[user/henk/code/inspircd.git] / src / modes / cmode_o.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/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 "configreader.h"
16 #include "mode.h"
17 #include "channels.h"
18 #include "users.h"
19 #include "modules.h"
20 #include "modes/cmode_o.h"
21
22 ModeChannelOp::ModeChannelOp() : ModeHandler(NULL, "op", 'o', PARAM_ALWAYS, MODETYPE_CHANNEL)
23 {
24         list = true;
25         prefix = '@';
26         levelrequired = OP_VALUE;
27         m_paramtype = TR_NICK;
28 }
29
30 unsigned int ModeChannelOp::GetPrefixRank()
31 {
32         return OP_VALUE;
33 }
34
35 void ModeChannelOp::RemoveMode(Channel* channel, irc::modestacker* stack)
36 {
37         const UserMembList* clist = channel->GetUsers();
38
39         for (UserMembCIter i = clist->begin(); i != clist->end(); i++)
40         {
41                 if (stack)
42                         stack->Push(this->GetModeChar(), i->first->nick);
43                 else
44                 {
45                         std::vector<std::string> parameters;
46                         parameters.push_back(channel->name);
47                         parameters.push_back("-o");
48                         parameters.push_back(i->first->nick);
49                         ServerInstance->SendMode(parameters, ServerInstance->FakeClient);
50                 }
51         }
52 }
53
54 void ModeChannelOp::RemoveMode(User*, irc::modestacker* stack)
55 {
56 }
57
58 ModeAction ModeChannelOp::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding)
59 {
60         return MODEACTION_ALLOW;
61 }