]> git.donarmstrong.com Git - infobot.git/commitdiff
- don't list _default in chanstats
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 3 May 2003 11:42:02 +0000 (11:42 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 3 May 2003 11:42:02 +0000 (11:42 +0000)
- remove DEBUG messages here and there.
- catch "" in IsNickInChan()
- added comma in chanstats list

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

src/Factoids/Reply.pl
src/IRC/Irc.pl
src/IRC/IrcHooks.pl
src/Modules/News.pl
src/Modules/UserDCC.pl
src/UserExtra.pl
src/dbi.pl

index 55d02a07ac8a83e8f965d71259cfd801fc97961b..14bc57457e88cdc2e5441f3bae18bf26bab9b27e 100644 (file)
@@ -152,10 +152,7 @@ sub smart_replace {
     foreach (split //, $string) {
 
        if ($_ eq "(") {
-###        print "( l=>$l, r=>$r\n";
-
            if (!$l and !$r) {
-#              print "STARTING at $i\n";
                $s = $i;
                $t = $i;
            }
@@ -165,25 +162,21 @@ sub smart_replace {
        }
 
        if ($_ eq ")") {
-###        print ") l=>$l, r=>$r\n";
-
            $r++;
            $l--;
 
            if (!$l and !$r) {
                my $substr = substr($old,$s,$i-$s+1);
-#              print "STOP at $i $substr\n";
                push(@rand, substr($old,$t+1,$i-$t-1) );
 
                my $rand = $rand[rand @rand];
-               &status("SARing '$substr' to '$rand'.");
+#              &status("SARing '$substr' to '$rand'.");
                $string =~ s/\Q$substr\E/$rand/;
                undef @rand;
            }
        }
 
        if ($_ eq "|" and $l+$r== 0 and $l==1) {
-#          print "| at $i (l=>$l,r=>$r)\n";
            push(@rand, substr($old,$t+1,$i-$t-1) );
            $t = $i;
        }
index 0aeacc7f465435722815d7048bd3f2d63f0e63c9..a82aa7f9c2be09ac1a2a6128b2b57920a323d510 100644 (file)
@@ -348,6 +348,12 @@ sub DCCBroadcast {
 # Usage: &performReply($reply);
 sub performReply {
     my ($reply) = @_;
+
+    if (!defined $reply or $reply =~ /^\s*$/) {
+       &DEBUG("performReply: reply == NULL.");
+       return;
+    }
+
     $reply =~ /([\.\?\s]+)$/;
 
     &checkMsgType($reply);
@@ -359,19 +365,20 @@ sub performReply {
            $reply = "$reply, ".$orig{who};
        }
        &say($reply);
+
     } elsif ($msgType eq 'private') {
-       if (rand() < 0.5) {
-           $reply = $reply;
-       } else {
+       if (rand() > 0.5) {
            $reply = "$reply, ".$orig{who};
        }
        &msg($who, $reply);
+
     } elsif ($msgType eq 'chat') {
        if (!exists $dcc{'CHAT'}{$who}) {
            &VERB("pSR: dcc{'CHAT'}{$who} does not exist.",2);
            return;
        }
        $conn->privmsg($dcc{'CHAT'}{$who}, $reply);
+
     } else {
        &ERROR("PR: msgType invalid? ($msgType).");
     }
@@ -699,6 +706,11 @@ sub IsNickInChan {
 
     $chan =~ tr/A-Z/a-z/;      # not lowercase unfortunately.
 
+    if ($chan =~ /^$/) {
+       &DEBUG("INIC: chan == NULL.");
+       return 0;
+    }
+
     if (&validChan($chan) == 0) {
        &ERROR("INIC: invalid channel $chan.");
        return 0;
index e8eb96280c3968aa234c27d902bf7e2ab3f9e242..bc2ee65c9bcd37bf166163a1c0d89c4562ce0af9 100644 (file)
@@ -807,7 +807,6 @@ sub on_part {
     $chanstats{$chan}{'Part'}++;
     &delUserInfo($nick,$chan);
     if ($nick eq $ident) {
-       &DEBUG("on_part: ok, I left $chan... clearChanVars...");
        &clearChanVars($chan);
     }
 
index 3df9f42d1ce4b98dd7dbeb1da6d5156fe9de5fc8..930175aa736bc9b5ea261db1181fcfa4ae93c97d 100644 (file)
@@ -367,7 +367,7 @@ sub del {
 
 sub list {
     if (!scalar keys %{ $::news{$chan} }) {
-       &::notice($who, "No News for \002$chan\002.");
+       &::notice($who, "No news for \002$chan\002.");
        return;
     }
 
@@ -446,7 +446,7 @@ sub read {
     }
 
     if (!scalar keys %{ $::news{$chan} }) {
-       &::notice($who, "No News for \002$chan\002.");
+       &::notice($who, "No news for \002$chan\002.");
        return;
     }
 
@@ -758,8 +758,7 @@ sub latest {
 
     if (!defined $t) {
 #      &::msg($who, "News is disabled for $chan");
-       &::DEBUG("news: something went really wrong.");
-       &::DEBUG("news: chan => $chan.");
+       &::DEBUG("news: $chan: something went really wrong.");
        return;
     }
 
index 39bf57501d094b253d3d464ae22ef1e77ba8e5ca..f8ac484c71aa17d53cfed8c863ad205bfa43ba9f 100644 (file)
@@ -616,7 +616,6 @@ sub userDCC {
        if ($args =~ s/^(\-)?($mask{chan})\s*//) {
            $chan       = $2;
            $delete     = ($1) ? 1 : 0;
-           &DEBUG("chan => $chan.");
        } else {
            &VERB("no chan arg; setting to default.",2);
            $chan       = "_default";
index 1511649a078cbeb92753ac50103395a546f83381..cfd15aa1f509ae1c116f247e9e64dece494e91b3 100644 (file)
@@ -63,9 +63,12 @@ sub chaninfo {
                &ircCheck();
                next;
            }
-           push(@array, "$_ (".scalar(keys %{ $channels{$_}{''} }).")");
+           next if (/^_default$/);
+
+           my $str = sprintf("%s (%d)", $_, scalar(keys %{ $channels{$_}{''} }));
+           push(@array, $str);
        }
-       &pSReply($reply.": ".join(' ', @array));
+       &pSReply($reply.": ".join(', ', @array));
 
        ### total user count.
        foreach $chan (keys %channels) {
@@ -81,7 +84,7 @@ sub chaninfo {
                push(@nicks, $_);
            }
        }
-       &DEBUG("nicks => '".scalar(@nicks)."'...");
+
        if (scalar @nicks != $uucount) {
            &DEBUG("nicks != uucount...");
        }
index 016688003a90bc47eac0807f1586073ebb09b4be..f9f731930b5b39d9db54e997fe69506be77895f4 100644 (file)
@@ -587,11 +587,8 @@ sub sqlCreateTable {
 
     foreach (@path) {
        my $file = "$_/setup/$table.sql";
-       &DEBUG("dbCT: table => '$table', file => '$file'");
        next unless ( -f $file );
 
-       &DEBUG("dbCT: found!!!");
-
        open(IN, $file);
        while (<IN>) {
            chop;