diff options
author | louiz’ <louiz@louiz.org> | 2019-11-06 17:21:06 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2019-11-06 17:23:35 +0100 |
commit | 34b4caeccf03f4f6ae14e94b35ca1bb6e3cee1ec (patch) | |
tree | 006b0c35d4925698797b030d8fc09b0167b97a56 /src | |
parent | 752cb86d8a5db9e89648c7002dcef6bc20c197eb (diff) | |
download | biboumi-34b4caeccf03f4f6ae14e94b35ca1bb6e3cee1ec.tar.gz biboumi-34b4caeccf03f4f6ae14e94b35ca1bb6e3cee1ec.tar.bz2 biboumi-34b4caeccf03f4f6ae14e94b35ca1bb6e3cee1ec.tar.xz biboumi-34b4caeccf03f4f6ae14e94b35ca1bb6e3cee1ec.zip |
Properly set the default values for invalid integer conf options
fix #3372
Diffstat (limited to 'src')
-rw-r--r-- | src/xmpp/biboumi_adhoc_commands.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/xmpp/biboumi_adhoc_commands.cpp b/src/xmpp/biboumi_adhoc_commands.cpp index f17a016..ef230fe 100644 --- a/src/xmpp/biboumi_adhoc_commands.cpp +++ b/src/xmpp/biboumi_adhoc_commands.cpp @@ -192,7 +192,13 @@ void ConfigureGlobalStep2(XmppComponent& xmpp_component, AdhocSession& session, if (field->get_tag("var") == "max_history_length" && value && !value->get_inner().empty()) - options.col<Database::MaxHistoryLength>() = atoi(value->get_inner().data()); + { + try { + options.col<Database::MaxHistoryLength>() = std::stol(value->get_inner().data()); + } catch (const std::logic_error&) { + options.col<Database::MaxHistoryLength>() = 20; + } + } else if (field->get_tag("var") == "record_history" && value && !value->get_inner().empty()) { @@ -497,7 +503,7 @@ void ConfigureIrcServerStep2(XmppComponent& xmpp_component, AdhocSession& sessio try { options.col<Database::ThrottleLimit>() = std::stol(value->get_inner()); } catch (const std::logic_error&) { - options.col<Database::ThrottleLimit>() = -1; + options.col<Database::ThrottleLimit>() = 10; } Bridge* bridge = biboumi_component.find_user_bridge(session.get_owner_jid()); if (bridge) |