2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2018-2019 Sadie Powell <sadie@witchery.services>
5 * Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
6 * Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
8 * This file is part of InspIRCd. InspIRCd is free software: you can
9 * redistribute it and/or modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation, version 2.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "core_oper.h"
25 class CoreModOper : public Module
27 std::string powerhash;
32 CommandRehash cmdrehash;
33 CommandRestart cmdrestart;
37 : cmddie(this, powerhash)
41 , cmdrestart(this, powerhash)
45 void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
47 ConfigTag* tag = ServerInstance->Config->ConfValue("power");
49 // The hash method for *BOTH* the die and restart passwords
50 powerhash = tag->getString("hash");
52 cmddie.password = tag->getString("diepass", ServerInstance->Config->ServerName, 1);
53 cmdrestart.password = tag->getString("restartpass", ServerInstance->Config->ServerName, 1);
55 ConfigTag* security = ServerInstance->Config->ConfValue("security");
56 cmdkill.hidenick = security->getString("hidekills");
57 cmdkill.hideuline = security->getBool("hideulinekills");
60 void OnPostOper(User* user, const std::string&, const std::string&) CXX11_OVERRIDE
62 LocalUser* luser = IS_LOCAL(user);
66 const std::string vhost = luser->oper->getConfig("vhost");
68 luser->ChangeDisplayedHost(vhost);
70 const std::string klass = luser->oper->getConfig("class");
72 luser->SetClass(klass);
75 Version GetVersion() CXX11_OVERRIDE
77 return Version("Provides the DIE, KILL, OPER, REHASH, and RESTART commands", VF_VENDOR | VF_CORE);
81 MODULE_INIT(CoreModOper)