From c5fb3762a5b459a4a2eb9af12327befc6832c55a Mon Sep 17 00:00:00 2001 From: Andreas Scherbaum Date: Mon, 27 Feb 2012 14:29:34 +0100 Subject: [PATCH] - add more configuration checks (search:maxresults and search:maxwrap) --- docbot.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docbot.pl b/docbot.pl index 30aafae..29da7a3 100755 --- a/docbot.pl +++ b/docbot.pl @@ -481,6 +481,21 @@ sub validate_config { die("Please set config value 'irc:server'\n"); } + if (!config_get_key2('search', 'maxresults')) { + die("Please set config value 'search:maxresults'\n"); + } + my $maxresults = config_get_key2('search', 'maxresults'); + if ($maxresults !~ /^\d+$/ or $maxresults < 1) { + die("'search:maxresults' must be a positive integer\n"); + } + if (!config_get_key2('search', 'maxwrap')) { + die("Please set config value 'search:maxwrap'\n"); + } + my $maxwrap = config_get_key2('search', 'maxwrap'); + if ($maxwrap !~ /^\d+$/ or $maxwrap < 1) { + die("'search:maxwrap' must be a positive integer\n"); + } + my @sessions = config_get_keys1('sessions'); my %seen_nicknames = (); my %seen_sessions = (); -- 2.39.5