]> git.donarmstrong.com Git - infobot.git/commitdiff
fix chanlimitChange time
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 18 Apr 2001 14:30:54 +0000 (14:30 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 18 Apr 2001 14:30:54 +0000 (14:30 +0000)
w3search => "blah for blah" fails - fixed.

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@447 c11ca15a-4712-0410-83d8-924469b57eb5

src/IRC/IrcHelpers.pl
src/IRC/Schedulers.pl
src/Modules/W3Search.pl
src/core.pl

index b2b33d1779e043bd219cd446d062697c7316182e..56811b701f73b35cdcc270b7eb2f2a5842aa2417 100644 (file)
@@ -258,6 +258,7 @@ sub chanLimitVerify {
     if (defined $l and &IsChanConf("chanlimitcheck")) {
        my $plus  = &getChanConfDefault("chanlimitcheckPlus", 5, $chan);
        my $count = scalar(keys %{ $channels{$chan}{''} });
+       my $int   = &getChanConfDefault("chanlimitcheckInterval", 10, $chan);
 
        my $delta = $count + $plus - $l;
        $delta    =~ s/^\-//;
@@ -267,11 +268,9 @@ sub chanLimitVerify {
        }
 
        if (exists $cache{ "chanlimitChange_$chan" }) {
-           if (time() - $cache{ "chanlimitChange_$chan" } < 60) {
-               &DEBUG("not going to change chanlimit!");
+           if (time() - $cache{ "chanlimitChange_$chan" } < $int*60) {
                return;
            }
-           delete $cache{ "chanlimitChange_$chan" };
        }
 
        ### todo: check if we have ops.
@@ -280,6 +279,7 @@ sub chanLimitVerify {
        if ($delta > 5) {
            &status("clc: big change in limit; changing.");
            &rawout("MODE $chan +l ".($count+$plus) );
+           $cache{ "chanlimitChange_$chan" } = time();
        }
     }
 }
index c8d663ca0fe465fd42496062f8fedb14d9a5fe2d..59ca412860dd112fd2912d031ef0866954f1704b 100644 (file)
@@ -379,11 +379,11 @@ sub chanlimitCheck {
        }
 
        if (exists $cache{ "chanlimitChange_$chan" }) {
-           if (time() - $cache{ "chanlimitChange_$chan" } < 60) {
-               &DEBUG("not going to change chanlimit!");
+           my $delta = time() - $cache{ "chanlimitChange_$chan" };
+           if ($delta < $interval*60) {
+               &DEBUG("not going to change chanlimit! ($delta<$interval*60)");
                return;
            }
-           delete $cache{ "chanlimitChange_$chan" };
        }
 
        &rawout("MODE $chan +l $newlimit");
@@ -662,7 +662,7 @@ sub ircCheck {
        &rawout("PRIVMSG ChanServ :OP $chan $ident");
     }
 
-    if (!$conn->connected or time - $msgtime > 3600) {
+    if (!$conn->connected or time() - $msgtime > 3600) {
        # todo: shouldn't we use cache{connect} somewhere?
        if (exists $cache{connect}) {
            &WARN("ircCheck: no msg for 3600 and disco'd! reconnecting!");
@@ -704,6 +704,10 @@ sub ircCheck {
        &DEBUG("channels END");
     }
 
+    &DEBUG("ircstats...");
+    &DEBUG("  pubsleep: $pubsleep");
+    &DEBUG("  msgsleep: $msgsleep");
+
     ### USER FILE.
     if ($utime_userfile > $wtime_userfile and time() - $wtime_userfile > 3600) {
        &writeUserFile();
index 8f216b808aee93796022f0aac91b8b7c25eb5da3..9bbe78c2412146f9ea267e6c0c26ab5f64b230a4 100644 (file)
@@ -16,19 +16,16 @@ sub W3Search {
     my ($where, $what, $type) = @_;
     my $retval = "$where can't find \002$what\002";
 
-    return unless &::loadPerlModule("WWW::Search");
-
-    if (defined $type) {
-       &::DEBUG("W3S: type => $type");
-    }
-
     my @matches = grep { lc($_) eq lc($where) ? $_ : undef } @W3Search_engines;
     if (@matches) {
        $where = shift @matches;
     } else {
        &::msg($::who, "i don't know how to check '$where'");
+       return;
     }
 
+    return unless &::loadPerlModule("WWW::Search");
+
     my $Search = new WWW::Search($where);
     my $Query  = WWW::Search::escape_query($what);
     $Search->native_query($Query,
index a2e7478c47727a13343178430d1bf6c5bea0e4e0..48fe3cf1900502776ad4ebf5330a7523923d9ea1 100644 (file)
@@ -19,8 +19,8 @@ use vars qw(
        $flag_quit $msgType
        $utime_userfile $wtime_userfile $ucount_userfile
        $utime_chanfile $wtime_chanfile $ucount_chanfile
-       $pubsize $pubcount $pubtime
-       $msgsize $msgcount $msgtime
+       $pubsize $pubcount $pubtime $pubsleep
+       $msgsize $msgcount $msgtime $msgsleep
 );
 
 # dynamic hash.
@@ -56,12 +56,12 @@ $utime_chanfile     = 0;
 $wtime_chanfile        = 0;
 $ucount_chanfile = 0;
 ### more variables...
-$msgtime       = 0;
+$msgtime       = time();
 $msgsize       = 0;
-$msgcount      = 0;
+$msgcount      = $msgsleep     = 0;
 $pubtime       = 0;
 $pubsize       = 0;
-$pubcount      = 0;
+$pubcount      = $pubsleep     = 0;
 ###
 $bot_version   = "blootbot cvs (20010214) -- $^O";
 $noreply       = "NOREPLY";