diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-08-12 19:20:18 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-08-12 19:20:18 +0200 |
commit | 6d39615998dee7b30565d34a9f209b569678fb6a (patch) | |
tree | 477fdbe6d1f385e797e58e64cbc3af9bdbda9a64 /src/commands | |
parent | 1e89f510705753a33644b0356cdd902ecc2d9128 (diff) |
Add ConfigTag::getDuration() with optional bounds checking
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/cmd_whowas.cpp | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index 8a1c9a820..093d948b4 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -299,16 +299,6 @@ class ModuleWhoWas : public Module { CommandWhowas cmd; - void RangeCheck(int& value, int min, int max, int def, const char* msg) - { - // From ConfigReader - if (value >= min && value <= max) - return; - - ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "WARNING: %s value of %d is not between %d and %d; set to %d.", msg, value, min, max, def); - value = def; - } - public: ModuleWhoWas() : cmd(this) { @@ -344,9 +334,7 @@ class ModuleWhoWas : public Module ConfigTag* tag = ServerInstance->Config->ConfValue("whowas"); int NewGroupSize = tag->getInt("groupsize", 10, 0, 10000); int NewMaxGroups = tag->getInt("maxgroups", 10240, 0, 1000000); - int NewMaxKeep = InspIRCd::Duration(tag->getString("maxkeep")); - - RangeCheck(NewMaxKeep, 3600, INT_MAX, 3600, "<whowas:maxkeep>"); + int NewMaxKeep = tag->getDuration("maxkeep", 3600, 3600); if ((NewGroupSize == cmd.WhoWasGroupSize) && (NewMaxGroups == cmd.WhoWasMaxGroups) && (NewMaxKeep == cmd.WhoWasMaxKeep)) return; |