]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modes/cmode_o.cpp
Remove InspIRCd* parameters and fields
[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, '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 ModePair ModeChannelOp::ModeSet(User*, User*, Channel* channel, const std::string &parameter)
36 {
37         User* x = ServerInstance->FindNick(parameter);
38         if (x)
39         {
40                 Membership* memb = channel->GetUser(x);
41                 if (memb && memb->hasMode('o'))
42                 {
43                         return std::make_pair(true, x->nick);
44                 }
45                 else
46                 {
47                         return std::make_pair(false, parameter);
48                 }
49         }
50         return std::make_pair(false, parameter);
51 }
52
53
54 void ModeChannelOp::RemoveMode(Channel* channel, irc::modestacker* stack)
55 {
56         const UserMembList* clist = channel->GetUsers();
57
58         for (UserMembCIter i = clist->begin(); i != clist->end(); i++)
59         {
60                 if (stack)
61                         stack->Push(this->GetModeChar(), i->first->nick);
62                 else
63                 {
64                         std::vector<std::string> parameters;
65                         parameters.push_back(channel->name);
66                         parameters.push_back("-o");
67                         parameters.push_back(i->first->nick);
68                         ServerInstance->SendMode(parameters, ServerInstance->FakeClient);
69                 }
70         }
71 }
72
73 void ModeChannelOp::RemoveMode(User*, irc::modestacker* stack)
74 {
75 }
76
77 ModeAction ModeChannelOp::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding)
78 {
79         return MODEACTION_ALLOW;
80 }