summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-15 01:10:08 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-15 01:10:08 +0000
commit8528562075a54dbb8fc40d100e55e6a8af8067c4 (patch)
treed8c5a88e3db5af5b94258ab57a26eed421747f16
parenteb08ac122471f47488cf411a0d552c5285ca3e66 (diff)
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
-rw-r--r--include/configreader.h7
-rw-r--r--src/configreader.cpp20
-rw-r--r--src/helperfuncs.cpp2
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";