#
# User Command Extension Stubs
+# WARN: this file does not reload on HUP.
#
if (&IsParam("useStrict")) { use strict; }
$hash{'Identifier'} .= "-" if ($hash{'Forker'} eq "NULL");
if (exists $hash{'ArrayArgs'}) {
- &Forker($hash{'Identifier'}, sub { \&{$hash{'CODEREF'}}(@args) } );
+ &Forker($hash{'Identifier'}, sub { \&{ $hash{'CODEREF'} }(@args) } );
} else {
- &Forker($hash{'Identifier'}, sub { \&{$hash{'CODEREF'}}($flatarg) } );
+ &Forker($hash{'Identifier'}, sub { \&{ $hash{'CODEREF'} }($flatarg) } );
}
} else {
}
if (exists $hash{'ArrayArgs'}) {
- &{$hash{'CODEREF'}}(@args);
+ &{ $hash{'CODEREF'} }(@args);
} else {
- &{$hash{'CODEREF'}}($flatarg);
+ &{ $hash{'CODEREF'} }($flatarg);
}
}
###
### START ADDING HOOKS.
###
-&addCmdHook("extra", 'd?bugs', ('CODEREF' => 'debianBugs',
+&addCmdHook("extra", 'd?bugs', ('CODEREF' => 'DBugs::Parse',
'Forker' => 1, 'Identifier' => 'debianExtra',
'Cmdstats' => 'Debian Bugs') );
&addCmdHook("extra", 'dauthor', ('CODEREF' => 'Debian::searchAuthor',
### TODO: compact with map?
my @list;
foreach (sort {$b <=> $a} keys %nickometer) {
- my $str = join(", ", sort keys %{$nickometer{$_}});
+ my $str = join(", ", sort keys %{ $nickometer{$_} });
push(@list, "$str ($_%)");
}
# lets find that secret cookie.
my $target = ($msgType ne 'public') ? $who : $talkchannel;
- my $cookiemsg = &getRandom(keys %{$lang{'cookie'}});
+ my $cookiemsg = &getRandom(keys %{ $lang{'cookie'} });
my ($key,$value);
### WILL CHEW TONS OF MEM.
foreach $user (keys %users) {
next if ($user eq "_default");
- foreach $m (keys %{$users{$user}{HOSTS}}) {
+ foreach $m (keys %{ $users{$user}{HOSTS} }) {
$m =~ s/\?/./g;
$m =~ s/\*/.*?/g;
$m =~ s/([\@\(\)\[\]])/\\$1/g;
$query =~ s/^explain\s*(\?*)/$1/i; # explain x
$query = " $query "; # side whitespaces.
- my $qregex = join '|', keys %{$lang{'qWord'}};
+ my $qregex = join '|', keys %{ $lang{'qWord'} };
# what's whats => what is; who'?s => who is, etc
$query =~ s/ ($qregex)\'?s / $1 is /i;
# result is random if separated by '||'.
# rhs is full factoid with '||'.
if ($mhs eq "is") {
- $reply = &getRandom(keys %{$lang{'factoid'}});
+ $reply = &getRandom(keys %{ $lang{'factoid'} });
$reply =~ s/##KEY/$lhs/;
$reply =~ s/##VALUE/$result/;
} else {
$reply =~ s/\$randpercentage/$randp/g; # ???
# randnick.
if ($reply =~ /\$randnick/) {
- my @nicks = keys %{$channels{$chan}{''}};
+ my @nicks = keys %{ $channels{$chan}{''} };
my $randnick = $nicks[ int($rand*$#nicks) ];
s/\$randnick/$randnick/;
}
if (&validFactoid($lhs,$rhs) == 0) {
if ($addressed) {
&status("IGNORE statement: <$who> $message");
- &performReply( &getRandom(keys %{$lang{'confused'}}) );
+ &performReply( &getRandom(keys %{ $lang{'confused'} }) );
}
return;
}
$conn->add_global_handler(376, \&on_endofmotd); # on_connect.
$conn->add_global_handler(433, \&on_nick_taken);
$conn->add_global_handler(439, \&on_targettoofast);
+ # for proper joinnextChan behaviour
+ $conn->add_global_handler(471, \&on_chanfull);
+ $conn->add_global_handler(473, \&on_inviteonly);
+ $conn->add_global_handler(474, \&on_banned);
+ $conn->add_global_handler(475, \&on_badchankey);
# end of handler stuff.
### FIXME: flag not supported yet.
- foreach (keys %{$dcc{'CHAT'}}) {
+ foreach (keys %{ $dcc{'CHAT'} }) {
$conn->privmsg($dcc{'CHAT'}{$_}, $txt);
}
}
foreach $type (keys %dcc) {
&FIXME("dcc_close: $who");
- my @who = grep /^\Q$who\E$/i, keys %{$dcc{$type}};
+ my @who = grep /^\Q$who\E$/i, keys %{ $dcc{$type} };
next unless (scalar @who);
$who = $who[0];
}
# Usage: &joinNextChan();
sub joinNextChan {
+ &DEBUG("joinNextChan called.");
+
if (scalar @joinchan) {
- my $chan = shift @joinchan;
+ $chan = shift @joinchan;
&joinchan($chan);
if (my $i = scalar @joinchan) {
&status("joinNextChan: $i chans to join.");
}
- return;
- }
- if (&IsParam("nickServ_pass") and $nickserv < 1) {
- &WARN("jNC: nickserv/chanserv not up.") if (!$nickserv);
- $nickserv--;
- }
+ # chanserv check: channel specific.
+ &chanServCheck($chan);
+
+ } else {
+ # chanserv check: global channels, in case we missed one.
- my %chan = &getChanConfList("chanServ");
- foreach $chan (keys %chan) {
- next unless ($chan{$chan} > 0);
-
- if (!exists $channels{$chan}{'o'}{$ident}) {
- &status("ChanServ ==> Requesting ops for $chan. (1)");
- &rawout("PRIVMSG ChanServ :OP $chan $ident");
+ foreach ( &ChanConfList("chanServ_ops") ) {
+ &chanServCheck($_);
}
}
}
my @array;
foreach (keys %channels) {
- next unless (grep /^\Q$nick\E$/i, keys %{$channels{$_}{''}});
+ next unless (grep /^\Q$nick\E$/i, keys %{ $channels{$_}{''} });
push(@array, $_);
}
return 0;
}
- if (grep /^\Q$nick\E$/i, keys %{$channels{$chan}{''}}) {
+ if (grep /^\Q$nick\E$/i, keys %{ $channels{$chan}{''} }) {
return 1;
} else {
foreach (keys %channels) {
my ($nick) = @_;
foreach $chan (keys %channels) {
- next unless (grep /^\Q$nick\E$/i, keys %{$channels{$chan}{''}});
+ next unless (grep /^\Q$nick\E$/i, keys %{ $channels{$chan}{''} });
return 1;
}
return 0;
my ($mode,$chan);
foreach $chan (@chans) {
- foreach $mode (keys %{$channels{$chan}}) {
+ foreach $mode (keys %{ $channels{$chan} }) {
# use grep here?
next unless (exists $channels{$chan}{$mode}{$nick});
foreach $type (keys %dcc) {
next if ($type ne uc($type));
- foreach $nick (keys %{$dcc{$type}}) {
+ foreach $nick (keys %{ $dcc{$type} }) {
next unless (defined $nick);
&DEBUG("closing DCC $type to $nick (FIXME).");
next unless (defined $dcc{$type}{$nick});
return unless (&IsChanConf("joinfloodCheck"));
if (exists $netsplit{lc $who}) { # netsplit join.
- &DEBUG("jfC: $who was in netsplit; not checking.");
+ &DEBUG("joinfloodCheck: $who was in netsplit; not checking.");
}
if (exists $floodjoin{$chan}{$who}{Time}) {
}
}
- &DEBUG("jfC: $delete deleted.") if ($delete);
+ &DEBUG("joinfloodCheck: $delete deleted.") if ($delete);
}
sub getHostMask {
# flood overflow protection.
if ($addressed) {
- foreach (keys %{$flood{$floodwho}}) {
+ foreach (keys %{ $flood{$floodwho} }) {
next unless (time() - $flood{$floodwho}{$_} > $interval);
delete $flood{$floodwho}{$_};
}
- my $i = scalar keys %{$flood{$floodwho}};
+ my $i = scalar keys %{ $flood{$floodwho} };
if ($i > $count) {
&msg($who,"overflow of messages ($i > $count)");
&status("FLOOD overflow detected from $floodwho; ignoring");
&WARN("clc: stupid to have plus at $plus, fix it!");
}
- if (exists $cache{ "chanlimitChange_$chan" }) {
- if (time() - $cache{ "chanlimitChange_$chan" } < $int*60) {
+ if (exists $cache{chanlimitChange}{$chan}) {
+ if (time() - $cache{chanlimitChange}{$chan} < $int*60) {
return;
}
}
- ### todo: check if we have ops.
- ### todo: if not, check if nickserv/chanserv is avail.
+ &chanServCheck($chan);
+
### todo: unify code with chanlimitcheck()
if ($delta > 5) {
&status("clc: big change in limit; changing.");
&rawout("MODE $chan +l ".($count+$plus) );
- $cache{ "chanlimitChange_$chan" } = time();
+ $cache{chanlimitChange}{$chan} = time();
}
}
}
+sub chanServCheck {
+ ($chan) = @_;
+
+ if (!defined $chan or $chan =~ /^$/) {
+ &WARN("chanServCheck: chan == NULL.");
+ return;
+ }
+
+ if ($chan =~ tr/A-Z/a-z/) {
+ &DEBUG("chanServCheck: lowercased chan ($chan)");
+ }
+
+ if (! &IsChanConf("chanServ_ops") ) {
+ return;
+ }
+
+ &DEBUG("chanServCheck($chan) called.");
+
+ if ( &IsParam("nickServ_pass") and !$nickserv) {
+ &DEBUG("chanServ_ops($_): nickserv enabled but not alive? (ircCheck)");
+ return;
+ }
+ return if (exists $channels{$chan}{'o'}{$ident});
+
+ &status("ChanServ ==> Requesting ops for $chan. (chanServCheck)");
+ &rawout("PRIVMSG ChanServ :OP $chan $ident");
+}
+
1;
} else { # dcc chat arena.
- foreach (keys %{$dcc{'CHAT'}}) {
+ foreach (keys %{ $dcc{'CHAT'} }) {
$conn->privmsg($dcc{'CHAT'}{$_}, "<$who> $orig{message}");
}
}
}
if (&IsParam("ircUMode")) {
- &status("Attempting change of user modes to $param{'ircUMode'}.");
+ &VERB("Attempting change of user modes to $param{'ircUMode'}.", 2);
+ if ($param{'ircUMode'} !~ /^[-+]/) {
+ &WARN("ircUMode had no +- prefix; adding +");
+ $param{'ircUMode'} = "+".$param{'ircUMode'};
+ }
+
&rawout("MODE $ident $param{'ircUMode'}");
}
@joinchan = &getJoinChans();
}
+ # unfortunately, Net::IRC does not implement this :(
+ &rawout("NOTIFY $ident");
+ &DEBUG("adding self to NOTIFY list.");
+
&joinNextChan();
}
my ($self, $event) = @_;
my $chan = ($event->args)[1];
+ # sync time should be done in on_endofwho like in BitchX
if (exists $cache{jointime}{$chan}) {
my $delta_time = sprintf("%.03f", &gettimeofday() - $cache{jointime}{$chan});
$delta_time = 0 if ($delta_time < 0);
my $chanstats = join(' || ', @array);
&status("$b_blue$chan$ob: [$chanstats]");
+ &joinNextChan();
if (scalar @joinchan) { # remaining channels to join.
+ # lets do two at once!
&joinNextChan();
- } else {
- &DEBUG("running ircCheck to get chanserv ops.");
- &ircCheck();
- }
-
- return unless (&IsChanConf("chanServ_ops") > 0);
- return unless ($nickserv);
-
- if (!exists $channels{$chan}{'o'}{$ident}) {
- &status("ChanServ ==> Requesting ops for $chan. (2)");
- &rawout("PRIVMSG ChanServ :OP $chan $ident");
}
}
next;
}
- &status("invited to $b_blue$_$ob by $b_cyan$who$ob");
- &joinchan($self, $_);
+ &status("invited to $b_blue$chan$ob by $b_cyan$nick$ob");
+ &joinchan($chan);
}
}
my ($chan,$mode);
foreach $chan (keys %channels) {
- foreach $mode (keys %{$channels{$chan}}) {
+ foreach $mode (keys %{ $channels{$chan} }) {
next unless (exists $channels{$chan}{$mode}{$nick});
$channels{$chan}{$mode}{$newnick} = $channels{$chan}{$mode}{$nick};
foreach $chan (grep /[A-Z]/, keys %channels) {
&DEBUG("leak: chan => '$chan'.");
my ($i,$j);
- foreach $i (keys %{$channels{$chan}}) {
- foreach (keys %{$channels{$chan}{$i}}) {
+ foreach $i (keys %{ $channels{$chan} }) {
+ foreach (keys %{ $channels{$chan}{$i} }) {
&DEBUG("leak: \$channels{$chan}{$i}{$_} ...");
}
}
$nuh{lc $args[1]} = $args[1]."!".$args[2]."\@".$args[3];
}
+###
+### since joinnextchan is hooked onto on_endofnames, these are needed.
+###
+
+sub on_chanfull {
+ my ($self, $event) = @_;
+ my @args = $event->args;
+ &DEBUG("on_chanfull: args => @args");
+ &joinNextChan();
+}
+
+sub on_inviteonly {
+ my ($self, $event) = @_;
+ my @args = $event->args;
+ &DEBUG("on_inviteonly: args => @args");
+ &joinNextChan();
+}
+
+sub on_banned {
+ my ($self, $event) = @_;
+ my @args = $event->args;
+ &DEBUG("on_banned: args => @args");
+ &joinNextChan();
+}
+
+sub on_badchankey {
+ my ($self, $event) = @_;
+ my @args = $event->args;
+ &DEBUG("on_badchankey: args => @args");
+ &joinNextChan();
+}
+
1;
&leakCheck(2); # mandatory
&ignoreCheck(1); # mandatory
&seenFlushOld(2);
- &ircCheck(1); # mandatory
+ &ircCheck(2); # mandatory
&miscCheck(1); # mandatory
&miscCheck2(2); # mandatory
&shmFlush(1); # mandatory
next unless (&validChan($chan));
my $limitplus = &getChanConfDefault("chanlimitcheckPlus", 5, $chan);
- my $newlimit = scalar(keys %{$channels{$chan}{''}}) + $limitplus;
+ my $newlimit = scalar(keys %{ $channels{$chan}{''} }) + $limitplus;
my $limit = $channels{$chan}{'l'};
- if (defined $limit and scalar keys %{$channels{$chan}{''}} > $limit) {
+ if (defined $limit and scalar keys %{ $channels{$chan}{''} } > $limit) {
&FIXME("LIMIT: set too low!!! FIXME");
### run NAMES again and flush it.
}
if (!exists $channels{$chan}{'o'}{$ident}) {
&status("ChanLimit: dont have ops on $chan.") unless (exists $cache{warn}{chanlimit}{$chan});
$cache{warn}{chanlimit}{$chan} = 1;
- ### TODO: check chanserv?
+ &chanServCheck($chan);
next;
}
delete $cache{warn}{chanlimit}{$chan};
&status("ChanLimit: setting for first time or from netsplit, for $chan");
}
- if (exists $cache{ "chanlimitChange_$chan" }) {
- my $delta = time() - $cache{ "chanlimitChange_$chan" };
+ if (exists $cache{chanlimitChange}{$chan}) {
+ my $delta = time() - $cache{chanlimitChange}{$chan};
if ($delta < $interval*60) {
&DEBUG("not going to change chanlimit! ($delta<$interval*60)");
return;
}
&rawout("MODE $chan +l $newlimit");
- $cache{ "chanlimitChange_$chan" } = time();
+ $cache{chanlimitChange}{$chan} = time();
}
}
}
foreach $s1 (keys %netsplitservers) {
- foreach $s2 (keys %{$netsplitservers{$s1}}) {
+ foreach $s2 (keys %{ $netsplitservers{$s1} }) {
if (time() - $netsplitservers{$s1}{$s2} > 3600) {
&status("netsplit between $s1 and $s2 appears to be stale.");
delete $netsplitservers{$s1}{$s2};
my $interval = &getChanConfDefault("floodCycle",60);
foreach $who (keys %flood) {
- foreach (keys %{$flood{$who}}) {
+ foreach (keys %{ $flood{$who} }) {
if (!exists $flood{$who}{$_}) {
&WARN("flood{$who}{$_} undefined?");
next;
}
sub ircCheck {
-
if (@_) {
&ScheduleThis(60, "ircCheck");
return if ($_[0] eq "2"); # defer.
&FIXME("ircCheck: current channels * 2 <= config channels. FIXME.");
}
- # chanserv ops.
- foreach ( &ChanConfList("chanServ_ops") ) {
- next if (exists $channels{$chan}{'o'}{$ident});
-
- &status("ChanServ ==> Requesting ops for $chan. (3)");
- &rawout("PRIVMSG ChanServ :OP $chan $ident");
- }
-
if (!$conn->connected or time() - $msgtime > 3600) {
# todo: shouldn't we use cache{connect} somewhere?
if (exists $cache{connect}) {
if ($ident !~ /^\Q$param{ircNick}\E$/) {
# this does not work unfortunately.
&WARN("ircCheck: ident($ident) != param{ircNick}($param{IrcNick}).");
+
+ # this check is misleading... perhaps we should do a notify.
if (! &IsNickInAnyChan( $param{ircNick} ) ) {
&DEBUG("$param{ircNick} not in use... changing!");
&nick( $param{ircNick} );
}
}
- &joinNextChan();
- # if scalar @joinnext => join more channels
- # else check for chanserv.
-
if (grep /^\s*$/, keys %channels) {
&WARN("ircCheck: we have a NULL chan in hash channels? removing!");
if (exists $channels{''}) {
# sort the hash list appropriately.
foreach (sort keys %files) {
my $file = $_;
- my @keys = sort keys %{$files{$file}};
+ my @keys = sort keys %{ $files{$file} };
my $i = scalar(@keys);
if ($i > 1) {
}
foreach $pkg (keys %contents) {
- foreach (keys %{$contents{$pkg}}) {
+ foreach (keys %{ $contents{$pkg} }) {
# TODO: correct padding.
print OUT "$_\t\t\t$pkg\n";
}
my @list;
foreach $pkg (keys %contents) {
- my @tmplist = &::fixFileList(keys %{$contents{$pkg}});
+ my @tmplist = &::fixFileList(keys %{ $contents{$pkg} });
my @sublist = sort { length $a <=> length $b } @tmplist;
pop @sublist while (scalar @sublist > 3);
my $name;
foreach $name (keys %maint) {
my $email;
- foreach $email (keys %{$maint{$name}}) {
+ foreach $email (keys %{ $maint{$name} }) {
next unless ($email =~ /\Q$query\E/i);
next if (exists $hash{$name});
$hash{$name} = 1;
&::DEBUG("showing all packages by '$list[0]'...");
- my @pkg = sort keys %{$pkg{$list[0]}};
+ my @pkg = sort keys %{ $pkg{$list[0]} };
# show how long it took.
my $delta_time = &::timedelta($start_time);
&::status(sprintf("Debian: %.02f sec to complete query.", $delta_time)) if ($delta_time > 0);
- my $email = join(', ', keys %{$maint{$list[0]}});
+ my $email = join(', ', keys %{ $maint{$list[0]} });
my $prefix = "Debian Packages by $list[0] \002<\002$email\002>\002 ";
&::pSReply( &::formListReply(0, $prefix, @pkg) );
}
&::pSReply(
"Debian Distro Stats on $dist... ".
"\002$total{'count'}\002 packages, ".
- "\002".scalar(keys %{$total{'maint'}})."\002 maintainers, ".
+ "\002".scalar(keys %{ $total{'maint'} })."\002 maintainers, ".
"\002". int($total{'isize'}/1024)."\002 MB installed size, ".
"\002". int($total{'csize'}/1024/1024)."\002 MB compressed size."
);
### TODO: do individual stats? if so, we need _another_ arg.
# foreach $file (keys %stats) {
-# foreach (keys %{$stats{$file}}) {
+# foreach (keys %{ $stats{$file} }) {
# &::DEBUG(" '$file' '$_' '$stats{$file}{$_}'.");
# }
# }
use strict;
-my $bugs_url = "http://master.debian.org/~wakkerma/bugs";
+package DBugs;
+
+sub Parse {
+ my($args) = @_;
+
+ if (!defined $args or $args =~ /^$/) {
+ &debianBugs();
+ }
+
+ if ($args =~ /^(\d+)$/) {
+ # package number:
+ &do_id($args);
+
+ } elsif ($args =~ /^(\S+\@\S+)$/) {
+ # package email maintainer.
+ &do_email($args);
+
+ } elsif ($args =~ /^(\S+)$/) {
+ # package name.
+ &do_pkg($args);
+
+ } else {
+ # invalid.
+ &::msg($::who, "error: could not parse $args");
+ }
+}
sub debianBugs {
- my @results = &::getURL($bugs_url);
+ my @results = &::getURL("http://master.debian.org/~wakkerma/bugs");
my ($date, $rcbugs, $remove);
my ($bugs_closed, $bugs_opened) = (0,0);
}
}
+sub do_id {
+ my($num) = @_;
+ my $url = "http://bugs.debian.org/$num";
+
+ if (1) {
+ &::msg($::who, "do_id not supported yet.");
+ return;
+ }
+
+ my @results = &::getURL($url);
+ foreach (@results) {
+ &::DEBUG("do_id: $_");
+ }
+}
+
+sub do_email {
+ my($email) = @_;
+ my $url = "http://bugs.debian.org/$email";
+
+ if (1) {
+ &::msg($::who, "do_email not supported yet.");
+ return;
+ }
+
+ my @results = &::getURL($url);
+ foreach (@results) {
+ &::DEBUG("do_email: $_");
+ }
+}
+
+sub do_pkg {
+ my($pkg) = @_;
+ my $url = "http://bugs.debian.org/$pkg";
+
+ my @results = &::getURL($url);
+ foreach (@results) {
+ &::DEBUG("do_pkg: $_");
+ }
+}
+
1;
my $count;
my @list;
foreach $count (sort { $b <=> $a } keys %count) {
- my $author = join(", ", sort keys %{$count{$count}});
+ my $author = join(", ", sort keys %{ $count{$count} });
push(@list, "$count by $author");
}
my $v;
foreach $v (keys %hash) {
- my $count = scalar(keys %{$hash{$v}});
+ my $count = scalar(keys %{ $hash{$v} });
next if ($count == 1);
my @sublist;
- foreach (keys %{$hash{$v}}) {
+ foreach (keys %{ $hash{$v} }) {
if ($v =~ /^<REPLY> see /i) {
$refs++;
next;
my @list;
foreach (sort {$a <=> $b} keys %age) {
- push(@list, join(",", keys %{$age{$_}}));
+ push(@list, join(",", keys %{ $age{$_} }));
}
my $prefix = "new factoids in the last 24hours ";
my @sublist;
my $length;
foreach $length (@length) {
- foreach (keys %{$length{$length}}) {
+ foreach (keys %{ $length{$length} }) {
if ($key{$_} =~ /^$val/i) {
s/([\,\;]+)/\037$1\037/g;
s/( and|and )/\037$1\037/g;
my @newlist;
foreach $f (keys %redir) {
- my @sublist = keys %{$redir{$f}};
+ my @sublist = keys %{ $redir{$f} };
for (@sublist) {
s/([\,\;]+)/\037$1\037/g;
}
# work-around.
my %count;
foreach (keys %requester) {
- $count{$requester{$_}}{$_} = 1;
+ $count{ $requester{$_} }{$_} = 1;
}
undef %requester;
} elsif ($cmd =~ /^(history)$/i) {
### CMD: HISTORY:
- if (!scalar @{$topic{$chan}{'History'}}) {
+ if (!scalar @{ $topic{$chan}{'History'} }) {
&msg($who, "Sorry, no topics in history list.");
return;
}
&msg($who, "History of topics on \002$chan\002:");
- for (1 .. scalar @{$topic{$chan}{'History'}}) {
- my $topic = ${$topic{$chan}{'History'}}[$_-1];
+ for (1 .. scalar @{ $topic{$chan}{'History'} }) {
+ my $topic = ${ $topic{$chan}{'History'} }[$_-1];
&msg($who, " #\002$_\002: $topic");
# To prevent excess floods.
# following needs to be verified.
if ($args =~ /^last$/i) {
- if (${$topic{$chan}{'History'}}[0] eq $topic{$chan}{'Current'}) {
+ if (${ $topic{$chan}{'History'} }[0] eq $topic{$chan}{'Current'}) {
&msg($who,"error: cannot restore last topic because it's mine.");
return;
}
}
if ($args =~ /\d+/) {
- if ($args > $#{$topic{$chan}{'History'}} || $args < 1) {
+ if ($args > $#{ $topic{$chan}{'History'} } || $args < 1) {
&msg($who, "error: argument is out of range.");
return;
}
$_ = "Changing topic according to request.";
- &topicNew($chan, ${$topic{$chan}{'History'}}[$args-1], $_, $topicUpdate);
+ &topicNew($chan, ${ $topic{$chan}{'History'} }[$args-1], $_, $topicUpdate);
return;
}
yotta => 21,
zetta => 24,
);
- $PREF = join '|', sort {$PREF{$a} <=> $PREF{$b}} (keys %PREF);
+ $PREF = join '|', sort { $PREF{$a} <=> $PREF{$b} } (keys %PREF);
}
# should be no problems, even if uptime or pid is duplicated.
## WARN: run away forks may get through here, have to fix.
foreach $uptime (sort {$b <=> $a} keys %uptime) {
- foreach $pid (keys %{$uptime{$uptime}}) {
+ foreach $pid (keys %{ $uptime{$uptime} }) {
next if (exists $done{$pid});
push(@results,"$uptime.$pid $uptime{$uptime}{$pid}");
# who.
if ($message =~ /^who$/) {
- my $count = scalar(keys %{$dcc{'CHAT'}});
+ my $count = scalar(keys %{ $dcc{'CHAT'} });
my $dccCHAT = $message;
&pSReply("Start of who ($count users).");
- foreach (keys %{$dcc{'CHAT'}}) {
+ foreach (keys %{ $dcc{'CHAT'} }) {
&pSReply("=> $_");
}
&pSReply("End of who.");
# override msgType.
if ($msgType =~ /public/ and $message =~ s/^\+//) {
- &status("found '+' flag; setting msgType to public.");
- $force_public_reply++;
+ &status("Process: '+' flag detected; changing reply to public");
$msgType = 'public';
$who = $chan; # major hack to fix &msg().
- &DEBUG("addressed => $addressed.");
+ $force_public_reply++;
+ # notice is still NOTICE but to whole channel => good.
}
# User Processing, for all users.
if ($message =~ /^than(ks?|x)( you)?( \S+)?/i) {
return 'thank: no addr' unless ($message =~ /$ident/ or $talkok);
- &performReply( &getRandom(keys %{$lang{'welcome'}}) );
+ &performReply( &getRandom(keys %{ $lang{'welcome'} }) );
return;
}
my $newresult = &perlMath();
if (defined $newresult and $newresult ne "") {
+ $cmdstats{'Maths'}++;
$result = $newresult;
&status("math: <$who> $message => $result");
}
if (length $message > 64) {
&status("unparseable-moron: $message");
- &performReply( &getRandom(keys %{$lang{'moron'}}) );
+ &performReply( &getRandom(keys %{ $lang{'moron'} }) );
$count{'Moron'}++;
return;
}
&status("unparseable: $message");
- &performReply( &getRandom(keys %{$lang{'dunno'}}) );
+ &performReply( &getRandom(keys %{ $lang{'dunno'} }) );
$count{'Dunno'}++;
}
&ircCheck();
next;
}
- push(@array, "$_ (".scalar(keys %{$channels{$_}{''}}).")");
+ push(@array, "$_ (".scalar(keys %{ $channels{$_}{''} }).")");
}
&pSReply($reply.": ".join(' ', @array));
### total user count.
foreach $chan (keys %channels) {
- $tucount += scalar(keys %{$channels{$chan}{''}});
+ $tucount += scalar(keys %{ $channels{$chan}{''} });
}
### unique user count.
# Step 1:
my @array;
- foreach (sort keys %{$chanstats{$chan}}) {
+ foreach (sort keys %{ $chanstats{$chan} }) {
my $int = $chanstats{$chan}{$_};
next unless ($int);
- $chanstats{$chan}{'Part'};
if ($delta_stats) {
- my $total = scalar(keys %{$channels{$chan}{''}});
+ my $total = scalar(keys %{ $channels{$chan}{''} });
&status("chaninfo: join ~= signoff + part (drift of $delta_stats < $total).");
if ($delta_stats > $total) {
undef @array;
my $type;
foreach ("v","o","") {
- my $int = scalar(keys %{$channels{$chan}{$_}});
+ my $int = scalar(keys %{ $channels{$chan}{$_} });
next unless ($int);
$type = "Voice" if ($_ eq "v");
my %countstats;
foreach (keys %cmdstats) {
- $countstats{$cmdstats{$_}}{$_} = 1;
+ $countstats{ $cmdstats{$_} }{$_} = 1;
}
foreach (sort {$b <=> $a} keys %countstats) {
my $int = $_;
next unless ($int);
- foreach (keys %{$countstats{$int}}) {
+ foreach (keys %{ $countstats{$int} }) {
push(@array, "\002$int\002 of $_");
}
}
my $p = sprintf("%.02f", $connectivity);
$p =~ s/(\.\d*)0+$/$1/;
if ($p =~ s/\.0$//) {
- &DEBUG("p sar not working properly :(");
+ # this should not happen... but why...
} else {
$p =~ s/\.$//
}
### REASON.
my $reason = $ircstats{'DisconnectReason'};
if (defined $reason) {
- $reply .= " I was last disconnected for '$reason'.";
+ $reply .= ". I was last disconnected for '$reason'.";
}
&pSReply($reply);