]> git.donarmstrong.com Git - infobot.git/blobdiff - src/UserExtra.pl
- Manually applied patch from Morten Brix Pedersen. Thanks.
[infobot.git] / src / UserExtra.pl
index 49124799e2198357b6867449391e81ceab1c12bd..77f4480fdac2565732adeb6ee83ebf2bd0c4067b 100644 (file)
@@ -5,8 +5,7 @@
 #      Created: 20000107
 #
 
-if (&IsParam("useStrict")) { use strict; }
-
+#use strict;
 use vars qw($message $arg $qWord $verb $lobotomized);
 use vars qw(%channels %chanstats %cmdstats);
 
@@ -161,7 +160,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 +262,9 @@ sub ispell {
        } elsif (/^\+/) {
            &DEBUG("spell: '+' found => '$_'.");
            last;
+       } elsif (/^# (.*?) 0$/) {
+           # none found.
+           last;
        } else {
            &DEBUG("spell: unknown: '$_'.");
        }
@@ -393,6 +395,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 +810,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.");