From f3f570b4fa14dd375ad4a06bddca8f365fb32c55 Mon Sep 17 00:00:00 2001 From: peavey Date: Tue, 26 Dec 2006 01:48:55 +0000 Subject: 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 --- src/modules.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/modules.cpp') 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; -- cgit v1.2.3