]> git.donarmstrong.com Git - infobot.git/blob - src/UserExtra.pl
- commandstubs: cmd or ident could be null - semi fix.
[infobot.git] / src / UserExtra.pl
1 #
2 # UserExtra.pl: User Commands, Public.
3 #       Author: dms
4 #      Version: v0.2b (20000707)
5 #      Created: 20000107
6 #
7
8 if (&IsParam("useStrict")) { use strict; }
9
10 use vars qw($message $arg $qWord $verb $lobotomized);
11 use vars qw(%channels %chanstats %cmdstats);
12
13 ###
14 ### Start of command hooks for UserExtra.
15 ###
16
17 &addCmdHook("main", 'chan(stats|info)', ('CODEREF' => 'chaninfo', ) );
18 &addCmdHook("main", 'cmd(stats|info)', ('CODEREF' => 'cmdstats', ) );
19 &addCmdHook("main", 'factinfo', ('CODEREF' => 'factinfo', 
20         'Cmdstats' => 'Factoid Info', Module => 'factoids', ) );
21 &addCmdHook("main", 'factstats?', ('CODEREF' => 'factstats', 
22         'Cmdstats' => 'Factoid Statistics', Help => "factstats", 
23         Forker => 1, 'Identifier' => 'factoids', ) );
24 &addCmdHook("main", 'help', ('CODEREF' => 'help', 
25         'Cmdstats' => 'Help', ) );
26 &addCmdHook("main", 'karma', ('CODEREF' => 'karma', ) );
27 &addCmdHook("main", 'i?spell', ('CODEREF' => 'ispell', 
28         Help => 'spell', Identifier => 'spell', ) );
29 &addCmdHook("main", 'd?nslookup', ('CODEREF' => 'DNS', 
30         Help => 'nslookup', Identifier => 'allowDNS',
31         Forker => "NULL", ) );
32 &addCmdHook("main", 'tell|explain', ('CODEREF' => 'tell', 
33         Help => 'tell', Identifier => 'allowTelling',
34         Cmdstats => 'Tell') );
35 &addCmdHook("main", 'news', ('CODEREF' => 'News::Parse', 
36         Module => 'news', 'Cmdstats' => 'News',
37         Identifier => 'news' ) );
38 &addCmdHook("main", 'countrystats', ('CODEREF' => 'countryStats', 
39 #       Forker => "NULL",
40  ) );
41
42 &status("CMD: loaded ".scalar(keys %hooks_main)." MAIN command hooks.");
43
44 ###
45 ### Start of commands for hooks.
46 ###
47
48 sub chaninfo {
49     my $chan = lc shift(@_);
50     my $mode;
51
52     if ($chan eq "") {          # all channels.
53         my $i           = keys %channels;
54         my $reply       = "i am on \002$i\002 ".&fixPlural("channel",$i);
55         my $tucount     = 0;    # total user count.
56         my $uucount     = 0;    # unique user count.
57         my @array;
58
59         ### line 1.
60         foreach (sort keys %channels) {
61             if (/^\s*$/ or / /) {
62                 &status("chanstats: fe channels: chan == NULL.");
63                 &ircCheck();
64                 next;
65             }
66             push(@array, "$_ (".scalar(keys %{ $channels{$_}{''} }).")");
67         }
68         &pSReply($reply.": ".join(' ', @array));
69
70         ### total user count.
71         foreach $chan (keys %channels) {
72             $tucount += scalar(keys %{ $channels{$chan}{''} });
73         }
74
75         ### unique user count.
76         my @nicks;
77         foreach $chan (keys %channels) {
78             foreach (keys %{ $channels{$chan}{''} }) {
79                 next if (grep /^\Q$_\E$/, @nicks);
80                 $uucount++;
81                 push(@nicks, $_);
82             }
83         }
84         &DEBUG("nicks => '".scalar(@nicks)."'...");
85         if (scalar @nicks != $uucount) {
86             &DEBUG("nicks != uucount...");
87         }
88
89         my $chans = scalar(keys %channels);
90         &pSReply(
91             "i've cached \002$tucount\002 ". &fixPlural("user",$tucount).
92             ", \002$uucount\002 unique ". &fixPlural("user",$uucount).
93             ", distributed over \002$chans\002 ".
94             &fixPlural("channel", $chans)."."
95         );
96
97         return;
98     }
99
100     # channel specific.
101
102     if (&validChan($chan) == 0) {
103         &msg($who,"error: invalid channel \002$chan\002");
104         return;
105     }
106
107     # Step 1:
108     my @array;
109     foreach (sort keys %{ $chanstats{$chan} }) {
110         my $int = $chanstats{$chan}{$_};
111         next unless ($int);
112
113         push(@array, "\002$int\002 ". &fixPlural($_,$int));
114     }
115     my $reply = "On \002$chan\002, there ".
116                 &fixPlural("has",scalar(@array)). " been ".
117                 &IJoin(@array);
118
119     # Step 1b: check channel inconstencies.
120     $chanstats{$chan}{'Join'}           ||= 0;
121     $chanstats{$chan}{'SignOff'}        ||= 0;
122     $chanstats{$chan}{'Part'}           ||= 0;
123
124     my $delta_stats = $chanstats{$chan}{'Join'}
125                 - $chanstats{$chan}{'SignOff'}
126                 - $chanstats{$chan}{'Part'};
127
128     if ($delta_stats) {
129         my $total = scalar(keys %{ $channels{$chan}{''} });
130         &status("chaninfo: join ~= signoff + part (drift of $delta_stats < $total).");
131
132         if ($delta_stats > $total) {
133             &ERROR("chaninfo: delta_stats exceeds total users.");
134         }
135     }
136
137     # Step 2:
138     undef @array;
139     my $type;
140     foreach ("v","o","") {
141         my $int = scalar(keys %{ $channels{$chan}{$_} });
142         next unless ($int);
143
144         $type = "Voice" if ($_ eq "v");
145         $type = "Opped" if ($_ eq "o");
146         $type = "Total" if ($_ eq "");
147
148         push(@array,"\002$int\002 $type");
149     }
150     $reply .= ".  At the moment, ". &IJoin(@array);
151
152     # Step 3:
153     my %new;
154     foreach (keys %userstats) {
155         next unless (exists $userstats{$_}{'Count'});
156         if ($userstats{$_}{'Count'} =~ /^\D+$/) {
157             &WARN("userstats{$_}{Count} is non-digit.");
158             next;
159         }
160
161         $new{$_} = $userstats{$_}{'Count'};
162     }
163
164     my($count) = (sort { $a <=> $b } keys %new)[0];
165     if ($count) {
166         $reply .= ".  \002$count\002 has said the most with a total of \002$new{$count}\002 messages";
167     }
168     &pSReply("$reply.");
169 }
170
171 # Command statistics.
172 sub cmdstats {
173     my @array;
174
175     if (!scalar(keys %cmdstats)) {
176         &performReply("no-one has run any commands yet");
177         return;
178     }
179
180     my %countstats;
181     foreach (keys %cmdstats) {
182         $countstats{ $cmdstats{$_} }{$_} = 1;
183     }
184
185     foreach (sort {$b <=> $a} keys %countstats) {
186         my $int = $_;
187         next unless ($int);
188
189         foreach (keys %{ $countstats{$int} }) {
190             push(@array, "\002$int\002 of $_");
191         }
192     }
193     &pSReply("command usage include ". &IJoin(@array).".");
194 }
195
196 # Factoid extension info. xk++
197 sub factinfo {
198     my $faqtoid = lc shift(@_);
199     my $query   = "";
200
201     if ($faqtoid =~ /^\-(\S+)(\s+(.*))$/) {
202         &msg($who,"error: individual factoid info queries not supported as yet.");
203         &msg($who,"it's possible that the factoid mistakenly begins with '-'.");
204         return;
205
206         $query   = lc $1;
207         $faqtoid = lc $3;
208     }
209
210     &CmdFactInfo($faqtoid, $query);
211 }
212
213 sub factstats {
214     my $type = shift(@_);
215
216     &Forker("factoids", sub {
217         &pSReply( &CmdFactStats($type) );
218     } );
219 }
220
221 sub karma {
222     my $target  = lc( shift || $who );
223     my $karma   = &dbGet("stats", "counter", "nick='$target' and type='karma'") || 0;
224
225     if ($karma != 0) {
226         &pSReply("$target has karma of $karma");
227     } else {
228         &pSReply("$target has neutral karma");
229     }
230 }
231
232 sub ispell {
233     my $query = shift;
234
235     if (! -x "/usr/bin/spell") {
236         &msg($who, "no binary found.");
237         return;
238     }
239
240     if (!&validExec($query)) {
241         &msg($who,"argument appears to be fuzzy.");
242         return;
243     }
244
245     my $reply = "I can't find alternate spellings for '$query'";
246
247     foreach (`/bin/echo '$query' | /usr/bin/ispell -a -S`) {
248         chop;
249         last if !length;                # end of query.
250
251         if (/^\@/) {            # intro line.
252             next;
253         } elsif (/^\*/) {               # possibly correct.
254             $reply = "'$query' may be spelled correctly";
255             last;
256         } elsif (/^\&/) {               # possible correction(s).
257             s/^\& (\S+) \d+ \d+: //;
258             my @array = split(/,? /);
259
260             $reply = "possible spellings for $query: @array";
261             last;
262         } elsif (/^\+/) {
263             &DEBUG("spell: '+' found => '$_'.");
264             last;
265         } else {
266             &DEBUG("spell: unknown: '$_'.");
267         }
268     }
269
270     &pSReply($reply);
271 }
272
273 sub nslookup {
274     my $query = shift;
275     &status("DNS Lookup: $query");
276     &DNS($query);
277 }
278
279 sub tell {
280     my $args = shift;
281     my ($target, $tell_obj) = ('','');
282     my $dont_tell_me    = 0;
283     my $reply;
284
285     ### is this fixed elsewhere?
286     $args =~ s/\s+/ /g;         # fix up spaces.
287     $args =~ s/^\s+|\s+$//g;    # again.
288
289     # this one catches most of them
290     if ($args =~ /^(\S+) (-?)about (.*)$/i) {
291         $target         = lc $1;
292         $tell_obj       = $3;
293         $dont_tell_me   = ($2) ? 1 : 0;
294
295         $tell_obj       = $who  if ($tell_obj =~ /^(me|myself)$/i);
296         $query          = $tell_obj;
297     } elsif ($args =~ /^(\S+) where (\S+) can (\S+) (.*)$/i) {
298         # i'm sure this could all be nicely collapsed
299         $target         = lc $1;
300         $tell_obj       = $4;
301         $query          = $tell_obj;
302
303     } elsif ($args =~ /^(\S+) (what|where) (.*?) (is|are)[.?!]*$/i) {
304         $target         = lc $1;
305         $qWord          = $2;
306         $tell_obj       = $3;
307         $verb           = $4;
308         $query          = "$qWord $verb $tell_obj";
309
310     } elsif ($args =~ /^(.*?) to (\S+)$/i) {
311         $target         = lc $3;
312         $tell_obj       = $2;
313         $query          = $tell_obj;
314     }
315
316     # check target type. Deny channel targets.
317     if ($target !~ /^$mask{nick}$/ or $target =~ /^$mask{chan}$/) {
318         &msg($who,"No, $who, I won't. (target invalid?)");
319         return;
320     }
321
322     $target     = $talkchannel  if ($target =~ /^us$/i);
323     $target     = $who          if ($target =~ /^(me|myself)$/i);
324
325     &status("tell: target = $target, query = $query");  
326
327     # "intrusive".
328 #    if ($target !~ /^$mask{chan}$/ and !&IsNickInAnyChan($target)) {
329 #       &msg($who, "No, $target is not in any of my chans.");
330 #       return;
331 #    }
332
333     # self.
334     if ($target eq $ident) {    # lc?
335         &msg($who, "Isn't that a bit silly?");
336         return;
337     }
338
339     my $oldwho          = $who;
340     my $oldmtype        = $msgType;
341     $who                = $target;
342     my $result = &doQuestion($tell_obj);
343         # ^ returns '0' if nothing was found.
344     $who                = $oldwho;
345
346     # no such factoid.
347     if ($result =~ /^0?$/) {
348         $who            = $target;
349         $msgType        = "private";
350
351         # support command redirection.
352         # recursive cmdHooks aswell :)
353         my $done = 0;
354         $done++ if &parseCmdHook("main", $tell_obj);
355         $done++ if &parseCmdHook("extra", $tell_obj);
356         $message        = $tell_obj;
357         $done++ unless (&Modules());
358
359         &VERB("teel: setting old values of who and msgType.",2);
360         $who            = $oldwho;
361         $msgType        = $oldmtype;
362
363         if ($done) {
364             &msg($who, "told $target about CMD '$tell_obj'");
365         } else {
366             &msg($who, "i dunno what is '$tell_obj'.");
367         }
368
369         return;
370     }
371
372     # success.
373     &status("tell: <$who> telling $target about $tell_obj.");
374     if ($who ne $target) {
375         if ($dont_tell_me) {
376             &msg($who, "told $target about $tell_obj.");
377         } else {
378             &msg($who, "told $target about $tell_obj ($result)");
379         }
380
381         $reply = "$who wants you to know: $result";
382     } else {
383         $reply = "telling yourself: $result";
384     }
385
386     &msg($target, $reply);
387 }
388
389 sub DNS {
390     my $dns = shift;
391     my($match, $x, $y, $result);
392     my $pid;
393
394     if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) {
395         &status("DNS query by IP address: $in");
396         $match = $1;
397
398         $y = pack('C4', split(/\./, $match));
399         $x = (gethostbyaddr($y, &AF_INET));
400
401         if ($x !~ /^\s*$/) {
402             $result = $match." is ".$x unless ($x =~ /^\s*$/);
403         } else {
404             $result = "I can't seem to find that address in DNS";
405         }
406
407     } else {
408
409         &status("DNS query by name: $in");
410         $x = join('.',unpack('C4',(gethostbyname($in))[4]));
411
412         if ($x !~ /^\s*$/) {
413             $result = $in." is ".$x;
414         } else {
415             $result = "I can\'t find that machine name";
416         }
417     }
418
419     &performReply($result);
420 }
421
422 sub countryStats {
423     if (exists $cache{countryStats}) {
424         &msg($who,"countrystats is already running!");
425         return;
426     }
427
428     if ($chan eq "") {
429         $chan = $_[0];
430     }
431
432     if ($chan eq "") {
433         &help("countrystats");
434         return;
435     }
436
437     &rawout("WHO $chan");
438     $cache{countryStats}{chan}  = $chan;
439     $cache{countryStats}{mtype} = $msgType;
440     $cache{countryStats}{who}   = $who;
441     $cache{on_who_Hack}         = 1;
442 }
443
444 sub do_countrystats {
445     $chan       = $cache{countryStats}{chan};
446     $msgType    = $cache{countryStats}{mtype};
447     $who        = $cache{countryStats}{who};
448
449     my $total   = 0;
450     my %cstats;
451     foreach (keys %{ $cache{nuhInfo} }) {
452         my $h = $cache{nuhInfo}{$_}{Host};
453
454         if ($h =~ /^.*\.(\D+)$/) {      # host
455             $cstats{$1}++;
456         } else {                        # ip
457             $cstats{unresolve}++;
458         }
459         $total++;
460     }
461     my %count;
462     foreach (keys %cstats) {
463         $count{ $cstats{$_} }{$_} = 1;
464     }
465
466     my @list;
467     foreach (sort {$b <=> $a} keys %count) {
468         my $str = join(", ", sort keys %{ $count{$_} });
469 #       push(@list, "$str ($_)");
470         my $perc        = sprintf("%.01f", 100 * $_ / $total);
471         $perc           =~ s/\.0+$//;
472         push(@list, "$str ($_, $perc %)");
473     }
474
475     # todo: move this into a scheduler like nickometer
476     $msgType    = "private";
477     &pSReply( &formListReply(0, "Country Stats ", @list) );
478
479     delete $cache{countryStats};
480     delete $cache{on_who_Hack};
481 }
482
483 ###
484 ### amalgamated commands.
485 ###
486
487 sub userCommands {
488     # conversion: ascii.
489     if ($message =~ /^(asci*|chr) (\d+)$/) {
490         &DEBUG("ascii/chr called ...");
491         return unless (&hasParam("allowConv"));
492
493         &DEBUG("ascii/chr called");
494
495         $arg    = $2;
496         $result = chr($arg);
497         $result = "NULL"        if ($arg == 0);
498
499         &performReply( sprintf("ascii %s is '%s'", $arg, $result) );
500
501         return;
502     }
503
504     # conversion: ord.
505     if ($message =~ /^ord(\s+(.*))$/) {
506         return unless (&hasParam("allowConv"));
507
508         $arg = $2;
509
510         if (!defined $arg or length $arg != 1) {
511             &help("ord");
512             return;
513         }
514
515         if (ord($arg) < 32) {
516             $arg = chr(ord($arg) + 64);
517             if ($arg eq chr(64)) {
518                 $arg = 'NULL';
519             } else {
520                 $arg = '^'.$arg;
521             }
522         }
523
524         &performReply( sprintf("'%s' is ascii %s", $arg, ord $1) );
525         return;
526     }
527
528     # hex.
529     if ($message =~ /^hex(\s+(.*))?$/i) {
530         return unless (&hasParam("allowConv"));
531         my $arg = $2;
532
533         if (!defined $arg) {
534             &help("hex");
535             return;
536         }
537
538         if (length $arg > 80) {
539             &msg($who, "Too long.");
540             return;
541         }
542
543         my $retval;
544         foreach (split //, $arg) {
545             $retval .= sprintf(" %X", ord($_));
546         }
547
548         &pSReply("$arg is$retval");
549
550         return;
551     }
552
553     # crypt.
554     if ($message =~ /^crypt(\s+(.*))?$/i) {
555         my @args        = split /\s+/, $2;
556
557         if (!scalar @args or scalar @args > 2) {
558             &help("crypt");
559             return;
560         }
561
562         if (scalar @args == 2) {
563             if (length $args[0] != 2) {
564                 &msg($who, "invalid format...");
565                 return;
566             }
567
568             &pSReply( crypt($args[1], $args[0]) );
569         } else {
570             &pSReply( &mkcrypt($args[0]) );
571         }
572
573         return;
574     }
575
576     # cycle.
577     if ($message =~ /^(cycle)(\s+(\S+))?$/i) {
578         return unless (&hasFlag("o"));
579         my $chan = lc $3;
580
581         if ($chan eq "") {
582             if ($msgType =~ /public/) {
583                 $chan = $talkchannel;
584                 &DEBUG("cycle: setting chan to '$chan'.");
585             } else {
586                 &help("cycle");
587                 return;
588             }
589         }
590
591         if (&validChan($chan) == 0) {
592             &msg($who,"error: invalid channel \002$chan\002");
593             return;
594         }
595
596         &msg($chan, "I'm coming back. (courtesy of $who)");
597         &part($chan);
598 ###     &ScheduleThis(5, "getNickInUse") if (@_);
599         &status("Schedule rejoin in 5secs to $chan by $who.");
600         $conn->schedule(5, sub { &joinchan($chan); });
601
602         return;
603     }
604
605     # redir.
606     if ($message =~ /^redir(\s+(.*))?/i) {
607         return unless (&hasFlag("o"));
608         my $factoid = $2;
609
610         if (!defined $factoid) {
611             &help("redir");
612             return;
613         }
614
615         my $val  = &getFactInfo($factoid, "factoid_value");
616         if (!defined $val or $val eq "") {
617             &msg($who, "error: '$factoid' does not exist.");
618             return;
619         }
620         &DEBUG("val => '$val'.");
621         my @list = &searchTable("factoids", "factoid_key",
622                                         "factoid_value", "^$val\$");
623
624         if (scalar @list == 1) {
625             &msg($who, "hrm... '$factoid' is unique.");
626             return;
627         }
628         if (scalar @list > 5) {
629             &msg($who, "A bit too many factoids to be redirected, hey?");
630             return;
631         }
632
633         my @redir;
634         &status("Redirect '$factoid' (". ($#list) .")...");
635         for (@list) {
636             my $x = $_;
637             next if (/^\Q$factoid\E$/i);
638
639             &status("  Redirecting '$_'.");
640             my $was = &getFactoid($_);
641             if ($was =~ /<REPLY> see/i) {
642                 &status("warn: not redirecting a redirection.");
643                 next;
644             }
645
646             &DEBUG("  was '$was'.");
647             push(@redir,$x);
648             &setFactInfo($x, "factoid_value", "<REPLY> see $factoid");
649         }
650         &status("Done.");
651
652         &msg($who, &formListReply(0, "'$factoid' is redirected to by '", @redir));
653
654         return;
655     }
656
657     # rot13 it.
658     if ($message =~ /^rot13(\s+(.*))?/i) {
659         my $reply = $2;
660
661         if (!defined $reply) {
662             &help("rot13");
663             return;
664         }
665
666         $reply =~ y/A-Za-z/N-ZA-Mn-za-m/;
667         &pSReply($reply);
668
669         return;
670     }
671
672     # cpustats.
673     if ($message =~ /^cpustats$/i) {
674         if ($^O !~ /linux/) {
675             &ERROR("cpustats: your OS is not supported yet.");
676             return;
677         }
678
679         ### poor method to get info out of file, please fix.
680         open(STAT,"/proc/$$/stat");
681         my $line = <STAT>;
682         chop $line;
683         my @data = split(/ /, $line);
684         close STAT;
685
686         # utime(13) + stime(14).
687         my $cpu_usage   = sprintf("%.01f", ($data[13]+$data[14]) / 100 );
688         # cutime(15) + cstime (16).
689         my $cpu_usage2  = sprintf("%.01f", ($data[15]+$data[16]) / 100 );
690         my $time        = time() - $^T;
691         my $raw_perc    = $cpu_usage*100/$time;
692         my $raw_perc2   = $cpu_usage2*100/$time;
693         my $perc;
694         my $perc2;
695
696         if ($raw_perc > 1) {
697             $perc       = sprintf("%.01f", $raw_perc);
698             $perc2      = sprintf("%.01f", $raw_perc2);
699         } elsif ($raw_perc > 0.1) {
700             $perc       = sprintf("%.02f", $raw_perc);
701             $perc2      = sprintf("%.02f", $raw_perc2);
702         } else {                        # <=0.1
703             $perc       = sprintf("%.03f", $raw_perc);
704             $perc2      = sprintf("%.03f", $raw_perc2);
705         }
706
707         &pSReply("Total CPU usage: $cpu_usage s ... Percentage CPU used: $perc % (+childs: $perc2 %)");
708
709         return;
710     }
711
712     # ircstats.
713     if ($message =~ /^ircstats?$/i) {
714         $ircstats{'TotalTime'}  ||= 0;
715         $ircstats{'OffTime'}    ||= 0;
716
717         my $count       = $ircstats{'ConnectCount'};
718         my $format_time = &Time2String(time() - $ircstats{'ConnectTime'});
719         my $total_time  = time() - $ircstats{'ConnectTime'} +
720                                 $ircstats{'TotalTime'};
721         my $reply;
722
723         my $connectivity = 100 * ($total_time - $ircstats{'OffTime'}) /
724                                 $total_time;
725         my $p = sprintf("%.03f", $connectivity);
726         $p =~ s/(\.\d*)0+$/$1/;
727         if ($p =~ s/\.0$//) {
728             # this should not happen... but why...
729         } else {
730             $p =~ s/\.$//
731         }
732
733         if ($total_time != (time() - $ircstats{'ConnectTime'}) ) {
734             my $tt_format = &Time2String($total_time);
735             &DEBUG("tt_format => $tt_format");
736         }
737
738         ### RECONNECT COUNT.
739         if ($count == 1) {      # good.
740             $reply = "I'm connected to $ircstats{'Server'} and have been so".
741                 " for $format_time";
742         } else {
743             $reply = "Currently I'm hooked up to $ircstats{'Server'} but only".
744                 " for $format_time.  ".
745                 "I had to reconnect \002$count\002 times.".
746                 "   Connectivity: $p %";
747         }
748
749         ### REASON.
750         my $reason = $ircstats{'DisconnectReason'};
751         if (defined $reason) {
752             $reply .= ".  I was last disconnected for '$reason'.";
753         }
754
755         &pSReply($reply);
756                 
757         return;
758     }
759
760     # status.
761     if ($message =~ /^statu?s$/i) {
762         my $startString = scalar(localtime $^T);
763         my $upString    = &Time2String(time() - $^T);
764         my $count       = &countKeys("factoids");
765         $count{'Commands'}      = 0;
766         foreach (keys %cmdstats) {
767             $count{'Commands'} += $cmdstats{$_};
768         }
769
770         &pSReply(
771         "Since $startString, there have been".
772           " \002$count{'Update'}\002 ".
773                 &fixPlural("modification", $count{'Update'}).
774           " and \002$count{'Question'}\002 ".
775                 &fixPlural("question",$count{'Question'}).
776           " and \002$count{'Dunno'}\002 ".
777                 &fixPlural("dunno",$count{'Dunno'}).
778           " and \002$count{'Moron'}\002 ".
779                 &fixPlural("moron",$count{'Moron'}).
780           " and \002$count{'Commands'}\002 ".
781                 &fixPlural("command",$count{'Commands'}).
782           ".  I have been awake for $upString this session, and ".
783           "currently reference \002$count\002 factoids.  ".
784           "I'm using about \002$memusage\002 ".
785           "kB of memory."
786         );
787
788         return;
789     }
790
791     # wantNick. xk++
792     if ($message =~ /^wantNick$/i) {
793         if ($param{'ircNick'} eq $ident) {
794             &msg($who, "I hope you're right. I'll try anyway.");
795         }
796
797         if (! &IsNickInAnyChan( $param{ircNick} ) ) {
798             my $str = "attempting to change nick to $param{'ircNick'}";
799             &status($str);
800             &msg($who, $str);
801             &nick($param{'ircNick'});
802         } else {
803             &msg($who, "hrm... can't do it");
804             &DEBUG("wN: nick is somewhere... should try later.");
805         }
806
807         return;
808     }
809
810     return "CONTINUE";
811 }
812
813 1;