X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fconfigreader.cpp;h=db897b6cc33430d4f21e96590bb23f1fa7927c30;hb=090e7b616104723960ab51d8faa966af333eb15d;hp=cbd9049a0cec932d3acebd0245d384788be18f0f;hpb=922cec5bc322c659e5014af82b8083b7ff93d225;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/configreader.cpp b/src/configreader.cpp index cbd9049a0..db897b6cc 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -707,12 +707,6 @@ bool DoneMaxBans(ServerConfig*, const char*) return true; } -void ServerConfig::ReportConfigError(const std::string &errormessage) -{ - ServerInstance->Logs->Log("CONFIG",DEFAULT, "There were errors in your configuration file: %s", errormessage.c_str()); - errstr << errormessage << std::endl; -} - void ServerConfig::Read() { static char maxkeep[MAXBUF]; /* Temporary buffer for WhoWasMaxKeep value */ @@ -1171,12 +1165,22 @@ void ServerConfig::Read() void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) { int rem = 0, add = 0; + bool errors = false; // write once here, to try it out and make sure its ok ServerInstance->WritePID(this->PID); FailedPortList pl; ServerInstance->BindPorts(pl); + /* + * These values can only be set on boot. Keep their old values. Do it before we send messages so we actually have a servername. + */ + if (old) + { + memcpy(this->ServerName, old->ServerName, sizeof(this->ServerName)); + memcpy(this->sid, old->sid, sizeof(this->sid)); + } + if (pl.size()) { errstr << "Not all your client ports could be bound.\nThe following port(s) failed to bind:\n"; @@ -1194,6 +1198,9 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) while (errstr.good()) { + if (errors == false) + ServerInstance->Logs->Log("CONFIG",DEFAULT, "There were errors in your configuration file:"); + errors = true; // XXX: has to be a nicer way to accomplish this. std::string line; getline(errstr, line, '\n'); if (!line.empty()) @@ -1203,6 +1210,12 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) else ServerInstance->SNO->WriteGlobalSno('a', line); } + + 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()); + } } errstr.clear(); @@ -1212,11 +1225,10 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) if (!old) return; - /* - * These values can only be set on boot. Keep their old values. - */ - memcpy(this->ServerName, old->ServerName, sizeof(this->ServerName)); - memcpy(this->sid, old->sid, sizeof(this->sid)); + // If there were errors processing configuration, don't touch modules. + if (errors) + return; + if (!removed_modules.empty()) {