]> git.donarmstrong.com Git - infobot.git/commitdiff
explicit $chan for getChanConfDefault
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 8 Mar 2005 22:47:22 +0000 (22:47 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 8 Mar 2005 22:47:22 +0000 (22:47 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1210 c11ca15a-4712-0410-83d8-924469b57eb5

src/Factoids/Core.pl
src/Factoids/Reply.pl
src/IRC/Irc.pl
src/IRC/Schedulers.pl
src/Misc.pl
src/Modules/Debian.pl
src/Modules/Factoids.pl
src/Modules/News.pl
src/Modules/Search.pl
src/core.pl

index c3fb474c32c5bedb0c053af1060a342cbca7501d..979db4b035e25b366690ad0f4fe92c7f9f1750d9 100644 (file)
@@ -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;
 
index 8c72ac1ba62b145a33f6a1d161d5f8d536d8582a..aedf3cbdb12eeb9c995b7dc694402e8ac1704b74 100644 (file)
@@ -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');
index 67de4ca34188d7a60e18c4e59e682e590c09344f..0afd7d7690aafed8f93e3684173a3fe3049c63ff 100644 (file)
@@ -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;
index 963cad63d59ac9159bd20918664c4d8cef9288ad..8a9700c122962e16be452ce6646e4765605d4038 100644 (file)
@@ -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;
index 26af656c07faef3ccbb51ad3e3144348c2cde3c1..fc6f037418788d7cbb34c1388df9e66fd25b78d1 100644 (file)
@@ -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
index bd60b6691054ecd1f4ef4ea00b7849247919fb6a..f7e91c067f196414d2c8dccee3446f4206859926 100644 (file)
@@ -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. ;-)
index bed96c57af512c59e411d2a3057ceef1c41edb56..9a2a8592bbce4c4a59b9bb4713fcdf80d547e5ef 100644 (file)
@@ -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);
 
index 1e84aac50f682908e1b1d53f75aed7ce2a52f7a8..c82b5772730d04daad16574ef74dd6338ac74849 100644 (file)
@@ -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!
 
index 9f3ab772c71ce65dcabca7b0f5d35a21a52fa34d..4a9c0829274a4550a959caa007e04ce1084d08f6 100644 (file)
@@ -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.
 
index 309683d393de1e50b1df898c798d194c78e02235..ccb526b74ddc78089bc7f5121bb5dd3b7ea8242b 100644 (file)
@@ -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}/#;