2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2017-2018 Sadie Powell <sadie@witchery.services>
5 * Copyright (C) 2012-2014 Attila Molnar <attilamolnar@hush.com>
6 * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
7 * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
8 * Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
9 * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
11 * This file is part of InspIRCd. InspIRCd is free software: you can
12 * redistribute it and/or modify it under the terms of the GNU General Public
13 * License as published by the Free Software Foundation, version 2.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 #include "treeserver.h"
30 /** Because the core won't let users or even SERVERS set +o,
31 * we use the OPERTYPE command to do this.
33 CmdResult CommandOpertype::HandleRemote(RemoteUser* u, CommandBase::Params& params)
35 const std::string& opertype = params[0];
37 ServerInstance->Users->all_opers.push_back(u);
39 ModeHandler* opermh = ServerInstance->Modes->FindMode('o', MODETYPE_USER);
41 u->SetMode(opermh, true);
43 ServerConfig::OperIndex::const_iterator iter = ServerInstance->Config->OperTypes.find(opertype);
44 if (iter != ServerInstance->Config->OperTypes.end())
45 u->oper = iter->second;
47 u->oper = new OperInfo(opertype);
49 if (Utils->quiet_bursts)
52 * If quiet bursts are enabled, and server is bursting or silent uline (i.e. services),
53 * then do nothing. -- w00t
55 TreeServer* remoteserver = TreeServer::Get(u);
56 if (remoteserver->IsBehindBursting() || remoteserver->IsSilentULine())
60 ServerInstance->SNO->WriteToSnoMask('O', "From %s: User %s (%s@%s) is now a server operator of type %s", u->server->GetName().c_str(), u->nick.c_str(),u->ident.c_str(), u->GetRealHost().c_str(), opertype.c_str());
64 CommandOpertype::Builder::Builder(User* user)
65 : CmdBuilder(user, "OPERTYPE")
67 push_last(user->oper->name);