summaryrefslogtreecommitdiff
path: root/src/modules.cpp
diff options
context:
space:
mode:
authorpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-26 00:51:20 +0000
committerpeavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-26 00:51:20 +0000
commit047f09dd572b89223ff3798dc25c34fe4c4172b3 (patch)
tree676ea8fe0e15a648d9bb2ae6dbec27b575f0ce74 /src/modules.cpp
parent1bbe35d493556fd7e6bc2b0b7df3ea888fae8b74 (diff)
Add possibility to define default value for ConfValue in configreader and ReadConf in modules.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6113 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules.cpp')
-rw-r--r--src/modules.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index b218c63ee..18b2bf618 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -625,20 +625,24 @@ ConfigReader::ConfigReader(InspIRCd* Instance, const std::string &filename) : Se
this->error = CONF_FILE_NOT_FOUND;
};
-std::string ConfigReader::ReadValue(const std::string &tag, const std::string &name, int index, bool allow_linefeeds)
+
+std::string ConfigReader::ReadValue(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool allow_linefeeds)
{
/* Don't need to strlcpy() tag and name anymore, ReadConf() takes const char* */
std::string result;
- if (!ServerInstance->Config->ConfValue(*this->data, tag, name, index, result, allow_linefeeds))
+ if (!ServerInstance->Config->ConfValue(*this->data, tag, name, default_value, index, result, allow_linefeeds))
{
this->error = CONF_VALUE_NOT_FOUND;
- return "";
}
-
return result;
}
+std::string ConfigReader::ReadValue(const std::string &tag, const std::string &name, int index, bool allow_linefeeds)
+{
+ return ReadValue(tag, name, "", index, allow_linefeeds);
+}
+
bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int index)
{
return ServerInstance->Config->ConfValueBool(*this->data, tag, name, index);