]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/opertype.cpp
...because every now and again, i have to do a massive commit.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / opertype.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 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 = ServerInstance->FindNick(prefix);
33         if (u)
34         {
35                 if (!IS_OPER(u))
36                         ServerInstance->Users->all_opers.push_back(u);
37                 u->modes[UM_OPERATOR] = 1;
38                 OperIndex::iterator iter = ServerInstance->Config->oper_blocks.find(" " + opertype);
39                 if (iter != ServerInstance->Config->oper_blocks.end())
40                         u->oper = iter->second;
41                 else
42                 {
43                         u->oper = new OperInfo;
44                         u->oper->name = opertype;
45                 }
46                 Utils->DoOneToAllButSender(u->uuid, "OPERTYPE", params, u->server);
47
48                 TreeServer* remoteserver = Utils->FindServer(u->server);
49                 bool dosend = true;
50
51                 if (this->Utils->quiet_bursts)
52                 {
53                         /*
54                          * If quiet bursts are enabled, and server is bursting or silent uline (i.e. services),
55                          * then do nothing. -- w00t
56                          */
57                         if (remoteserver->bursting || ServerInstance->SilentULine(u->server))
58                         {
59                                 dosend = false;
60                         }
61                 }
62
63                 if (dosend)
64                         ServerInstance->SNO->WriteToSnoMask('O',"From %s: User %s (%s@%s) is now an IRC operator of type %s",u->server.c_str(), u->nick.c_str(),u->ident.c_str(), u->host.c_str(), irc::Spacify(opertype.c_str()));
65         }
66         return true;
67 }
68