]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/opertype.cpp
Replace std::deque with std::vector in spanningtree and related modules
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / opertype.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 "xline.h"
16
17 #include "treesocket.h"
18 #include "treeserver.h"
19 #include "utils.h"
20
21 /* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
22
23
24 /** Because the core won't let users or even SERVERS set +o,
25  * we use the OPERTYPE command to do this.
26  */
27 bool TreeSocket::OperType(const std::string &prefix, parameterlist &params)
28 {
29         if (params.size() != 1)
30                 return true;
31         std::string opertype = params[0];
32         User* u = this->ServerInstance->FindNick(prefix);
33         if (u)
34         {
35                 if (!IS_OPER(u))
36                         this->ServerInstance->Users->all_opers.push_back(u);
37                 u->modes[UM_OPERATOR] = 1;
38                 u->oper.assign(opertype, 0, 512);
39                 Utils->DoOneToAllButSender(u->uuid, "OPERTYPE", params, u->server);
40
41                 TreeServer* remoteserver = Utils->FindServer(u->server);
42                 bool dosend = true;
43
44                 if (this->Utils->quiet_bursts)
45                 {
46                         /*
47                          * If quiet bursts are enabled, and server is bursting or silent uline (i.e. services),
48                          * then do nothing. -- w00t
49                          */
50                         if (
51                                 remoteserver->bursting ||
52                                 this->ServerInstance->SilentULine(this->ServerInstance->FindServerNamePtr(u->server))
53                            )
54                         {
55                                 dosend = false;
56                         }
57                 }
58
59                 if (dosend)
60                         this->ServerInstance->SNO->WriteToSnoMask('O',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server, u->nick.c_str(),u->ident.c_str(), u->host.c_str(), irc::Spacify(opertype.c_str()));
61         }
62         return true;
63 }
64