From: timriker Date: Tue, 8 Mar 2005 22:47:22 +0000 (+0000) Subject: explicit $chan for getChanConfDefault X-Git-Url: https://git.donarmstrong.com/?p=infobot.git;a=commitdiff_plain;h=a41f790cd30339179f7ae655a3009f22d61fc9e3 explicit $chan for getChanConfDefault git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1210 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/Factoids/Core.pl b/src/Factoids/Core.pl index c3fb474..979db4b 100644 --- a/src/Factoids/Core.pl +++ b/src/Factoids/Core.pl @@ -158,11 +158,9 @@ sub FactoidStuff { my $author = &getFactInfo($faqtoid, "created_by"); my $count = &getFactInfo($faqtoid, "requested_count") || 0; # don't delete if requested $limit times - my $limit = &getChanConfDefault( - "factoidPreventForgetLimit", 100, $chan); + my $limit = &getChanConfDefault('factoidPreventForgetLimit', 100, $chan); # don't delete if older than $limitage seconds (modified by requests below) - my $limitage = &getChanConfDefault( - "factoidPreventForgetLimitTime", 7 * 24 * 60 * 60, $chan); + my $limitage = &getChanConfDefault('factoidPreventForgetLimitTime', 7 * 24 * 60 * 60, $chan); my $t = &getFactInfo($faqtoid, "created_time") || 0; my $age = time() - $t; diff --git a/src/Factoids/Reply.pl b/src/Factoids/Reply.pl index 8c72ac1..aedf3cb 100644 --- a/src/Factoids/Reply.pl +++ b/src/Factoids/Reply.pl @@ -28,8 +28,8 @@ sub getReply { $message =~ tr/A-Z/a-z/; - @searches = split(/\s+/, &getChanConfDefault('factoidSearch', '_default')); - + @searches = split(/\s+/, &getChanConfDefault('factoidSearch', '_default', $chan)); + &::DEBUG("factoidSearch: $chan is: " . join(':', @searches)); # requesting the _default one, ignore factoidSearch if ($message =~ /^_default\s+/) { @searches = ('_default'); diff --git a/src/IRC/Irc.pl b/src/IRC/Irc.pl index 67de4ca..0afd7d7 100644 --- a/src/IRC/Irc.pl +++ b/src/IRC/Irc.pl @@ -233,8 +233,8 @@ sub say { $pubcount++; $pubsize += length $msg; - my $i = &getChanConfDefault("sendPublicLimitLines", 3); - my $j = &getChanConfDefault("sendPublicLimitBytes", 1000); + my $i = &getChanConfDefault("sendPublicLimitLines", 3, $chan); + my $j = &getChanConfDefault("sendPublicLimitBytes", 1000, $chan); if ( ($pubcount % $i) == 0 and $pubcount) { sleep 1; @@ -274,8 +274,8 @@ sub msg { $msgcount++; $msgsize += length $msg; - my $i = &getChanConfDefault("sendPrivateLimitLines", 3); - my $j = &getChanConfDefault("sendPrivateLimitBytes", 1000); + my $i = &getChanConfDefault("sendPrivateLimitLines", 3, $chan); + my $j = &getChanConfDefault("sendPrivateLimitBytes", 1000, $chan); if ( ($msgcount % $i) == 0 and $msgcount) { sleep 1; } elsif ($msgsize > $j) { @@ -326,8 +326,8 @@ sub notice { $notcount++; $notsize += length $txt; - my $i = &getChanConfDefault("sendNoticeLimitLines", 3); - my $j = &getChanConfDefault("sendNoticeLimitBytes", 1000); + my $i = &getChanConfDefault("sendNoticeLimitLines", 3, $chan); + my $j = &getChanConfDefault("sendNoticeLimitBytes", 1000, $chan); if ( ($notcount % $i) == 0 and $notcount) { sleep 1; diff --git a/src/IRC/Schedulers.pl b/src/IRC/Schedulers.pl index 963cad6..8a9700c 100644 --- a/src/IRC/Schedulers.pl +++ b/src/IRC/Schedulers.pl @@ -29,7 +29,7 @@ sub setupSchedulersII { sub queueTask { my($codename, $chanconfdef, $intervaldef, $defer) = @_; - my $t = &getChanConfDefault($chanconfdef, $intervaldef); + my $t = &getChanConfDefault($chanconfdef, $intervaldef, $chan); my $waittime = &getRandomInt($t); if (!defined $waittime) { @@ -125,7 +125,7 @@ sub ScheduleThis { #### sub randomQuote { - my $interval = &getChanConfDefault("randomQuoteInterval", 60); + my $interval = &getChanConfDefault("randomQuoteInterval", 60, $chan); if (@_) { &ScheduleThis($interval, "randomQuote"); return if ($_[0] eq "2"); # defer. @@ -151,7 +151,7 @@ sub randomFactoid { my ($key,$val); my $error = 0; - my $interval = &getChanConfDefault("randomFactoidInterval", 60); + my $interval = &getChanConfDefault("randomFactoidInterval", 60, $chan); if (@_) { &ScheduleThis($interval, "randomFactoid"); return if ($_[0] eq "2"); # defer. @@ -259,7 +259,7 @@ sub seenFlushOld { return unless (&IsChanConf("seenFlushInterval") > 0); # global setting. does not make sense for per-channel. - my $max_time = &getChanConfDefault("seenMaxDays", 30) *60*60*24; + my $max_time = &getChanConfDefault("seenMaxDays", 30, $chan) *60*60*24; my $delete = 0; if ($param{'DBType'} =~ /^(pgsql|mysql|sqlite)/i) { @@ -369,7 +369,7 @@ sub newsFlush { } sub chanlimitCheck { - my $interval = &getChanConfDefault("chanlimitcheckInterval", 10); + my $interval = &getChanConfDefault("chanlimitcheckInterval", 10, $chan); my $mynick=$conn->nick(); if (@_) { @@ -523,7 +523,7 @@ sub floodLoop { } my $time = time(); - my $interval = &getChanConfDefault("floodCycle",60); + my $interval = &getChanConfDefault("floodCycle",60, $chan); foreach $who (keys %flood) { foreach (keys %{ $flood{$who} }) { @@ -543,7 +543,7 @@ sub floodLoop { sub seenFlush { if (@_) { - my $interval = &getChanConfDefault("seenFlushInterval", 60); + my $interval = &getChanConfDefault("seenFlushInterval", 60, $chan); &ScheduleThis($interval, "seenFlush"); return if ($_[0] eq "2"); } @@ -945,7 +945,7 @@ sub wingateCheck { &DEBUG("Already scanned $host. good."); } - my $interval = &getChanConfDefault('wingateInterval', 60); # seconds. + my $interval = &getChanConfDefault('wingateInterval', 60, $chan); # seconds. return if (defined $forked{'Wingate'}); return if (time() - $wingaterun <= $interval); return unless (scalar(keys %wingateToDo)); @@ -996,7 +996,7 @@ sub factoidCheck { } my @list = &searchTable("factoids", "factoid_key", "factoid_key", " #DEL#"); - my $stale = &getChanConfDefault("factoidDeleteDelay", 14) *60*60*24; + my $stale = &getChanConfDefault("factoidDeleteDelay", 14, $chan) *60*60*24; if ($stale < 1) { # disable it since it's "illegal". return; diff --git a/src/Misc.pl b/src/Misc.pl index 26af656..fc6f037 100644 --- a/src/Misc.pl +++ b/src/Misc.pl @@ -117,8 +117,8 @@ sub timedelta { sub formListReply { my($rand, $prefix, @list) = @_; my $total = scalar @list; - my $maxshow = &getChanConfDefault('maxListReplyCount', 15); - my $maxlen = &getChanConfDefault('maxListReplyLength', 400); + my $maxshow = &getChanConfDefault('maxListReplyCount', 15, $chan); + my $maxlen = &getChanConfDefault('maxListReplyLength', 400, $chan); my $reply; # remove irc overhead diff --git a/src/Modules/Debian.pl b/src/Modules/Debian.pl index bd60b66..f7e91c0 100644 --- a/src/Modules/Debian.pl +++ b/src/Modules/Debian.pl @@ -12,8 +12,7 @@ no strict 'refs'; # FIXME: dstats aborts if set my $announce = 0; my $defaultdist = 'sid'; -my $refresh = &::getChanConfDefault('debianRefreshInterval',7) - * 60 * 60 * 24; +my $refresh = &::getChanConfDefault('debianRefreshInterval', 7, $chan) * 60 * 60 * 24; my $debug = 0; my $debian_dir = $::bot_state_dir . 'debian'; my $country = 'us'; # well .config it yourself then. ;-) diff --git a/src/Modules/Factoids.pl b/src/Modules/Factoids.pl index bed96c5..9a2a859 100644 --- a/src/Modules/Factoids.pl +++ b/src/Modules/Factoids.pl @@ -738,7 +738,7 @@ sub CmdFactStats { sub CmdListAuth { my ($query) = @_; - my $maxshow = &::getChanConfDefault('maxListReplyCount', 15); + my $maxshow = &::getChanConfDefault('maxListReplyCount', 15, $chan); my @list = &searchTable("factoids","factoid_key", "created_by", "^$query!"); @list=grep(!/\#DEL\#$/,@list) if (scalar(@list) > $maxshow); diff --git a/src/Modules/News.pl b/src/Modules/News.pl index 1e84aac..c82b577 100644 --- a/src/Modules/News.pl +++ b/src/Modules/News.pl @@ -281,7 +281,7 @@ sub add { } $::news{$chan}{$str}{Time} = time(); - my $expire = &::getChanConfDefault("newsDefaultExpire",7); + my $expire = &::getChanConfDefault("newsDefaultExpire",7, $chan); $::news{$chan}{$str}{Expire} = time() + $expire*60*60*24; $::news{$chan}{$str}{Author} = $::who; # case! diff --git a/src/Modules/Search.pl b/src/Modules/Search.pl index 9f3ab77..4a9c082 100644 --- a/src/Modules/Search.pl +++ b/src/Modules/Search.pl @@ -13,7 +13,7 @@ sub Search { my ($type, $str) = @_; my $start_time = &::timeget(); my @list; - my $maxshow = &::getChanConfDefault('maxListReplyCount', 15); + my $maxshow = &::getChanConfDefault('maxListReplyCount', 15, $chan); $type =~ s/s$//; # nice work-around. diff --git a/src/core.pl b/src/core.pl index 309683d..ccb526b 100644 --- a/src/core.pl +++ b/src/core.pl @@ -339,7 +339,6 @@ sub getChanConf { sub getChanConfDefault { my($what, $default, $chan) = @_; - $chan ||= "_default"; if (exists $param{$what}) { @@ -454,12 +453,12 @@ sub setup { &checkTables(); &status("Setup: ". &countKeys("factoids") ." factoids."); - &getChanConfDefault("sendPrivateLimitLines", 3); - &getChanConfDefault("sendPrivateLimitBytes", 1000); - &getChanConfDefault("sendPublicLimitLines", 3); - &getChanConfDefault("sendPublicLimitBytes", 1000); - &getChanConfDefault("sendNoticeLimitLines", 3); - &getChanConfDefault("sendNoticeLimitBytes", 1000); + &getChanConfDefault("sendPrivateLimitLines", 3, $chan); + &getChanConfDefault("sendPrivateLimitBytes", 1000, $chan); + &getChanConfDefault("sendPublicLimitLines", 3, $chan); + &getChanConfDefault("sendPublicLimitBytes", 1000, $chan); + &getChanConfDefault("sendNoticeLimitLines", 3, $chan); + &getChanConfDefault("sendNoticeLimitBytes", 1000, $chan); $param{tempDir} =~ s#\~/#$ENV{HOME}/#;