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/modules/m_spanningtree | |
parent | 1e89f510705753a33644b0356cdd902ecc2d9128 (diff) |
Add ConfigTag::getDuration() with optional bounds checking
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
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!"); |