foreach (split //, $string) {
if ($_ eq "(") {
-### print "( l=>$l, r=>$r\n";
-
if (!$l and !$r) {
-# print "STARTING at $i\n";
$s = $i;
$t = $i;
}
}
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;
}
# Usage: &performReply($reply);
sub performReply {
my ($reply) = @_;
+
+ if (!defined $reply or $reply =~ /^\s*$/) {
+ &DEBUG("performReply: reply == NULL.");
+ return;
+ }
+
$reply =~ /([\.\?\s]+)$/;
&checkMsgType($reply);
$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).");
}
$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;
$chanstats{$chan}{'Part'}++;
&delUserInfo($nick,$chan);
if ($nick eq $ident) {
- &DEBUG("on_part: ok, I left $chan... clearChanVars...");
&clearChanVars($chan);
}
sub list {
if (!scalar keys %{ $::news{$chan} }) {
- &::notice($who, "No News for \002$chan\002.");
+ &::notice($who, "No news for \002$chan\002.");
return;
}
}
if (!scalar keys %{ $::news{$chan} }) {
- &::notice($who, "No News for \002$chan\002.");
+ &::notice($who, "No news for \002$chan\002.");
return;
}
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;
}
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";
&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) {
push(@nicks, $_);
}
}
- &DEBUG("nicks => '".scalar(@nicks)."'...");
+
if (scalar @nicks != $uucount) {
&DEBUG("nicks != uucount...");
}
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;