}
if ($hash{NoArgs} and $flatarg) {
- &DEBUG("cmd $ident does not take args; skipping.");
+ &DEBUG("cmd $ident does not take args ('$flatarg'); skipping.");
next;
}
$itc =~ s/([^\w\s])/\\$1/g;
my $z = join '|', split ' ', $itc;
+ if ($msgType eq "privmsg" and $message =~ / ($mask{chan})$/) {
+ &DEBUG("ircTC: privmsg detected; chan = $1");
+ $chan = $1;
+ }
+
if ($message =~ /^_stats(\s+(\S+))$/i) {
&textstats_main($2);
return;
}
}
my $topstr = "";
- &DEBUG("tp => $tp");
+ &DEBUG("*stats: tp => $tp");
if (scalar @top) {
$topstr = ". Top ".scalar(@top).": ".join(', ', @top);
}
return;
}
- &msg($who, "Sending CTCP VERSION...");
+ &msg($who, "Sending CTCP VERSION to #$chan...");
$conn->ctcp("VERSION", $chan);
$cache{verstats}{chan} = $chan;
$cache{verstats}{who} = $who;
$cache{verstats}{msgType} = $msgType;
+ $conn->schedule(30, sub {
+ my $c = lc $cache{verstats}{chan};
+ @vernicktodo = ();
+
+ foreach (keys %{ $channels{$c}{''} } ) {
+ next if (grep /^\Q$_\E$/i, @vernick);
+ push(@vernicktodo, $_);
+ }
+
+ &verstats_flush();
+ } );
+
$conn->schedule(60, sub {
my $vtotal = 0;
my $c = lc $cache{verstats}{chan};
my $unknown = $total - $vtotal;
my $perc = sprintf("%.1f", $unknown * 100 / $total);
$perc =~ s/.0$//;
- $sorted{$perc}{"unknown/cloak"} = "$unknown ($perc%)";
+ $sorted{$perc}{"unknown/cloak"} = "$unknown ($perc%)" if ($unknown);
foreach (keys %ver) {
my $count = scalar keys %{ $ver{$_} };
return;
}
+sub verstats_flush {
+ for (1..5) {
+ last unless (scalar @vernicktodo);
+
+ my $n = shift(@vernicktodo);
+ $conn->ctcp("VERSION", $n);
+ }
+
+ return unless (scalar @vernicktodo);
+
+ $conn->schedule(3, \&verstats_flush() );
+}
+
sub textstats_main {
my($arg) = @_;
}
my $topstr = "";
- &DEBUG("tp => $tp");
+ &DEBUG("*stats: tp => $tp");
if (scalar @top) {
$topstr = ". Top ".scalar(@top).": ".join(', ', @top);
}