]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configparser.cpp
m_spanningtree Remove duplicate code for sending channel messages from RouteCommand()
[user/henk/code/inspircd.git] / src / configparser.cpp
index 1783e901e8f8a23f725a537479fab617a36b2c8e..d3723d35036a790d4d360babb6611d3f469e081c 100644 (file)
@@ -445,13 +445,30 @@ long ConfigTag::getInt(const std::string &key, long def, long min, long max)
                        res = res * 1024 * 1024 * 1024;
                        break;
        }
+
+       CheckRange(key, res, def, min, max);
+       return res;
+}
+
+void ConfigTag::CheckRange(const std::string& key, long& res, long def, long min, long max)
+{
        if (res < min || res > max)
        {
                ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "WARNING: <%s:%s> value of %ld is not between %ld and %ld; set to %ld.",
                        tag.c_str(), key.c_str(), res, min, max, def);
                res = def;
        }
-       return res;
+}
+
+time_t ConfigTag::getDuration(const std::string& key, long def, long min, long max)
+{
+       std::string duration;
+       if (!readString(key, duration))
+               return def;
+
+       time_t ret = InspIRCd::Duration(duration);
+       CheckRange(key, ret, def, min, max);
+       return ret;
 }
 
 double ConfigTag::getFloat(const std::string &key, double def)