]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configreader.cpp
Fix test client error cheecking on result types
[user/henk/code/inspircd.git] / src / configreader.cpp
index 2cc1cd9c18af0f72220ae7004d62412d5f91e8a6..b5ea8a8155079c25464ad87f5a10cf582761c075 100644 (file)
@@ -45,7 +45,7 @@ ServerConfig::ServerConfig()
        *CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0';
        *OperOnlyStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = '\0';
        log_file = NULL;
-       forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = false;
+       NoUserDns = forcedebug = OperSpyWhois = nofork = HideBans = HideSplits = false;
        writelog = AllowHalfop = true;
        dns_timeout = DieDelay = 5;
        MaxTargets = 20;
@@ -200,6 +200,28 @@ bool ValidateDnsTimeout(const char* tag, const char* value, void* data)
        return true;
 }
 
+bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance)
+{
+       std::stringstream dcmds(data);
+       std::string thiscmd;
+
+       /* Enable everything first */
+       for (nspace::hash_map<std::string,command_t*>::iterator x = ServerInstance->Parser->cmdlist.begin(); x != ServerInstance->Parser->cmdlist.end(); x++)
+               x->second->Disable(false);
+
+       /* Now disable all the ones which the user wants disabled */
+       while (dcmds >> thiscmd)
+       {
+               nspace::hash_map<std::string,command_t*>::iterator cm = ServerInstance->Parser->cmdlist.find(thiscmd);
+               if (cm != ServerInstance->Parser->cmdlist.end())
+               {
+                       log(DEBUG,"Disabling command '%s'",cm->second->command.c_str());
+                       cm->second->Disable(true);
+               }
+       }
+       return true;
+}
+
 bool ValidateDnsServer(const char* tag, const char* value, void* data)
 {
        char* x = (char*)data;
@@ -545,6 +567,7 @@ void ServerConfig::Read(bool bail, userrec* user)
                {"options",             "hidewhois",                    &this->HideWhoisServer,         DT_CHARPTR, NoValidation},
                {"options",             "operspywhois",                 &this->OperSpyWhois,            DT_BOOLEAN, NoValidation},
                {"options",             "tempdir",                      &this->TempDir,                 DT_CHARPTR, ValidateTempDir},
+               {"options",             "nouserdns",                    &this->NoUserDns,               DT_BOOLEAN, NoValidation},
                {"pid",                 "file",                         &this->PID,                     DT_CHARPTR, NoValidation},
                {NULL}
        };