]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_oper/core_oper.cpp
Remove a long obsolete comment from the example conf.
[user/henk/code/inspircd.git] / src / coremods / core_oper / core_oper.cpp
index f94681138426856f14e853b2447ef0c104ca196a..3e00eeb523c537046a6872c378954645dfe5e6d2 100644 (file)
@@ -1,6 +1,8 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
+ *   Copyright (C) 2018-2019 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2018 linuxdaemon <linuxdaemon.irc@gmail.com>
  *   Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
@@ -22,6 +24,8 @@
 
 class CoreModOper : public Module
 {
+       std::string powerhash;
+
        CommandDie cmddie;
        CommandKill cmdkill;
        CommandOper cmdoper;
@@ -30,13 +34,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);
        }
 };