diff options
-rw-r--r-- | include/configreader.h | 7 | ||||
-rw-r--r-- | src/configreader.cpp | 20 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 2 |
3 files changed, 27 insertions, 2 deletions
diff --git a/include/configreader.h b/include/configreader.h index 009b8a0ea..aea355583 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -178,6 +178,13 @@ struct InitialConfig Validator validation_function; }; +struct Deprecated +{ + const char* tag; + const char* value; + const char* reason; +}; + /** Holds a core configuration item and its callbacks * where there may be more than one item */ diff --git a/src/configreader.cpp b/src/configreader.cpp index 20e6c7c87..81ae1e6c0 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -761,6 +761,14 @@ void ServerConfig::Read(bool bail, User* user) /* These tags MUST occur and must ONLY occur once in the config file */ static const char* Once[] = { "server", "admin", "files", "power", "options", NULL }; + Deprecated ChangedConfig[] = { + {"options", "hidelinks", "has been moved to <security:hidelinks> as of 1.2a3"}, + {"options", "hidewhois", "has been moved to <security:hidewhois> as of 1.2a3"}, + {"options", "nouserdns", "has been moved to <performance:nouserdns> as of 1.2a3"}, + {"options", "maxwho", "has been moved to <performance:maxwho> as of 1.2a3"}, + {NULL, NULL, NULL} + }; + /* These tags can occur ONCE or not at all */ InitialConfig Values[] = { {"performance", "softlimit", "0", new ValueContainerUInt (&this->SoftLimit), DT_INTEGER, ValidateSoftLimit}, @@ -921,6 +929,16 @@ void ServerConfig::Read(bool bail, User* user) if (!CheckOnce(Once[Index], newconfig)) return; + for (int Index = 0; ChangedConfig[Index].tag; Index++) + { + char item[MAXBUF]; + *item = 0; + if (ConfValue(newconfig, ChangedConfig[Index].tag, ChangedConfig[Index].value, "", 0, item, MAXBUF, true) || *item) + throw CoreException(std::string("Your configuration contains a deprecated value: <") + ChangedConfig[Index].tag + ":" + ChangedConfig[Index].value + "> - " + ChangedConfig[Index].reason); + else + ServerInstance->Logs->Log("CONFIG",DEBUG,"Deprecated item <%s:%s> does not exist, good.", ChangedConfig[Index].tag, ChangedConfig[Index].value); + } + /* Read the values of all the tags which occur once or not at all, and call their callbacks. */ for (int Index = 0; Values[Index].tag; Index++) @@ -1709,7 +1727,7 @@ bool ServerConfig::ConfValue(ConfigDataHash &target, const std::string &tag, con return true; } } - else if(pos == 0) + else if (pos == 0) { if (!default_value.empty()) { diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index ce962fea6..b0c966457 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -308,7 +308,7 @@ bool InspIRCd::OpenLog(char**, int) if (Config->logpath.empty()) { std::string path = std::string(home) + "/.inspircd"; - if (!mkdir(path.c_str(), 0700)) + if (!mkdir(path.c_str(), 0700) && errno != EEXIST) { /* Log to ~/.inspircd/ircd.log */ Config->logpath = path + "/startup.log"; |