]> git.donarmstrong.com Git - infobot.git/blobdiff - src/UserExtra.pl
re-order as ircCheck changes our nick
[infobot.git] / src / UserExtra.pl
index 9d27eb9d5e52280399af1d0cbef20b0f99d8c4e5..d5ac5dcfaf0470882bc552ca33ab1275957d5886 100644 (file)
@@ -47,7 +47,7 @@ sub chaninfo {
 
     if ($chan eq "") {         # all channels.
        my $i           = keys %channels;
-       my $reply       = "i am on \002$i\002 ".&fixPlural("channel",$i);
+       my $reply       = "I'm on \002$i\002 ".&fixPlural("channel",$i);
        my $tucount     = 0;    # total user count.
        my $uucount     = 0;    # unique user count.
        my @array;
@@ -61,11 +61,10 @@ sub chaninfo {
            }
            next if (/^_default$/);
 
-           my $str = sprintf("%s (%d)", $_, scalar(keys %{ $channels{$_}{''} }));
+           my $str = sprintf("%s/%d", $_, scalar(keys %{ $channels{$_}{''} }));
            push(@array, $str);
        }
-       &pSReply($reply.": ".join(', ', @array));
-       &ircCheck();
+       &performStrictReply($reply.": ".join(', ', @array));
 
        ### total user count.
        foreach $chan (keys %channels) {
@@ -75,24 +74,27 @@ sub chaninfo {
        ### unique user count.
        my @nicks;
        foreach $chan (keys %channels) {
-           foreach (keys %{ $channels{$chan}{''} }) {
-               next if (grep /^\Q$_\E$/, @nicks);
+           my $nick = '';
+           foreach $nick (keys %{ $channels{$chan}{''} }) {
+               next if (grep /^\Q$nick\E$/, @nicks);
                $uucount++;
-               push(@nicks, $_);
+               push(@nicks, $nick);
            }
        }
+       #&::DEBUG(join ":", @nicks);
 
        if (scalar @nicks != $uucount) {
            &DEBUG("nicks != uucount...");
        }
 
        my $chans = scalar(keys %channels);
-       &pSReply(
+       &performStrictReply(
            "i've cached \002$tucount\002 ". &fixPlural("user",$tucount).
            ", \002$uucount\002 unique ". &fixPlural("user",$uucount).
            ", distributed over \002$chans\002 ".
            &fixPlural("channel", $chans)."."
        );
+       &ircCheck();
 
        return;
     }
@@ -166,7 +168,7 @@ sub chaninfo {
     if ($count) {
        $reply .= ".  \002$count\002 has said the most with a total of \002$new{$count}\002 messages";
     }
-    &pSReply("$reply.");
+    &performStrictReply("$reply.");
 }
 
 # Command statistics.
@@ -191,7 +193,7 @@ sub cmdstats {
            push(@array, "\002$int\002 of $_");
        }
     }
-    &pSReply("command usage include ". &IJoin(@array).".");
+    &performStrictReply("command usage include ". &IJoin(@array).".");
 }
 
 # Factoid extension info. xk++
@@ -215,7 +217,7 @@ sub factstats {
     my $type = shift(@_);
 
     &Forker("factoids", sub {
-       &pSReply( &CmdFactStats($type) );
+       &performStrictReply( &CmdFactStats($type) );
     } );
 }
 
@@ -225,9 +227,9 @@ sub karma {
        { nick => $target, type => "karma" }) || 0;
 
     if ($karma != 0) {
-       &pSReply("$target has karma of $karma");
+       &performStrictReply("$target has karma of $karma");
     } else {
-       &pSReply("$target has neutral karma");
+       &performStrictReply("$target has neutral karma");
     }
 }
 
@@ -394,9 +396,9 @@ sub do_countrystats {
        push(@list, "$str ($_, $perc %)");
     }
 
-    # TODO: move this into a scheduler like nickometer
+    # TODO: move this into a scheduler
     $msgType   = "private";
-    &pSReply( &formListReply(0, "Country Stats ", @list) );
+    &performStrictReply( &formListReply(0, "Country Stats ", @list) );
 
     delete $cache{countryStats};
     delete $cache{on_who_Hack};
@@ -410,7 +412,7 @@ sub userCommands {
     # conversion: ascii.
     if ($message =~ /^(asci*|chr) (\d+)$/) {
        &DEBUG("ascii/chr called ...");
-       return unless (&hasParam("allowConv"));
+       return unless (&IsChanConfOrWarn("allowConv"));
 
        &DEBUG("ascii/chr called");
 
@@ -425,7 +427,7 @@ sub userCommands {
 
     # conversion: ord.
     if ($message =~ /^ord(\s+(.*))$/) {
-       return unless (&hasParam("allowConv"));
+       return unless (&IsChanConfOrWarn("allowConv"));
 
        $arg = $2;
 
@@ -449,7 +451,7 @@ sub userCommands {
 
     # hex.
     if ($message =~ /^hex(\s+(.*))?$/i) {
-       return unless (&hasParam("allowConv"));
+       return unless (&IsChanConfOrWarn("allowConv"));
        my $arg = $2;
 
        if (!defined $arg) {
@@ -467,7 +469,7 @@ sub userCommands {
            $retval .= sprintf(" %X", ord($_));
        }
 
-       &pSReply("$arg is$retval");
+       &performStrictReply("$arg is$retval");
 
        return;
     }
@@ -488,9 +490,9 @@ sub userCommands {
 #              return;
 #          }
 
-           &pSReply( crypt($args[1], $args[0]) );
+           &performStrictReply( crypt($args[1], $args[0]) );
        } else {
-           &pSReply( &mkcrypt($args[0]) );
+           &performStrictReply( &mkcrypt($args[0]) );
        }
 
        return;
@@ -530,9 +532,9 @@ sub userCommands {
        return unless (&hasFlag("n"));
 
        &status("USER reload $who");
-       &pSReply("reloading...");
+       &performStrictReply("reloading...");
        my $modules = &reloadAllModules();
-       &pSReply("reloaded:$modules");
+       &performStrictReply("reloaded:$modules");
        return;
     }
 
@@ -598,7 +600,7 @@ sub userCommands {
        }
 
        $reply =~ y/A-Za-z/N-ZA-Mn-za-m/;
-       &pSReply($reply);
+       &performStrictReply($reply);
 
        return;
     }
@@ -644,7 +646,7 @@ sub userCommands {
        }
        $ratio  = sprintf("%.01f", 100*$perc/($perc+$perc2) );
 
-       &pSReply("Total CPU usage: \002$cpu_usage\002 s ... ".
+       &performStrictReply("Total CPU usage: \002$cpu_usage\002 s ... ".
                "Total used: \002$total\002 % ".
                "(parent/child ratio: $ratio %)"
        );
@@ -695,7 +697,7 @@ sub userCommands {
            $reply .= ".  I was last disconnected for '$reason'.";
        }
 
-       &pSReply($reply);
+       &performStrictReply($reply);
 
        return;
     }
@@ -716,7 +718,7 @@ sub userCommands {
            $count{'Commands'} += $cmdstats{$_};
        }
 
-       &pSReply(
+       &performStrictReply(
        "Since $startString, there have been".
          " \002$count{'Update'}\002 ".
                &fixPlural("modification", $count{'Update'}).