From 8528562075a54dbb8fc40d100e55e6a8af8067c4 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 15 Apr 2008 01:10:08 +0000 Subject: See configreader.cpp line 764 to see how to declare deprecated items. This is reasonably well thought out so i see no issue with leaving items here a very long time :) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9507 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/configreader.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/configreader.cpp') 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 as of 1.2a3"}, + {"options", "hidewhois", "has been moved to as of 1.2a3"}, + {"options", "nouserdns", "has been moved to as of 1.2a3"}, + {"options", "maxwho", "has been moved to 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()) { -- cgit v1.3.1-10-gc9f91