]> git.donarmstrong.com Git - infobot.git/commitdiff
- updates to DEBUG/WARN/ERROR or the result of looking at them
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 12 Dec 2001 14:51:58 +0000 (14:51 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 12 Dec 2001 14:51:58 +0000 (14:51 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@531 c11ca15a-4712-0410-83d8-924469b57eb5

src/CommandStubs.pl
src/DynaConfig.pl
src/Factoids/Update.pl
src/IRC/Irc.pl
src/IRC/IrcHooks.pl
src/IRC/Schedulers.pl
src/Modules/Debian.pl
src/Modules/News.pl
src/Modules/Topic.pl
src/UserExtra.pl
src/modules.pl

index 96713d6062d50e413c03cc3194cb5c31ea1f2b54..e3586e01cddd7700ce3d892d8747e71f2af4374a 100644 (file)
@@ -73,7 +73,7 @@ sub parseCmdHook {
        }
 
        if ($hash{NoArgs} and $flatarg) {
-           &DEBUG("cmd $ident does not take args; skipping.");
+           &DEBUG("cmd $ident does not take args ('$flatarg'); skipping.");
            next;
        }
 
@@ -317,7 +317,7 @@ sub Modules {
                    }
                }
                my $topstr = "";
-               &DEBUG("tp => $tp");
+               &DEBUG("*stats: tp => $tp");
                if (scalar @top) {
                    $topstr = ".  Top ".scalar(@top).": ".join(', ', @top);
                }
@@ -881,7 +881,7 @@ sub textstats_main {
        }
 
        my $topstr = "";
-       &DEBUG("tp => $tp");
+       &DEBUG("*stats: tp => $tp");
        if (scalar @top) {
            $topstr = ".  Top ".scalar(@top).": ".join(', ', @top);
        }
index d90f6fafd8f7be28cda8f7ea80a4164bf62ea491..b76e7579763d94f8bbf519822a8c75ccf0ea4e97 100644 (file)
@@ -63,7 +63,7 @@ sub readUserFile {
            }
 
            if (!defined $nick) {
-               &WARN("invalid line: $_");
+               &WARN("DynaConfig: invalid line: $_");
                next;
            }
 
index 3030bef94d2095fcf328e293d6001b850b63e307..d0b57d13968f3587698b74dd67e093cacbfe1ba7 100644 (file)
@@ -138,7 +138,7 @@ sub update {
 
     if ($also) {                       # 'is also'.
        if ($exists =~ /^<REPLY> see /i) {
-           &DEBUG("todo: append to linked factoid.");
+           &DEBUG("Update.pl: todo: append to linked factoid.");
        }
 
        if ($also_or) {                 # 'is also ||'.
index 46bb68a3ce023fa28adca6829f1f29500fc0702b..e8a3a9243534cac1ebd6f15533103f43df038286 100644 (file)
@@ -654,7 +654,7 @@ sub joinNextChan {
        my $rate        = sprintf("%.1f", $delta / @c);
        delete $cache{joinTime};
 
-       &DEBUG("time taken to join all chans: $timestr; rate: $rate sec/join");
+       &status("time taken to join all chans: $timestr; rate: $rate sec/join");
     }
 
     # chanserv check: global channels, in case we missed one.
index 9c0dcdc7639393a40c943ad869db37d5977cab61..2d03d0cb534829a3bc4dbf54d17fc162c70e2759 100644 (file)
@@ -616,6 +616,7 @@ sub on_msg {
     $uh                = $event->userhost();
     $nuh       = $nick."!".$uh;
     $msgtime   = time();
+    $h         = $host;
 
     if ($nick eq $ident) { # hopefully ourselves.
        if ($msg eq "TEST") {
@@ -795,8 +796,14 @@ sub on_ping {
 
 sub on_ping_reply {
     my ($self, $event) = @_;
-    my $nick = $event->nick;
-    my $lag = time() - ($event->args)[1];
+    my $nick   = $event->nick;
+    my $t      = ($event->args)[1];
+    if (!defined $t) {
+       &WARN("on_ping_reply: t == undefined.");
+       return;
+    }
+
+    my $lag = time() - $t;
 
     &status(">>> ${b_green}CTCP PING$ob reply from $b_cyan$nick$ob: $lag sec.");
 }
@@ -812,6 +819,7 @@ sub on_public {
     $msgType   = "public";
     # todo: move this out of hookMsg to here?
     ($user,$host) = split(/\@/, $uh);
+    $h         = $host;
 
     # rare case should this happen - catch it just in case.
     if ($bot_pid != $$) {
index 66ab136f2e9fbfa3faeec1b19fe4672f9a0bc6bf..b2dd6f9ab51c6730671ca3181eede12c42f7e4b7 100644 (file)
@@ -440,7 +440,7 @@ sub netsplitCheck {
     }
 
     $cache{'netsplitCache'}++;
-    &DEBUG("running netsplitCheck... $cache{netsplitCache}");
+#    &DEBUG("running netsplitCheck... $cache{netsplitCache}");
 
     if (!scalar %netsplit and scalar %netsplitservers) {
        &DEBUG("nsC: !hash netsplit but hash netsplitservers <- removing!");
@@ -493,7 +493,7 @@ sub netsplitCheck {
 
     if ($delete) {
        my $j = scalar(keys %netsplit);
-       &DEBUG("nsC: removed from netsplit list: (before: $count; after: $j)");
+       &status("nsC: removed from netsplit list: (before: $count; after: $j)");
     }
 
     if (!scalar %netsplit and scalar %netsplitservers) {
@@ -642,7 +642,7 @@ sub leakCheck {
            $count += scalar(keys %{ $flood{$blah1}{$blah2} });
        }
     }
-    &DEBUG("leak: hash flood has $count total keys.",2);
+    &VERB("leak: hash flood has $count total keys.",2);
 
     # floodjoin.
     $count = 0;
@@ -651,11 +651,11 @@ sub leakCheck {
            $count += scalar(keys %{ $floodjoin{$blah1}{$blah2} });
        }
     }
-    &DEBUG("leak: hash floodjoin has $count total keys.",2);
+    &VERB("leak: hash floodjoin has $count total keys.",2);
 
     # floodwarn.
     $count = scalar(keys %floodwarn);
-    &DEBUG("leak: hash floodwarn has $count total keys.",2);
+    &VERB("leak: hash floodwarn has $count total keys.",2);
 
     my $chan;
     foreach $chan (grep /[A-Z]/, keys %channels) {
@@ -670,7 +670,7 @@ sub leakCheck {
 
     # chanstats
     $count = scalar(keys %chanstats);
-    &DEBUG("leak: hash chanstats has $count total keys.",2);
+    &VERB("leak: hash chanstats has $count total keys.",2);
 
     # nuh.
     my $delete = 0;
index 27f558928111b891a50c55771d6bbc8929ed36b6..0538c9d72b43310aaca79e4aa86d84012d795993 100644 (file)
@@ -390,7 +390,7 @@ sub searchAuthor {
            $package = "";
 
        } else {
-           &::WARN("invalid line: '$_'.");
+           &::WARN("debian: invalid line: '$_' (1).");
        }
     }
     close IN;
@@ -497,7 +497,7 @@ sub searchDesc {
            $desc{$package} = $desc;
            $package = "";
        } else {
-           &::WARN("invalid line: '$_'.");
+           &::WARN("debian: invalid line: '$_'. (2)");
        }
     }
     close IN;
@@ -870,7 +870,7 @@ sub generateIndex {
            system("cp $idx $idx-old");
        }
 
-       &::DEBUG("deb: gIndex: calling DebianDownload($dist, ...).");
+       &::DEBUG("deb: gIndex: calling DebianDownload($dist, ...).") if ($debug);
        &DebianDownload($dist, &fixDist($dist, %urlpackages) );
 
        &::status("Debian: generating index for '$dist'.");
@@ -1129,7 +1129,7 @@ sub checkEval {
 }
 
 sub searchDescFE {
-    &::DEBUG("deb: FE called for searchDesc");
+#    &::DEBUG("deb: FE called for searchDesc");
     my ($query)        = @_;
     my @list = &searchDesc($query);
 
index 2942f851348b5e57a15e7b5d8127efcb1a3ee7d6..c9a8fddbdc64bda9033ac5b669a6403f6dc4c875 100644 (file)
@@ -396,8 +396,8 @@ sub list {
     &::msg($who, "|= Last updated $timestr ago.");
     &::msg($who, " \037Num\037  \037Item ".(" "x40)." \037");
 
-    &DEBUG("list: expire = $expire");
-    &::DEBUG("list: eno    = $eno");
+#    &::DEBUG("news: list: expire = $expire");
+#    &::DEBUG("news: list: eno    = $eno");
 
     my $i = 1;
     foreach ( &getNewsAll() ) {
@@ -570,12 +570,15 @@ sub set {
     my($args) = @_;
     my($item, $what, $value);
 
+    if (!defined $args) {
+       &::DEBUG("news: set: args == NULL.");
+       return;
+    }
+
     $item = $1 if ($args =~ s/^(\S+)\s*//);
     $what = $1 if ($args =~ s/^(\S+)\s*//);
     $value = $args;
 
-    &::DEBUG("news: set called.");
-
     if ($item eq "") {
        &::help("news set");
        return;
@@ -672,7 +675,7 @@ sub set {
     }
 
     my $auth = 0;
-    &::DEBUG("news: who => '$who'");
+#    &::DEBUG("news: who => '$who'");
     my $author = $::news{$chan}{$news}{Author};
     $auth++ if ($::who eq $author);
     $auth++ if (&::IsFlag("o"));
@@ -916,7 +919,7 @@ sub getNewsItem {
        }
 
        if (@items) {
-           &::DEBUG("news: gNI: part_string->full_string: $what->$items[0]");
+#          &::DEBUG("news: gNI: part_string->full_string: $what->$items[0]");
            return $items[0];
        } else {
            &::DEBUG("news: gNI: No match for '$what'");
@@ -924,7 +927,7 @@ sub getNewsItem {
        }
     }
 
-    &::ERROR("getNewsItem: Should not happen (what = $what)");
+    &::ERROR("news: gNI: should not happen (what = $what)");
     return;
 }
 
index 60e5c3b0f3594145a5423a24811d14ec17e829f8..c0d9d95c879abd62284936ae3aa6781389dd857a 100644 (file)
@@ -55,7 +55,7 @@ sub topicDecipher {
 # Usage: &topicCipher(@topics);
 sub topicCipher {
   if (!@_) {
-    &DEBUG("topicCipher: topic is NULL.");
+    &WARN("topicCipher: topic is NULL for $chan.");
     return;
   }
 
@@ -390,7 +390,7 @@ sub Topic {
 
        undef @subtopics;                       # lets reuse this array.
        foreach (@newtopics) {
-         next if ($_ eq "");
+         next if (!defined $_ or $_ eq "");
          push(@subtopics, $_);
        }
 
index 49124799e2198357b6867449391e81ceab1c12bd..23b287394c8e260a79a77333d52f9725d8b87f5b 100644 (file)
@@ -161,7 +161,7 @@ sub chaninfo {
     }
 
     # todo: show top 3 with percentages?
-    my($count) = (sort { $a <=> $b } keys %new)[0];
+    my($count) = (sort { $new{$a} <=> $new{$b} } keys %new)[0];
     if ($count) {
        $reply .= ".  \002$count\002 has said the most with a total of \002$new{$count}\002 messages";
     }
@@ -263,6 +263,9 @@ sub ispell {
        } elsif (/^\+/) {
            &DEBUG("spell: '+' found => '$_'.");
            last;
+       } elsif (/^# (.*?) 0$/) {
+           # none found.
+           last;
        } else {
            &DEBUG("spell: unknown: '$_'.");
        }
@@ -393,6 +396,11 @@ sub DNS {
     my $pid;
     $dns =~ s/^\s+|\s+$//g;
 
+    if (!defined $dns or $dns =~ /^\s*$/ or $dns =~ / /) {
+       &help("dns");
+       return;
+    }
+
     if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) {
        $match = $1;
        &status("DNS query by IP address: $match");
@@ -803,7 +811,10 @@ sub userCommands {
                        " ORDER BY counter DESC", 1);
 
        foreach (keys %hash) {
-           &DEBUG("cmdstats: hash{$_} => $hash{$_}");
+           my $i = $_;
+           foreach (keys %{ $hash{$i} }) {
+               &DEBUG("cmdstats: $hash{$i}{$_} = $_");
+           }
        }
        &DEBUG("end of cmdstats.");
 
index 224db3ac1f30e973673a8ae86a93427b9c856ddd..43d623e0d0cfd0b7c50df47369b98d58f7fab22c 100644 (file)
@@ -362,7 +362,7 @@ if ($@) {
 &showProc(" (Time::HiRes)");
 
 sub AUTOLOAD {
-    if (defined $::AUTOLOAD) {
+    if (!defined $AUTOLOAD and defined $::AUTOLOAD) {
        &DEBUG("AUTOLOAD: hrm.. ::AUTOLOAD defined!");
     }
     return unless (defined $AUTOLOAD);