X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_oper%2Fcore_oper.cpp;h=eaa1a044ba77bd4613ef71fc1a2ea7847a34f83b;hb=dd6f545ab6ed7e6ce0800431addef6af0d2610c5;hp=a6b2abd81194a8f6722481aca6b3c5bc0d166b9f;hpb=c0aba5b728b0a921d95ec120aa638dab1520b42f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_oper/core_oper.cpp b/src/coremods/core_oper/core_oper.cpp index a6b2abd81..eaa1a044b 100644 --- a/src/coremods/core_oper/core_oper.cpp +++ b/src/coremods/core_oper/core_oper.cpp @@ -20,20 +20,10 @@ #include "inspircd.h" #include "core_oper.h" -namespace DieRestart -{ - bool CheckPass(User* user, const std::string& inputpass, const char* confentry) - { - ConfigTag* tag = ServerInstance->Config->ConfValue("power"); - // The hash method for *BOTH* the die and restart passwords - const std::string hash = tag->getString("hash"); - const std::string correctpass = tag->getString(confentry, ServerInstance->Config->ServerName); - return ServerInstance->PassCompare(user, correctpass, inputpass, hash); - } -} - class CoreModOper : public Module { + std::string powerhash; + CommandDie cmddie; CommandKill cmdkill; CommandOper cmdoper; @@ -42,13 +32,47 @@ class CoreModOper : public Module public: CoreModOper() - : cmddie(this), cmdkill(this), cmdoper(this), cmdrehash(this), cmdrestart(this) + : cmddie(this, powerhash) + , cmdkill(this) + , cmdoper(this) + , cmdrehash(this) + , cmdrestart(this, powerhash) + { + } + + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { + ConfigTag* tag = ServerInstance->Config->ConfValue("power"); + + // The hash method for *BOTH* the die and restart passwords + powerhash = tag->getString("hash"); + + cmddie.password = tag->getString("diepass", ServerInstance->Config->ServerName, 1); + cmdrestart.password = tag->getString("restartpass", ServerInstance->Config->ServerName, 1); + + ConfigTag* security = ServerInstance->Config->ConfValue("security"); + cmdkill.hidenick = security->getString("hidekills"); + cmdkill.hideuline = security->getBool("hideulinekills"); + } + + void OnPostOper(User* user, const std::string&, const std::string&) CXX11_OVERRIDE + { + LocalUser* luser = IS_LOCAL(user); + if (!luser) + return; + + const std::string vhost = luser->oper->getConfig("vhost"); + if (!vhost.empty()) + luser->ChangeDisplayedHost(vhost); + + const std::string klass = luser->oper->getConfig("class"); + if (!klass.empty()) + luser->SetClass(klass); } Version GetVersion() CXX11_OVERRIDE { - return Version("Provides the DIE, KILL, OPER, REHASH, and RESTART commands", VF_VENDOR|VF_CORE); + return Version("Provides the DIE, KILL, OPER, REHASH, and RESTART commands", VF_VENDOR | VF_CORE); } };