&addCmdHook("main", 'help', ('CODEREF' => 'help',
'Cmdstats' => 'Help', ) );
&addCmdHook("main", 'karma', ('CODEREF' => 'karma', ) );
-&addCmdHook("main", 'i?spell', ('CODEREF' => 'ispell',
- Help => 'spell', Identifier => 'spell', ) );
-&addCmdHook("main", 'd?nslookup', ('CODEREF' => 'DNS',
- Help => 'nslookup', Identifier => 'allowDNS',
- Forker => "NULL", ) );
&addCmdHook("main", 'tell|explain', ('CODEREF' => 'tell',
Help => 'tell', Identifier => 'allowTelling',
Cmdstats => 'Tell') );
my $str = sprintf("%s (%d)", $_, scalar(keys %{ $channels{$_}{''} }));
push(@array, $str);
}
- &pSReply($reply.": ".join(', ', @array));
+ &performStrictReply($reply.": ".join(', ', @array));
&ircCheck();
### total user count.
}
my $chans = scalar(keys %channels);
- &pSReply(
+ &performStrictReply(
"i've cached \002$tucount\002 ". &fixPlural("user",$tucount).
", \002$uucount\002 unique ". &fixPlural("user",$uucount).
", distributed over \002$chans\002 ".
if ($count) {
$reply .= ". \002$count\002 has said the most with a total of \002$new{$count}\002 messages";
}
- &pSReply("$reply.");
+ &performStrictReply("$reply.");
}
# Command statistics.
push(@array, "\002$int\002 of $_");
}
}
- &pSReply("command usage include ". &IJoin(@array).".");
+ &performStrictReply("command usage include ". &IJoin(@array).".");
}
# Factoid extension info. xk++
my $type = shift(@_);
&Forker("factoids", sub {
- &pSReply( &CmdFactStats($type) );
+ &performStrictReply( &CmdFactStats($type) );
} );
}
{ nick => $target, type => "karma" }) || 0;
if ($karma != 0) {
- &pSReply("$target has karma of $karma");
+ &performStrictReply("$target has karma of $karma");
} else {
- &pSReply("$target has neutral karma");
+ &performStrictReply("$target has neutral karma");
}
}
-sub ispell {
- my $query = shift;
- my $binary;
- my @binaries = (
- '/usr/bin/aspell',
- '/usr/bin/ispell',
- '/usr/bin/spell'
- );
-
- foreach (@binaries) {
- if (-x $_) {
- $binary=$_;
- last;
- }
- }
-
- if (!$binary) {
- &msg($who, "no binary found.");
- return;
- }
-
- if (!&validExec($query)) {
- &msg($who,"argument appears to be fuzzy.");
- return;
- }
-
- my $reply = "I can't find alternate spellings for '$query'";
-
- foreach (`/bin/echo '$query' | $binary -a -S`) {
- chop;
- last if !length; # end of query.
-
- if (/^\@/) { # intro line.
- next;
- } elsif (/^\*/) { # possibly correct.
- $reply = "'$query' may be spelled correctly";
- last;
- } elsif (/^\&/) { # possible correction(s).
- s/^\& (\S+) \d+ \d+: //;
- my @array = split(/,? /);
-
- $reply = "possible spellings for $query: @array";
- last;
- } elsif (/^\+/) {
- &DEBUG("spell: '+' found => '$_'.");
- last;
- } elsif (/^# (.*?) 0$/) {
- # none found.
- last;
- } else {
- &DEBUG("spell: unknown: '$_'.");
- }
- }
-
- &pSReply($reply);
-}
-
-sub nslookup {
- my $query = shift;
- &status("DNS Lookup: $query");
- &DNS($query);
-}
-
sub tell {
my $args = shift;
my ($target, $tell_obj) = ('','');
&msg($target, $reply);
}
-sub DNS {
- my $dns = shift;
- my($match, $x, $y, $result);
- my $pid;
- $dns =~ s/^\s+|\s+$//g;
-
- if (!defined $dns or $dns =~ /^\s*$/ or $dns =~ / /) {
- &help("dns");
- return;
- }
-
- if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) {
- $match = $1;
- &status("DNS query by IP address: $match");
-
- $y = pack('C4', split(/\./, $match));
- $x = (gethostbyaddr($y, &AF_INET));
-
- if ($x !~ /^\s*$/) {
- $result = $match." is ".$x unless ($x =~ /^\s*$/);
- } else {
- $result = "I can't seem to find that address in DNS";
- }
-
- } else {
-
- &status("DNS query by name: $dns");
- $x = join('.',unpack('C4',(gethostbyname($dns))[4]));
-
- if ($x !~ /^\s*$/) {
- $result = $dns." is ".$x;
- } else {
- $result = "I can\'t find that machine name";
- }
- }
-
- &performReply($result);
-}
-
sub countryStats {
if (exists $cache{countryStats}) {
&msg($who,"countrystats is already running!");
# TODO: move this into a scheduler like nickometer
$msgType = "private";
- &pSReply( &formListReply(0, "Country Stats ", @list) );
+ &performStrictReply( &formListReply(0, "Country Stats ", @list) );
delete $cache{countryStats};
delete $cache{on_who_Hack};
# conversion: ascii.
if ($message =~ /^(asci*|chr) (\d+)$/) {
&DEBUG("ascii/chr called ...");
- return unless (&hasParam("allowConv"));
+ return unless (&IsChanConfOrWarn("allowConv"));
&DEBUG("ascii/chr called");
# conversion: ord.
if ($message =~ /^ord(\s+(.*))$/) {
- return unless (&hasParam("allowConv"));
+ return unless (&IsChanConfOrWarn("allowConv"));
$arg = $2;
# hex.
if ($message =~ /^hex(\s+(.*))?$/i) {
- return unless (&hasParam("allowConv"));
+ return unless (&IsChanConfOrWarn("allowConv"));
my $arg = $2;
if (!defined $arg) {
$retval .= sprintf(" %X", ord($_));
}
- &pSReply("$arg is$retval");
+ &performStrictReply("$arg is$retval");
return;
}
# return;
# }
- &pSReply( crypt($args[1], $args[0]) );
+ &performStrictReply( crypt($args[1], $args[0]) );
} else {
- &pSReply( &mkcrypt($args[0]) );
+ &performStrictReply( &mkcrypt($args[0]) );
}
return;
return unless (&hasFlag("n"));
&status("USER reload $who");
- &pSReply("reloading...");
+ &performStrictReply("reloading...");
my $modules = &reloadAllModules();
- &pSReply("reloaded:$modules");
+ &performStrictReply("reloaded:$modules");
return;
}
}
$reply =~ y/A-Za-z/N-ZA-Mn-za-m/;
- &pSReply($reply);
+ &performStrictReply($reply);
return;
}
}
$ratio = sprintf("%.01f", 100*$perc/($perc+$perc2) );
- &pSReply("Total CPU usage: \002$cpu_usage\002 s ... ".
+ &performStrictReply("Total CPU usage: \002$cpu_usage\002 s ... ".
"Total used: \002$total\002 % ".
"(parent/child ratio: $ratio %)"
);
$reply .= ". I was last disconnected for '$reason'.";
}
- &pSReply($reply);
+ &performStrictReply($reply);
return;
}
$count{'Commands'} += $cmdstats{$_};
}
- &pSReply(
+ &performStrictReply(
"Since $startString, there have been".
" \002$count{'Update'}\002 ".
&fixPlural("modification", $count{'Update'}).