2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2010 Daniel De Graaf <danieldg@inspircd.org>
5 * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
7 * This file is part of InspIRCd. InspIRCd is free software: you can
8 * redistribute it and/or modify it under the terms of the GNU General Public
9 * License as published by the Free Software Foundation, version 2.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "treeserver.h"
26 /** Because the core won't let users or even SERVERS set +o,
27 * we use the OPERTYPE command to do this.
29 CmdResult CommandOpertype::Handle(const std::vector<std::string>& params, User *u)
31 SpanningTreeUtilities* Utils = ((ModuleSpanningTree*)(Module*)creator)->Utils;
32 const std::string& opertype = params[0];
34 ServerInstance->Users->all_opers.push_back(u);
35 u->modes[UM_OPERATOR] = 1;
36 OperIndex::iterator iter = ServerInstance->Config->oper_blocks.find(" " + opertype);
37 if (iter != ServerInstance->Config->oper_blocks.end())
38 u->oper = iter->second;
41 u->oper = new OperInfo;
42 u->oper->name = opertype;
45 if (Utils->quiet_bursts)
48 * If quiet bursts are enabled, and server is bursting or silent uline (i.e. services),
49 * then do nothing. -- w00t
51 TreeServer* remoteserver = Utils->FindServer(u->server);
52 if (remoteserver->bursting || ServerInstance->SilentULine(u->server))
56 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()));