summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-15 11:47:54 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-15 11:47:54 +0000
commit84b7dc1bf77a2420c323ba5c8627aa00a70e2f6a (patch)
treef2bd37400fccc9bd82fb5683a9d1060ea3c28a05
parentb1d06ea1d3a4a11a8253e0d81c832cb54c3c0946 (diff)
Add tweaks to support feature request in bug #256, now awaiting QA test
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6799 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--docs/inspircd.conf.example2
-rw-r--r--src/configreader.cpp11
2 files changed, 10 insertions, 3 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example
index 5574f6010..32dc56783 100644
--- a/docs/inspircd.conf.example
+++ b/docs/inspircd.conf.example
@@ -171,7 +171,7 @@
# pause="secs before dying"> #
# #
-<power diepass="diepass" restartpass="restartpass" pause="2">
+<power diepass="" restartpass="" pause="2">
#-#-#-#-#-#-#-#-#-# INCLUDE CONFIGURATION #-#-#-#-#-#-#-#-#-#-#-#-#-#
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 56ea49289..dbed24ae5 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -320,6 +320,13 @@ bool ValidateMotd(ServerConfig* conf, const char* tag, const char* value, ValueI
return true;
}
+bool ValidateNotEmpty(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
+{
+ if (!*data.GetString())
+ throw CoreException(std::string("The value for ")+tag+" cannot be empty!");
+ return true;
+}
+
bool ValidateRules(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
{
conf->ReadFile(conf->RULES, data.GetString());
@@ -569,9 +576,9 @@ void ServerConfig::Read(bool bail, userrec* user)
{"admin", "nick", "Misconfigured", new ValueContainerChar (this->AdminNick), DT_CHARPTR, NoValidation},
{"files", "motd", "", new ValueContainerChar (this->motd), DT_CHARPTR, ValidateMotd},
{"files", "rules", "", new ValueContainerChar (this->rules), DT_CHARPTR, ValidateRules},
- {"power", "diepass", "", new ValueContainerChar (this->diepass), DT_CHARPTR, NoValidation},
+ {"power", "diepass", "", new ValueContainerChar (this->diepass), DT_CHARPTR, ValidateNotEmpty},
{"power", "pause", "", new ValueContainerInt (&this->DieDelay), DT_INTEGER, NoValidation},
- {"power", "restartpass", "", new ValueContainerChar (this->restartpass), DT_CHARPTR, NoValidation},
+ {"power", "restartpass", "", new ValueContainerChar (this->restartpass), DT_CHARPTR, ValidateNotEmpty},
{"options", "prefixquit", "", new ValueContainerChar (this->PrefixQuit), DT_CHARPTR, NoValidation},
{"options", "suffixquit", "", new ValueContainerChar (this->SuffixQuit), DT_CHARPTR, NoValidation},
{"options", "fixedquit", "", new ValueContainerChar (this->FixedQuit), DT_CHARPTR, NoValidation},