diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-26 01:48:55 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-26 01:48:55 +0000 |
commit | f3f570b4fa14dd375ad4a06bddca8f365fb32c55 (patch) | |
tree | 0f229c738f8af1a0451b109c6e8c64448ed734c1 /src/modules.cpp | |
parent | 513917fccef70a34ecdc3db2952edfa84910c7b7 (diff) |
Also add support for default values for ConfValueBool and ConfValueInteger in configreader, and for ReadFlag and ReadInteger in modules.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6116 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules.cpp')
-rw-r--r-- | src/modules.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 18b2bf618..69506c7a6 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -643,16 +643,22 @@ std::string ConfigReader::ReadValue(const std::string &tag, const std::string &n return ReadValue(tag, name, "", index, allow_linefeeds); } +bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, const std::string &default_value, int index) +{ + return ServerInstance->Config->ConfValueBool(*this->data, tag, name, default_value, index); +} + bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int index) { - return ServerInstance->Config->ConfValueBool(*this->data, tag, name, index); + return ReadFlag(tag, name, "", index); } -long ConfigReader::ReadInteger(const std::string &tag, const std::string &name, int index, bool needs_unsigned) + +long ConfigReader::ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool needs_unsigned) { int result; - if(!ServerInstance->Config->ConfValueInteger(*this->data, tag, name, index, result)) + if(!ServerInstance->Config->ConfValueInteger(*this->data, tag, name, default_value, index, result)) { this->error = CONF_VALUE_NOT_FOUND; return 0; @@ -667,6 +673,11 @@ long ConfigReader::ReadInteger(const std::string &tag, const std::string &name, return result; } +long ConfigReader::ReadInteger(const std::string &tag, const std::string &name, int index, bool needs_unsigned) +{ + return ReadInteger(tag, name, "", index, needs_unsigned); +} + long ConfigReader::GetError() { long olderr = this->error; |