2 # User Command Extension Stubs
3 # WARN: this file does not reload on HUP.
6 #use strict; # TODO: sub { \&{ $hash{'CODEREF'} }($flatarg) };
8 use vars qw($who $msgType $conn $chan $message $ident $talkchannel
9 $bot_version $bot_data_dir);
10 use vars qw(@vernick @vernicktodo);
11 use vars qw(%channels %cache %mask %userstats %myModules %cmdstats
12 %cmdhooks %lang %ver);
13 # TODO: FIX THE FOLLOWING:
14 use vars qw($total $x $type $i $good %wingateToDo);
16 ### COMMAND HOOK IMPLEMENTATION.
17 # addCmdHook('TEXT_HOOK',
20 # Module => 'blah.pl' # preload module.
21 # Identifier => 'config_label', # change to Config?
22 # Help => 'help_label',
23 # Cmdstats => 'text_label',)
28 my ($ident, %hash) = @_;
30 if (exists $cmdhooks{$ident}) {
31 &WARN("aCH: \$cmdhooks{$ident} already exists.");
35 &VERB("aCH: added $ident",2); # use $hash{'Identifier'}?
36 ### hrm... prevent warnings?
37 $cmdhooks{$ident} = \%hash;
43 $line =~ s/^\s+|\s+$//g; # again.
44 $line =~ /^(\S+)(\s+(.*))?$/;
45 my $cmd = $1; # command name is whitespaceless.
47 my @args = split(/\s+/, $flatarg || '');
52 if (!defined %cmdhooks) {
53 &WARN('%cmdhooks does not exist.');
58 &WARN("cstubs: cmd == NULL.");
62 foreach (keys %cmdhooks) {
63 # rename to something else! like $id or $label?
66 next unless ($cmd =~ /^$ident$/i);
69 &WARN("pCH: Multiple hook match: $ident");
73 &status("cmdhooks: $cmd matched '$ident' '$flatarg'");
74 my %hash = %{ $cmdhooks{$ident} };
76 if (!scalar keys %hash) {
77 &WARN("CmdHook: hash is NULL?");
81 if ($hash{NoArgs} and $flatarg) {
82 &DEBUG("cmd $ident does not take args ('$flatarg'); skipping.");
86 if (!exists $hash{CODEREF}) {
87 &ERROR("CODEREF undefined for $cmd or $ident.");
92 foreach (keys %hash) {
93 &VERB(" $cmd->$_ => '$hash{$_}'.",2);
97 if (exists $hash{'Help'} and !scalar(@args)) {
98 &help( $hash{'Help'} );
103 if (exists $hash{'Identifier'}) {
104 return 1 unless (&IsChanConfOrWarn($hash{'Identifier'}));
108 if (exists $hash{'UserFlag'}) {
109 return 1 unless (&hasFlag($hash{'UserFlag'}));
112 ### FORKER,IDENTIFIER,CODEREF.
113 if (($$ == $bot_pid) && exists $hash{'Forker'}) {
114 $hash{'Identifier'} .= "-" if ($hash{'Forker'} eq "NULL");
116 if (exists $hash{'ArrayArgs'}) {
117 &Forker($hash{'Identifier'}, sub { \&{ $hash{'CODEREF'} }(@args) } );
119 &Forker($hash{'Identifier'}, sub { \&{ $hash{'CODEREF'} }($flatarg) } );
123 if (exists $hash{'Module'}) {
124 &loadMyModule($hash{'Module'});
127 # check if CODEREF exists.
128 if (!defined &{ $hash{'CODEREF'} }) {
129 &WARN("coderef $hash{'CODEREF'} does not exist.");
131 &msg($who, "coderef does not exist for $ident.");
137 if (exists $hash{'ArrayArgs'}) {
138 &{ $hash{'CODEREF'} }(@args);
140 &{ $hash{'CODEREF'} }($flatarg);
145 if (exists $hash{'Cmdstats'}) {
146 $cmdstats{ $hash{'Cmdstats'} }++;
149 &VERB("hooks: End of command.",2);
159 if (!defined $message) {
160 &WARN("Modules: message is undefined. should never happen.");
164 my $debiancmd = 'conflicts?|depends?|desc|file|(?:d)?info|provides?';
165 $debiancmd .= '|recommends?|suggests?|maint|maintainer';
167 if ($message =~ /^($debiancmd)(\s+(.*))?$/i) {
168 return unless (&IsChanConfOrWarn('Debian'));
171 if (defined $package) {
172 &Forker('Debian', sub { &Debian::infoPackages($1, $package); } );
180 # google searching. Simon++
181 my $w3search_regex = "google";
182 if ($message =~ /^(?:search\s+)?($w3search_regex)\s+(?:for\s+)?['"]?(.*?)["']?\s*\?*$/i) {
183 return unless (&IsChanConfOrWarn('W3Search'));
185 &Forker('W3Search', sub { &W3Search::W3Search($1,$2); } );
187 $cmdstats{'W3Search'}++;
191 # text counters. (eg: hehstats)
193 $itc = &getChanConf('ircTextCounters');
194 $itc = &findChanConf('ircTextCounters') unless ($itc);
195 return if ($itc && &do_text_counters($itc) == 1);
196 # end of text counters.
198 # list{keys|values}. xk++. Idea taken from #linuxwarez@EFNET
199 if ($message =~ /^list(\S+)(\s+(.*))?$/i) {
200 return unless (&IsChanConfOrWarn('Search'));
205 $thiscmd =~ s/^vals$/values/;
206 return if ($thiscmd ne 'keys' && $thiscmd ne 'values');
209 if (!defined $args or $args =~ /^\s*$/) {
210 &help('list'. $thiscmd);
214 # suggested by asuffield and \broken.
215 if ($args =~ /^["']/ and $args =~ /["']$/) {
216 &DEBUG('list*: removed quotes.');
217 $args =~ s/^["']|["']$//g;
220 if (length $args < 2 && &IsFlag('o') ne 'o') {
221 &msg($who, 'search string is too short.');
225 &Forker('Search', sub { &Search::Search($thiscmd, $args); } );
227 $cmdstats{'Factoid Search'}++;
231 # Nickometer. Adam Spiers++
232 if ($message =~ /^(?:lame|nick)ometer(?: for)? (\S+)/i) {
233 return unless (&IsChanConfOrWarn("nickometer"));
235 my $term = (lc $1 eq 'me') ? $who : $1;
237 &loadMyModule('nickometer');
239 if ($term =~ /^$mask{chan}$/) {
240 &status("Doing nickometer for chan $term.");
242 if (!&validChan($term)) {
243 &msg($who, "error: channel is invalid.");
249 foreach (keys %{ $channels{lc $term}{''} }) {
252 &WARN("nickometer: nick in chan $term undefined?");
256 my $value = &nickometer($str);
257 $nickometer{$value}{$str} = 1;
261 ### TODO: compact with map?
263 foreach (sort {$b <=> $a} keys %nickometer) {
264 my $str = join(", ", sort keys %{ $nickometer{$_} });
265 push(@list, "$str ($_%)");
268 &performStrictReply( &formListReply(0, "Nickometer list for $term ", @list) );
274 my $percentage = &nickometer($term);
276 if ($percentage =~ /NaN/) {
277 $percentage = "off the scale";
279 $percentage = sprintf("%0.4f", $percentage);
280 $percentage =~ s/(\.\d+)0+$/$1/;
284 if ($msgType eq 'public') {
285 &say("'$term' is $percentage lame, $who");
287 &msg($who, "the 'lame nick-o-meter' reading for $term is $percentage, $who");
293 # Topic management. xk++
294 # may want to add a userflags for topic. -xk
295 if ($message =~ /^topic(\s+(.*))?$/i) {
296 return unless (&IsChanConfOrWarn('Topic'));
298 my $chan = $talkchannel;
299 my @args = split / /, $2 || "";
302 &msg($who,"Try 'help topic'");
306 $chan = lc(shift @args) if ($msgType eq 'private');
307 my $thiscmd = shift @args;
310 if ($msgType eq 'public' && $thiscmd =~ /^#/) {
311 &msg($who, "error: channel argument is not required.");
312 &msg($who, "\002Usage\002: topic <CMD>");
316 # topic over private:
317 if ($msgType eq 'private' && $chan !~ /^#/) {
318 &msg($who, "error: channel argument is required.");
319 &msg($who, "\002Usage\002: topic #channel <CMD>");
323 if (&validChan($chan) == 0) {
324 &msg($who,"error: invalid channel \002$chan\002");
328 # for semi-outsiders.
329 if (!&IsNickInChan($who,$chan)) {
330 &msg($who, "Failed. You ($who) are not in $chan, hey?");
335 &loadMyModule('Topic');
336 &Topic($chan, $thiscmd, join(' ', @args));
337 $cmdstats{'Topic'}++;
342 if ($message =~ /^wingate$/i) {
343 return unless (&IsChanConfOrWarn('Wingate'));
345 my $reply = "Wingate statistics: scanned \002"
346 .scalar(keys %wingateToDo)."\002 hosts";
347 my $queue = scalar(keys %wingateToDo);
349 $reply .= ". I have \002$queue\002 hosts in the queue";
350 $reply .= ". Started the scan ".&Time2String(time() - $wingaterun)." ago";
353 &performStrictReply("$reply.");
358 # do nothing and let the other routines have a go
365 &msg($who, "- Uptime for $ident -");
366 &msg($who, "Now: ". &Time2String(&uptimeNow()) ." running $bot_version");
368 foreach (&uptimeGetInfo()) {
370 my $time = &Time2String($1);
373 &msg($who, "$count: $time $2");
380 my($person) = lc shift;
383 if (!defined $person or $person =~ /^$/) {
386 my $i = &countKeys("seen");
387 &msg($who,"there ". &fixPlural("is",$i) ." \002$i\002 ".
388 "seen ". &fixPlural("entry",$i) ." that I know of.");
395 &seenFlush(); # very evil hack. oh well, better safe than sorry.
397 # TODO: convert to &sqlSelectRowHash();
398 my $select = "nick,time,channel,host,message";
399 if ($person eq "random") {
400 @seen = &randKey("seen", $select);
402 @seen = &sqlSelect("seen", $select, { nick => $person } );
405 if (scalar @seen < 2) {
407 &DEBUG("seen: _ => '$_'.");
409 &performReply("i haven't seen '$person'");
415 ### TODO: multi channel support. may require &IsNick() to return
416 ### all channels or something.
418 my @chans = &getNickInChans($seen[0]);
420 $reply = "$seen[0] is currently on";
424 next unless (exists $userstats{lc $seen[0]}{'Join'});
425 $reply .= " (".&Time2String(time() - $userstats{lc $seen[0]}{'Join'}).")";
428 if (&IsChanConf("seenStats") > 0) {
430 $i = $userstats{lc $seen[0]}{'Count'};
431 $reply .= ". Has said a total of \002$i\002 messages" if (defined $i);
432 $i = $userstats{lc $seen[0]}{'Time'};
433 $reply .= ". Is idling for ".&Time2String(time() - $i) if (defined $i);
436 my $howlong = &Time2String(time() - $seen[1]);
437 $reply = "$seen[0] <$seen[3]> was last seen on IRC ".
438 "in channel $seen[2], $howlong ago, ".
439 "saying\002:\002 '$seen[4]'.";
442 &performStrictReply($reply);
446 # User Information Services. requested by Flugh.
448 my ($arg) = join(' ',@_);
450 if ($arg =~ /^set(\s+(.*))?$/i) {
453 &help('userinfo set');
457 &UserInfoSet(split /\s+/, $arg, 2);
458 } elsif ($arg =~ /^unset(\s+(.*))?$/i) {
461 &help('userinfo unset');
465 &UserInfoSet($arg, '');
471 # cookie (random). xk++
475 # lets find that secret cookie.
476 my $target = ($msgType ne 'public') ? $who : $talkchannel;
477 my $cookiemsg = &getRandom(keys %{ $lang{'cookie'} });
480 ### WILL CHEW TONS OF MEM.
481 ### TODO: convert this to a Forker function!
483 my @list = &searchTable("factoids", "factoid_key", "factoid_value", $arg);
484 $key = &getRandom(@list);
485 $value = &getFactInfo($key, "factoid_value");
487 ($key,$value) = &randKey("factoids","factoid_key,factoid_value");
491 s/##KEY/\002$key\002/;
494 s/\$who/$who/; # cheap fix.
495 s/(\S+)?\s*<\S+>/$1 /;
499 if ($cookiemsg =~ s/^ACTION //i) {
500 &action($target, $cookiemsg);
502 &msg($target, $cookiemsg);
507 my $arg = join(' ',@_);
508 my ($from,$to) = ('','');
510 ($from,$to) = ($1,$2) if ($arg =~ /^(.*?) to (.*)$/i);
511 ($from,$to) = ($2,$1) if ($arg =~ /^(.*?) from (.*)$/i);
513 if (!$to or !$from) {
514 &msg($who, "Invalid format!");
519 &Units::convertUnits($from, $to);
525 my ($target) = &fixString($_[0]);
527 my $chan = $talkchannel;
530 if ($msgType eq 'private') {
531 if ($target =~ /^($mask{chan})\s+(.*)$/) {
536 &msg($who, "error: invalid format or missing arguments.");
541 if ($target =~ /^(.*)(\s+for\s+.*)$/) {
546 my $line = &getRandomLineFromFile($bot_data_dir. "/blootbot.lart");
548 if ($target =~ /^(me|you|itself|\Q$ident\E)$/i) {
549 $line =~ s/WHO/$who/g;
551 $line =~ s/WHO/$target/g;
553 $line .= $for if ($for);
554 $line .= ", courtesy of $who" if ($extra);
556 &action($chan, $line);
558 &status("lart: error reading file?");
563 my $idx = "debian/Packages-sid.idx";
568 $error++ unless ( -e $idx);
569 $error++ unless ( -e "$idx-old");
572 $error = "no sid/sid-old index file found.";
573 &ERROR("Debian: $error");
579 open(IDX2, "$idx-old");
593 next if (exists $pkg{$_});
599 &::performStrictReply( &::formListReply(0, "New debian packages:", @new) );
605 if (!defined $chan) {
610 if (!&validChan($chan)) {
611 &msg($who, "chan $chan is invalid.");
615 if (scalar @vernick > scalar(keys %{ $channels{lc $chan}{''} })/4) {
616 &msg($who, "verstats already in progress for someone else.");
620 &msg($who, "Sending CTCP VERSION to $chan; results in 60s.");
621 $conn->ctcp("VERSION", $chan);
622 $cache{verstats}{chan} = $chan;
623 $cache{verstats}{who} = $who;
624 $cache{verstats}{msgType} = $msgType;
626 $conn->schedule(30, sub {
627 my $c = lc $cache{verstats}{chan};
630 foreach (keys %{ $channels{$c}{''} } ) {
631 next if (grep /^\Q$_\E$/i, @vernick);
632 push(@vernicktodo, $_);
638 $conn->schedule(60, sub {
640 my $c = lc $cache{verstats}{chan};
641 my $total = keys %{ $channels{$c}{''} };
643 $who = $cache{verstats}{who};
644 $msgType = $cache{verstats}{msgType};
645 delete $cache{verstats}; # sufficient?
647 foreach (keys %ver) {
648 $vtotal += scalar keys %{ $ver{$_} };
652 my $unknown = $total - $vtotal;
653 my $perc = sprintf("%.1f", $unknown * 100 / $total);
655 $sorted{$perc}{"unknown/cloak"} = "$unknown ($perc%)" if ($unknown);
657 foreach (keys %ver) {
658 my $count = scalar keys %{ $ver{$_} };
659 $perc = sprintf("%.01f", $count * 100 / $total);
660 $perc =~ s/.0$//; # lame compression.
662 $sorted{$perc}{$_} = "$count ($perc%)";
665 ### can be compressed to a map?
667 foreach ( sort { $b <=> $a } keys %sorted ) {
669 foreach (sort keys %{ $sorted{$perc} }) {
670 push(@list, "$_ - $sorted{$perc}{$_}");
674 # hack. this is one major downside to scheduling.
676 &performStrictReply( &formListReply(0, "IRC Client versions for $c ", @list) );
678 # clean up not-needed data structures.
688 last unless (scalar @vernicktodo);
690 my $n = shift(@vernicktodo);
691 $conn->ctcp("VERSION", $n);
694 return unless (scalar @vernicktodo);
696 $conn->schedule(3, \&verstats_flush() );
699 sub do_text_counters {
701 $itc =~ s/([^\w\s])/\\$1/g;
702 my $z = join '|', split ' ', $itc;
704 if ($msgType eq "privmsg" and $message =~ / ($mask{chan})$/) {
705 &DEBUG("ircTC: privmsg detected; chan = $1");
709 if ($message =~ /^_stats(\s+(\S+))$/i) {
715 if ($message =~ /^($z)stats(\s+(\S+))?$/i) {
722 # even more uglier with channel/time arguments.
724 # my $c = $chan || "PRIVATE";
725 my $where = "type=".&sqlQuote($type);
728 $where .= " AND channel=".&sqlQuote($c) if (defined $c);
730 &DEBUG("not using chan arg");
733 my $sum = (&sqlRawReturn("SELECT SUM(counter) FROM stats"
734 ." WHERE ".$where ))[0];
736 if (!defined $arg or $arg =~ /^\s*$/) {
739 # TODO: convert $where to hash
740 my %hash = &sqlSelectColHash("stats", "nick,counter",
742 $where." ORDER BY counter DESC LIMIT 3", 1
747 # unfortunately we have to sort it again!
749 foreach $i (sort { $b <=> $a } keys %hash) {
750 foreach (keys %{ $hash{$i} }) {
751 my $p = sprintf("%.01f", 100*$i/$sum);
753 push(@top, "\002$_\002 -- $i ($p%)");
758 $topstr = ". Top ".scalar(@top).": ".join(', ', @top);
762 &performStrictReply("total count of \037$type\037 on \002$c\002: $sum$topstr");
764 &performStrictReply("zero counter for \037$type\037.");
767 # TODO: convert $where to hash and use a sqlSelect
768 my $x = (&sqlRawReturn("SELECT SUM(counter) FROM stats".
769 " WHERE $where AND nick=".&sqlQuote($arg) ))[0];
771 if (!defined $x) { # !defined.
772 &performStrictReply("$arg has not said $type yet.");
777 # TODO: convert $where to hash
778 my @array = &sqlSelect("stats", "nick", undef,
779 $where." ORDER BY counter", 1
783 for ($i=0; $i<scalar @array; $i++) {
784 next unless ($array[0] =~ /^\Q$who\E$/);
790 my $total = scalar(@array);
792 if ($total and $good) {
793 my $pct = sprintf("%.01f", 100*(1+$total-$i)/$total);
794 $xtra = ", ranked $i\002/\002$total (percentile: \002$pct\002 %)";
797 my $pct1 = sprintf("%.01f", 100*$x/$sum);
798 &performStrictReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra");
807 # even more uglier with channel/time arguments.
809 # my $c = $chan || "PRIVATE";
810 &DEBUG("not using chan arg") if (!defined $c);
812 # example of converting from RawReturn to sqlSelect.
813 my $where_href = (defined $c) ? { channel => $c } : "";
814 my $sum = &sqlSelect("stats", "SUM(counter)", $where_href);
816 if (!defined $arg or $arg =~ /^\s*$/) {
818 &DEBUG("_stats: !arg");
820 my %hash = &sqlSelectColHash("stats", "nick,counter",
822 " ORDER BY counter DESC LIMIT 3", 1
827 # unfortunately we have to sort it again!
829 foreach $i (sort { $b <=> $a } keys %hash) {
830 foreach (keys %{ $hash{$i} }) {
831 my $p = sprintf("%.01f", 100*$i/$sum);
833 push(@top, "\002$_\002 -- $i ($p%)");
839 $topstr = ". Top ".scalar(@top).": ".join(', ', @top);
843 &performStrictReply("total count of \037$type\037 on \002$c\002: $sum$topstr");
845 &performStrictReply("zero counter for \037$type\037.");
851 # TODO: add nick to where_href
852 my %hash = &sqlSelectColHash("stats", "type,counter",
853 $where_href, " AND nick=".&sqlQuote($arg)
856 # this is totally messed up... needs to be fixed... and cleaned up.
862 foreach (keys %hash) {
863 &DEBUG("_stats: hash{$_} => $hash{$_}");
865 # TODO: convert $where to hash
867 my @array = &sqlSelect("stats", "nick", undef, $where." ORDER BY counter", 1);
870 for(my $i=0; $i<scalar @array; $i++) {
871 next unless ($array[0] =~ /^\Q$who\E$/);
877 $total = scalar(@array);
878 &DEBUG(" i => $i, good => $good, total => $total");
879 $x .= " ".$total."blah blah";
884 if (!defined $x) { # !defined.
885 &performStrictReply("$arg has not said $type yet.");
890 if ($total and $good) {
891 my $pct = sprintf("%.01f", 100*(1+$total-$ii)/$total);
892 $xtra = ", ranked $ii\002/\002$total (percentile: \002$pct\002 %)";
895 my $pct1 = sprintf("%.01f", 100*$x/$sum);
896 &performStrictReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra");
901 return unless (defined $arg);
903 #foreach (`$arg`) { &msg($who,$_); }
908 ### START ADDING HOOKS.
910 &addCmdHook('chan(stats|info)', ('CODEREF' => 'chaninfo', ) );
911 &addCmdHook('cmd(stats|info)', ('CODEREF' => 'cmdstats', ) );
912 &addCmdHook('sched(stats|info)', ('CODEREF' => 'scheduleList', ) );
913 &addCmdHook('factinfo', ('CODEREF' => 'factinfo',
914 'Cmdstats' => 'Factoid Info', Module => 'Factoids', ) );
915 &addCmdHook('factstats?', ('CODEREF' => 'factstats',
916 'Cmdstats' => 'Factoid Stats', Help => "factstats",
917 Forker => 1, 'Identifier' => 'Factoids', ) );
918 &addCmdHook('help', ('CODEREF' => 'help',
919 'Cmdstats' => 'Help', ) );
920 &addCmdHook('karma', ('CODEREF' => 'karma', ) );
921 &addCmdHook('tell|explain', ('CODEREF' => 'tell',
922 Help => 'tell', Identifier => 'allowTelling',
923 Cmdstats => 'Tell') );
924 &addCmdHook('News', ('CODEREF' => 'News::Parse',
925 Module => 'News', 'Cmdstats' => 'News' ) );
926 &addCmdHook('countrystats', ('CODEREF' => 'countryStats',
930 &addCmdHook('d?bugs', ('CODEREF' => 'DebianExtra::Parse',
931 'Forker' => 1, 'Identifier' => 'DebianExtra',
932 'Cmdstats' => 'Debian Bugs') );
933 &addCmdHook('dauthor', ('CODEREF' => 'Debian::searchAuthor',
934 'Forker' => 1, 'Identifier' => 'Debian',
935 'Cmdstats' => 'Debian Author Search', 'Help' => "dauthor" ) );
936 &addCmdHook('(d|search)desc', ('CODEREF' => 'Debian::searchDescFE',
937 'Forker' => 1, 'Identifier' => 'Debian',
938 'Cmdstats' => 'Debian Desc Search', 'Help' => "ddesc" ) );
939 &addCmdHook('dnew', ('CODEREF' => 'DebianNew',
940 'Identifier' => 'Debian' ) );
941 &addCmdHook('dincoming', ('CODEREF' => 'Debian::generateIncoming',
942 'Forker' => 1, 'Identifier' => 'Debian' ) );
943 &addCmdHook('dstats', ('CODEREF' => 'Debian::infoStats',
944 'Forker' => 1, 'Identifier' => 'Debian',
945 'Cmdstats' => 'Debian Statistics' ) );
946 &addCmdHook('d?contents', ('CODEREF' => 'Debian::searchContents',
947 'Forker' => 1, 'Identifier' => 'Debian',
948 'Cmdstats' => 'Debian Contents Search', 'Help' => "contents" ) );
949 &addCmdHook('d?find', ('CODEREF' => 'Debian::DebianFind',
950 'Forker' => 1, 'Identifier' => 'Debian',
951 'Cmdstats' => 'Debian Search', 'Help' => "find" ) );
952 &addCmdHook('insult', ('CODEREF' => 'Insult::Insult',
953 'Forker' => 1, 'Identifier' => 'insult', 'Help' => "insult" ) );
954 &addCmdHook('kernel', ('CODEREF' => 'Kernel::Kernel',
955 'Forker' => 1, 'Identifier' => 'Kernel',
956 'Cmdstats' => 'Kernel', 'NoArgs' => 1) );
957 &addCmdHook('listauth', ('CODEREF' => 'CmdListAuth',
958 'Identifier' => 'Search', Module => 'Factoids',
959 'Help' => 'listauth') );
960 &addCmdHook('quote', ('CODEREF' => 'Quote::Quote',
961 'Forker' => 1, 'Identifier' => 'Quote',
962 'Help' => 'quote', 'Cmdstats' => 'Quote') );
963 &addCmdHook('countdown', ('CODEREF' => 'countdown',
964 'Module' => 'countdown', 'Identifier' => 'countdown',
965 'Cmdstats' => 'countdown') );
966 &addCmdHook('lart', ('CODEREF' => 'lart',
967 'Identifier' => 'lart', 'Help' => 'lart') );
968 &addCmdHook('convert', ('CODEREF' => 'convert',
969 'Forker' => 1, 'Identifier' => 'Units',
970 'Help' => 'convert') );
971 &addCmdHook('(cookie|random)', ('CODEREF' => 'cookie',
972 'Forker' => 1, 'Identifier' => 'Factoids') );
973 &addCmdHook('u(ser)?info', ('CODEREF' => 'userinfo',
974 'Identifier' => 'UserInfo', 'Help' => 'userinfo',
975 'Module' => 'UserInfo') );
976 &addCmdHook('RootWarn', ('CODEREF' => 'CmdrootWarn',
977 'Identifier' => 'RootWarn', 'Module' => 'RootWarn') );
978 &addCmdHook('seen', ('CODEREF' => 'seen', 'Identifier' =>
980 &addCmdHook('Dict', ('CODEREF' => 'Dict::Dict',
981 'Identifier' => 'Dict', 'Help' => 'dict',
982 'Forker' => 1, 'Cmdstats' => 'Dict') );
983 &addCmdHook('slashdot', ('CODEREF' => 'Slashdot::Slashdot',
984 'Identifier' => 'slashdot', 'Forker' => 1,
985 'Cmdstats' => 'slashdot') );
986 &addCmdHook('Plug', ('CODEREF' => 'Plug::Plug',
987 'Identifier' => 'Plug', 'Forker' => 1,
988 'Cmdstats' => 'Plug') );
989 &addCmdHook('Uptime', ('CODEREF' => 'uptime', 'Identifier' => 'Uptime',
990 'Cmdstats' => 'Uptime') );
991 &addCmdHook('nullski', ('CODEREF' => 'nullski', ) );
992 &addCmdHook('verstats', ('CODEREF' => 'do_verstats' ) );
993 &addCmdHook('Weather', ('CODEREF' => 'Weather::Weather',
994 'Identifier' => 'Weather', 'Help' => 'weather',
995 'Cmdstats' => 'Weather', 'Forker' => 1) );
996 &addCmdHook('metar', ('CODEREF' => 'Weather::Metar',
997 'Identifier' => 'Weather', 'Help' => 'weather',
998 'Cmdstats' => 'Weather', 'Forker' => 1) );
999 &addCmdHook('bzflist', ('CODEREF' => 'BZFlag::list',
1000 'Identifier' => 'BZFlag', 'Cmdstats' => 'BZFlag',
1002 &addCmdHook('bzflist17', ('CODEREF' => 'BZFlag::list17',
1003 'Identifier' => 'BZFlag', 'Cmdstats' => 'BZFlag',
1005 &addCmdHook('bzfquery', ('CODEREF' => 'BZFlag::query',
1006 'Identifier' => 'BZFlag', 'Cmdstats' => 'BZFlag',
1008 &addCmdHook('zfi', ('CODEREF' => 'zfi::query',
1009 'Identifier' => 'zfi', 'Cmdstats' => 'zfi',
1011 &addCmdHook('(zippy|yow)', ('CODEREF' => 'zippy::get',
1012 'Identifier' => 'Zippy', 'Cmdstats' => 'Zippy',
1014 &addCmdHook('zsi', ('CODEREF' => 'zsi::query',
1015 'Identifier' => 'zsi', 'Cmdstats' => 'zsi',
1017 &addCmdHook('(ex)?change', ('CODEREF' => 'Exchange::query',
1018 'Identifier' => 'Exchange', 'Cmdstats' => 'Exchange',
1020 &addCmdHook('(botmail|message)', ('CODEREF' => 'botmail::parse',
1021 'Identifier' => 'botmail', 'Cmdstats' => 'botmail') );
1022 &addCmdHook('HTTPDtype', ('CODEREF' => 'HTTPDtype::HTTPDtype',
1023 'Identifier' => 'HTTPDtype', 'Cmdstats' => 'HTTPDtype',
1025 &addCmdHook('scramble', ('CODEREF' => 'scramble::scramble',
1026 'Identifier' => 'scramble', 'Cmdstats' => 'scramble',
1027 'Forker' => 1, 'Module' => 'scramble') );
1028 &addCmdHook('md5(sum)?', ('CODEREF' => 'md5::md5',
1029 'Identifier' => 'md5', 'Cmdstats' => 'md5',
1031 &addCmdHook('Rss', ('CODEREF' => 'Rss::Rss',
1032 'Identifier' => 'Rss', 'Cmdstats' => 'Rss',
1033 'Forker' => 1, 'Help' => 'rss') );
1034 &addCmdHook('wiki(pedia)?', ('CODEREF' => 'wikipedia::wikipedia',
1035 'Identifier' => 'wikipedia', 'Cmdstats' => 'wikipedia',
1036 'Forker' => 1, 'Help' => 'wikipedia') );
1037 &addCmdHook('page', ('CODEREF' => 'pager::page',
1038 'Identifier' => 'pager', 'Cmdstats' => 'pager',
1039 'Forker' => 1, 'Help' => 'page') );
1040 &addCmdHook('(babel(fish)?|x|xlate|translate)', ('CODEREF' => 'babelfish::babelfish',
1041 'Identifier' => 'babelfish', 'Cmdstats' => 'babelfish',
1042 'Forker' => 1, 'Help' => 'babelfish', 'Module' => 'babelfish') );
1043 &addCmdHook('wtf', ('CODEREF' => 'wtf::query',
1044 'Identifier' => 'wtf', 'Cmdstats' => 'wtf',
1045 'Forker' => 1, 'Help' => 'wtf') );
1046 &addCmdHook('[ia]?spell', ('CODEREF' => 'spell::query',
1047 'Identifier' => 'spell', 'Cmdstats' => 'spell',
1048 'Forker' => 1, 'Help' => 'spell') );
1049 &addCmdHook('dns|d?nslookup', ('CODEREF' => 'dns::query',
1050 'Identifier' => 'dns', 'Cmdstats' => 'dns',
1051 'Forker' => 1, 'Help' => 'dns') );
1052 &addCmdHook('piglatin', ('CODEREF' => 'piglatin::piglatin',
1053 'Identifier' => 'piglatin', 'Cmdstats' => 'piglatin',
1056 ### END OF ADDING HOOKS.
1058 &status("CMD: loaded ".scalar(keys %cmdhooks)." command hooks.");