From: dms Date: Sat, 3 May 2003 11:42:02 +0000 (+0000) Subject: - don't list _default in chanstats X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;ds=sidebyside;h=f3a7f67d07f3a8511e269ce55da6dc7d0c2087e6;p=infobot.git - don't list _default in chanstats - 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 --- diff --git a/src/Factoids/Reply.pl b/src/Factoids/Reply.pl index 55d02a0..14bc574 100644 --- a/src/Factoids/Reply.pl +++ b/src/Factoids/Reply.pl @@ -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; } diff --git a/src/IRC/Irc.pl b/src/IRC/Irc.pl index 0aeacc7..a82aa7f 100644 --- a/src/IRC/Irc.pl +++ b/src/IRC/Irc.pl @@ -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; diff --git a/src/IRC/IrcHooks.pl b/src/IRC/IrcHooks.pl index e8eb962..bc2ee65 100644 --- a/src/IRC/IrcHooks.pl +++ b/src/IRC/IrcHooks.pl @@ -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); } diff --git a/src/Modules/News.pl b/src/Modules/News.pl index 3df9f42..930175a 100644 --- a/src/Modules/News.pl +++ b/src/Modules/News.pl @@ -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; } diff --git a/src/Modules/UserDCC.pl b/src/Modules/UserDCC.pl index 39bf575..f8ac484 100644 --- a/src/Modules/UserDCC.pl +++ b/src/Modules/UserDCC.pl @@ -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"; diff --git a/src/UserExtra.pl b/src/UserExtra.pl index 1511649..cfd15aa 100644 --- a/src/UserExtra.pl +++ b/src/UserExtra.pl @@ -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..."); } diff --git a/src/dbi.pl b/src/dbi.pl index 0166880..f9f7319 100644 --- a/src/dbi.pl +++ b/src/dbi.pl @@ -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 () { chop;