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