]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configreader.cpp
Match USERINPUT/USEROUTPUT identifiers
[user/henk/code/inspircd.git] / src / configreader.cpp
index 5fa56ba8f06a6fbeb09ef83c9122a5890fd2524e..348554584e913aad2989181dfa92aea36c7050ca 100644 (file)
 #include "xline.h"
 #include "exitcodes.h"
 #include "commands/cmd_whowas.h"
-#include "modes/cmode_h.h"
 #include "configparser.h"
 
 ServerConfig::ServerConfig()
 {
        WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0;
        NoUserDns = OperSpyWhois = HideBans = HideSplits = UndernetMsgPrefix = false;
-       CycleHosts = AllowHalfop = InvBypassModes = true;
+       CycleHosts = InvBypassModes = true;
        dns_timeout = DieDelay = 5;
        MaxTargets = 20;
        NetBufferSize = 10240;
@@ -749,9 +748,6 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
                        ServerInstance->Exit(EXIT_STATUS_CONFIG);
                }
 
-               if (ConfValue("options")->getBool("allowhalfop"))
-                       ServerInstance->Modes->AddMode(new ModeChannelHalfOp);
-
                return;
        }
 
@@ -768,18 +764,6 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
 
 void ServerConfig::ApplyModules(User* user)
 {
-       bool AllowHalfOp = ConfValue("options")->getBool("allowhalfop");
-       ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL);
-       if (AllowHalfOp && !mh) {
-               ServerInstance->Logs->Log("CONFIG", DEFAULT, "Enabling halfop mode.");
-               mh = new ModeChannelHalfOp;
-               ServerInstance->Modes->AddMode(mh);
-       } else if (!AllowHalfOp && mh) {
-               ServerInstance->Logs->Log("CONFIG", DEFAULT, "Disabling halfop mode.");
-               ServerInstance->Modes->DelMode(mh);
-               delete mh;
-       }
-
        Module* whowas = ServerInstance->Modules->Find("cmd_whowas.so");
        if (whowas)
                WhowasRequest(NULL, whowas, WhowasRequest::WHOWAS_PRUNE).Send();
@@ -802,6 +786,9 @@ void ServerConfig::ApplyModules(User* user)
                }
        }
 
+       if (ConfValue("options")->getBool("allowhalfop") && removed_modules.erase("m_halfop.so") == 0)
+               added_modules.push_back("m_halfop.so");
+
        for (std::set<std::string>::iterator removing = removed_modules.begin(); removing != removed_modules.end(); removing++)
        {
                // Don't remove cmd_*.so, just remove m_*.so
@@ -925,7 +912,6 @@ std::string ServerConfig::GetSID()
 
 void ConfigReaderThread::Run()
 {
-       Config = new ServerConfig;
        Config->Read();
        done = true;
 }
@@ -957,7 +943,7 @@ void ConfigReaderThread::Finish()
                FOREACH_MOD(I_OnRehash, OnRehash(user));
                ServerInstance->BuildISupport();
 
-               delete old;
+               Config = old;
        }
        else
        {
@@ -965,6 +951,5 @@ void ConfigReaderThread::Finish()
                ServerInstance->Logs->CloseLogs();
                ServerInstance->Config = old;
                ServerInstance->Logs->OpenFileLogs();
-               delete this->Config;
        }
 }