#
# UserExtra.pl: User Commands, Public.
# Author: dms
-# Version: v0.2b (20000707)
-# Created: 20000107
#
use strict;
use vars qw($message $arg $qWord $verb $lobotomized $who $result $chan
$conn $msgType $query $talkchannel $ident $memusage);
use vars qw(%channels %chanstats %cmdstats %count %ircstats %param
- %cache %mask %userstats %hooks_main);
+ %cache %mask %userstats);
-###
-### Start of command hooks for UserExtra.
-###
-
-&addCmdHook("main", 'chan(stats|info)', ('CODEREF' => 'chaninfo', ) );
-&addCmdHook("main", 'cmd(stats|info)', ('CODEREF' => 'cmdstats', ) );
-&addCmdHook("main", 'sched(stats|info)', ('CODEREF' => 'scheduleList', ) );
-&addCmdHook("main", 'factinfo', ('CODEREF' => 'factinfo',
- 'Cmdstats' => 'Factoid Info', Module => 'Factoids', ) );
-&addCmdHook("main", 'factstats?', ('CODEREF' => 'factstats',
- 'Cmdstats' => 'Factoid Stats', Help => "factstats",
- Forker => 1, 'Identifier' => 'Factoids', ) );
-&addCmdHook("main", 'help', ('CODEREF' => 'help',
- 'Cmdstats' => 'Help', ) );
-&addCmdHook("main", 'karma', ('CODEREF' => 'karma', ) );
-&addCmdHook("main", 'tell|explain', ('CODEREF' => 'tell',
- Help => 'tell', Identifier => 'allowTelling',
- Cmdstats => 'Tell') );
-&addCmdHook("main", 'News', ('CODEREF' => 'News::Parse',
- Module => 'News', 'Cmdstats' => 'News' ) );
-&addCmdHook("main", 'countrystats', ('CODEREF' => 'countryStats',
-# Forker => "NULL",
- ) );
-
-&status("CMD: loaded ".scalar(keys %hooks_main)." MAIN command hooks.");
+### hooks get added in CommandHooks.pl.
###
### Start of commands for hooks.
}
### unique user count.
- # %seen = ();
- # foreach $item (@list) {
- # $seen{$item}++;
- # }
- # @uniq = keys %seen;
my %nicks = ();
foreach $chan (keys %channels) {
my $nick;
sub factstats {
my $type = shift(@_);
- &Forker("factoids", sub {
+ &Forker("Factoids", sub {
&performStrictReply( &CmdFactStats($type) );
} );
}
# support command redirection.
# recursive cmdHooks aswell :)
my $done = 0;
- $done++ if &parseCmdHook("main", $tell_obj);
- $done++ if &parseCmdHook("extra", $tell_obj);
+ $done++ if &parseCmdHook($tell_obj);
$message = $tell_obj;
$done++ unless (&Modules());
}
# rot13 it.
- if ($message =~ /^rot13(\s+(.*))?/i) {
- my $reply = $2;
+ if ($message =~ /^rot([0-9]*)(\s+(.*))?/i) {
+ my $reply = $3;
if (!defined $reply) {
&help("rot13");
return;
}
+ my $num = $1 % 26;
+ my $upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ my $lower="abcdefghijklmnopqrstuvwxyz";
+ my $to=substr($upper,$num).substr($upper,0,$num).substr($lower,$num).substr($lower,0,$num);
+ eval "\$reply =~ tr/$upper$lower/$to/;";
- $reply =~ y/A-Za-z/N-ZA-Mn-za-m/;
+ #$reply =~ y/A-Za-z/N-ZA-Mn-za-m/;
&performStrictReply($reply);
return;
);
return;
-
- my %hash = &sqlSelectColHash("stats", "nick,counter",
- { type => "cmdstats" }, 1);
-# ORDER won't be retained in a hash
-# " ORDER BY counter DESC", 1);
-
-if (0) {
- foreach (keys %hash) {
- my $i = $_;
- foreach (keys %{ $hash{$i} }) {
- &DEBUG("cmdstats: $hash{$i}{$_} = $_");
- }
- }
- &DEBUG("end of cmdstats.");
-}
-
- return;
}
# wantNick. xk++