summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_connectban.cpp4
-rw-r--r--src/modules/m_dnsbl.cpp7
-rw-r--r--src/modules/m_filter.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.cpp9
4 files changed, 5 insertions, 17 deletions
diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp
index 36e10ec5b..227373a36 100644
--- a/src/modules/m_connectban.cpp
+++ b/src/modules/m_connectban.cpp
@@ -46,9 +46,7 @@ class ModuleConnectBan : public Module
ipv4_cidr = tag->getInt("ipv4cidr", 32, 1, 32);
ipv6_cidr = tag->getInt("ipv6cidr", 128, 1, 128);
threshold = tag->getInt("threshold", 10, 1);
- banduration = InspIRCd::Duration(tag->getString("duration", "10m"));
- if (banduration == 0)
- banduration = 10*60;
+ banduration = tag->getDuration("duration", 10*60, 1);
}
void OnSetUserIP(LocalUser* u) CXX11_OVERRIDE
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index b457648e6..becc7a6e8 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -289,7 +289,7 @@ class ModuleDNSBL : public Module
}
e->banaction = str2banaction(tag->getString("action"));
- e->duration = InspIRCd::Duration(tag->getString("duration", "60"));
+ e->duration = tag->getDuration("duration", 60, 1);
/* Use portparser for record replies */
@@ -314,11 +314,6 @@ class ModuleDNSBL : public Module
std::string location = tag->getTagLocation();
ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): Invalid banaction", location.c_str());
}
- else if (e->duration <= 0)
- {
- std::string location = tag->getTagLocation();
- ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): Invalid duration", location.c_str());
- }
else
{
if (e->reason.empty())
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 30ee35f88..d60dd7942 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -675,7 +675,7 @@ void ModuleFilter::ReadFilters()
std::string reason = i->second->getString("reason");
std::string action = i->second->getString("action");
std::string flgs = i->second->getString("flags");
- unsigned long gline_time = InspIRCd::Duration(i->second->getString("duration"));
+ unsigned long gline_time = i->second->getDuration("duration", 10*60, 1);
if (flgs.empty())
flgs = "*";
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index c689676a9..79cd74505 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -336,7 +336,7 @@ void SpanningTreeUtilities::ReadConfiguration()
L->RecvPass = tag->getString("recvpass", tag->getString("password"));
L->Fingerprint = tag->getString("fingerprint");
L->HiddenFromStats = tag->getBool("statshidden");
- L->Timeout = tag->getInt("timeout", 30);
+ L->Timeout = tag->getDuration("timeout", 30);
L->Hook = tag->getString("ssl");
L->Bind = tag->getString("bind");
L->Hidden = tag->getBool("hidden");
@@ -380,7 +380,7 @@ void SpanningTreeUtilities::ReadConfiguration()
{
ConfigTag* tag = i->second;
reference<Autoconnect> A = new Autoconnect(tag);
- A->Period = tag->getInt("period");
+ A->Period = tag->getDuration("period", 60, 1);
A->NextConnectTime = ServerInstance->Time() + A->Period;
A->position = -1;
irc::spacesepstream ss(tag->getString("server"));
@@ -390,11 +390,6 @@ void SpanningTreeUtilities::ReadConfiguration()
A->servers.push_back(server);
}
- if (A->Period <= 0)
- {
- throw ModuleException("Invalid configuration for autoconnect, period not a positive integer!");
- }
-
if (A->servers.empty())
{
throw ModuleException("Invalid configuration for autoconnect, server cannot be empty!");