]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configreader.cpp
Allow use of absolute paths with m_nationalchars
[user/henk/code/inspircd.git] / src / configreader.cpp
index c93e37e1fc35f8a649e873af09cba4c481df5b02..6ef5105aa5003d4c93ad216011035504f604f50d 100644 (file)
@@ -21,7 +21,7 @@
 ServerConfig::ServerConfig()
 {
        WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0;
-       RawLog = NoUserDns = OperSpyWhois = HideBans = HideSplits = UndernetMsgPrefix = false;
+       RawLog = NoUserDns = HideBans = HideSplits = UndernetMsgPrefix = false;
        WildcardIPv6 = CycleHosts = InvBypassModes = true;
        dns_timeout = 5;
        MaxTargets = 20;
@@ -234,7 +234,7 @@ void ServerConfig::CrossCheckOperClassType()
                if (tblk == oper_blocks.end())
                        throw CoreException("Oper block " + name + " has missing type " + type);
                if (oper_blocks.find(name) != oper_blocks.end())
-                       throw CoreException("Duplicate oper block with name " + name);
+                       throw CoreException("Duplicate oper block with name " + name + " at " + tag->getTagLocation());
 
                OperInfo* ifo = new OperInfo;
                ifo->name = type;
@@ -476,7 +476,6 @@ void ServerConfig::Fill()
        HideBans = security->getBool("hidebans");
        HideWhoisServer = security->getString("hidewhois");
        HideKillsServer = security->getString("hidekills");
-       OperSpyWhois = security->getBool("operspywhois");
        RestrictBannedUsers = security->getBool("restrictbannedusers", true);
        GenericOper = security->getBool("genericoper");
        NoUserDns = ConfValue("performance")->getBool("nouserdns");
@@ -532,7 +531,7 @@ void ServerConfig::Fill()
                if (socktest < 0)
                        WildcardIPv6 = false;
                else
-                       close(socktest);
+                       ServerInstance->SE->Close(socktest);
        }
        ConfigTagList tags = ConfTags("uline");
        for(ConfigIter i = tags.first; i != tags.second; ++i)
@@ -588,6 +587,14 @@ void ServerConfig::Fill()
        else
                AnnounceInvites = ServerConfig::INVITE_ANNOUNCE_NONE;
 
+       v = security->getString("operspywhois");
+       if (v == "splitmsg")
+               OperSpyWhois = SPYWHOIS_SPLITMSG;
+       else if (v == "on" || v == "yes")
+               OperSpyWhois = SPYWHOIS_SINGLEMSG;
+       else
+               OperSpyWhois = SPYWHOIS_NONE;
+
        Limits.Finalise();
 }
 
@@ -650,12 +657,13 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
                errstr << ce.GetReason();
        }
 
-       // write once here, to try it out and make sure its ok
-       ServerInstance->WritePID(this->PID);
-
        // Check errors before dealing with failed binds, since continuing on failed bind is wanted in some circumstances.
        valid = errstr.str().empty();
 
+       // write once here, to try it out and make sure its ok
+       if (valid)
+               ServerInstance->WritePID(this->PID);
+
        if (old)
        {
                // On first run, ports are bound later on
@@ -684,19 +692,16 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
        {
                std::string line;
                getline(errstr, line, '\n');
-               if (!line.empty())
-               {
-                       if (user)
-                               user->WriteServ("NOTICE %s :*** %s", user->nick.c_str(), line.c_str());
-                       else
-                               ServerInstance->SNO->WriteGlobalSno('a', line);
-               }
-
+               if (line.empty())
+                       continue;
+               // On startup, print out to console (still attached at this point)
                if (!old)
-               {
-                       // Starting up, so print it out so it's seen. XXX this is a bit of a hack.
                        printf("%s\n", line.c_str());
-               }
+               // If a user is rehashing, tell them directly
+               if (user)
+                       user->SendText(":%s NOTICE %s :*** %s", ServerInstance->Config->ServerName.c_str(), user->nick.c_str(), line.c_str());
+               // Also tell opers
+               ServerInstance->SNO->WriteGlobalSno('a', line);
        }
 
        errstr.clear();
@@ -720,7 +725,8 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
        ApplyModules(user);
 
        if (user)
-               user->WriteServ("NOTICE %s :*** Successfully rehashed server.", user->nick.c_str());
+               user->SendText(":%s NOTICE %s :*** Successfully rehashed server.",
+                       ServerInstance->Config->ServerName.c_str(), user->nick.c_str());
        ServerInstance->SNO->WriteGlobalSno('a', "*** Successfully rehashed server.");
 }
 
@@ -883,7 +889,7 @@ void ConfigReaderThread::Finish()
                ServerInstance->Logs->CloseLogs();
                ServerInstance->Logs->OpenFileLogs();
 
-               if (Config->RawLog)
+               if (Config->RawLog && !old->RawLog)
                        ServerInstance->Users->ServerNoticeAll("*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded.");
 
                Config = old;