2 # IrcHooks.pl: IRC Hooks stuff.
5 # NOTE: Based on code by Kevin Lenzo & Patrick Cole (c) 1997
8 if (&IsParam("useStrict")) { use strict; }
12 my ($self, $event) = @_;
13 my $nick = $event->nick();
14 my $chan = ($event->to)[0];
16 &DEBUG("on_generic: nick => '$nick'.");
17 &DEBUG("on_generic: chan => '$chan'.");
19 foreach ($event->args) {
20 &DEBUG("on_generic: args => '$_'.");
25 my ($self, $event) = @_;
26 my ($nick, @args) = ($event->nick, $event->args);
27 my $chan = ($event->to)[0];
31 if ($chan eq $ident) {
32 &status("* [$nick] @args");
34 &status("* $nick/$chan @args");
39 my ($self, $event) = @_;
40 my $msg = ($event->args)[0];
41 my $sock = ($event->to)[0];
42 my $nick = lc $event->nick();
44 if (!exists $nuh{$nick}) {
45 &DEBUG("chat: nuh{$nick} doesn't exist; trying WHOIS .");
50 ### set vars that would have been set in hookMsg.
51 $userHandle = ""; # reset.
55 $orig{message} = $msg;
57 $uh = (split /\!/, $nuh)[1];
61 if (!exists $dcc{'CHATvrfy'}{$nick}) {
62 $userHandle = &verifyUser($who, $nuh);
63 my $crypto = $users{$userHandle}{PASS};
66 ### TODO: prevent users without CRYPT chatting.
67 if (!defined $crypto) {
68 &DEBUG("todo: dcc close chat");
69 &msg($who, "nope, no guest logins allowed...");
73 if (&ckpasswd($msg, $crypto)) {
74 # stolen from eggdrop.
75 $self->privmsg($sock, "Connected to $ident");
76 $self->privmsg($sock, "Commands start with '.' (like '.quit' or '.help')");
77 $self->privmsg($sock, "Everything else goes out to the party line.");
79 &dccStatus(2) unless (exists $sched{"dccStatus"}{RUNNING});
84 &status("DCC CHAT: incorrect pass; closing connection.");
85 &DEBUG("chat: sock => '$sock'.");
87 delete $dcc{'CHAT'}{$nick};
88 &DEBUG("chat: after closing sock. FIXME");
89 ### BUG: close seizes bot. why?
93 &status("DCC CHAT: user $nick is here!");
94 &DCCBroadcast("*** $nick ($uh) joined the party line.");
96 $dcc{'CHATvrfy'}{$nick} = $userHandle;
98 return if ($userHandle eq "_default");
100 &dccsay($nick,"Flags: $users{$userHandle}{FLAGS}");
106 &status("$b_red=$b_cyan$who$b_red=$ob $message");
108 if ($message =~ s/^\.//) { # dcc chat commands.
109 ### TODO: make use of &Forker(); here?
110 &loadMyModule( $myModules{'ircdcc'} );
112 &DCCBroadcast("#$who# $message","m");
114 my $retval = &userDCC();
115 return unless (defined $retval);
116 return if ($retval eq $noreply);
118 $conn->privmsg($dcc{'CHAT'}{$who}, "Invalid command.");
120 } else { # dcc chat arena.
122 foreach (keys %{ $dcc{'CHAT'} }) {
123 $conn->privmsg($dcc{'CHAT'}{$_}, "<$who> $orig{message}");
127 return 'DCC CHAT MESSAGE';
133 # what's the following for?
134 $ident = $param{'ircNick'};
136 $ircstats{'ConnectTime'} = time();
137 $ircstats{'ConnectCount'}++;
138 $ircstats{'OffTime'} += time() - $ircstats{'DisconnectTime'}
139 if (defined $ircstats{'DisconnectTime'});
142 if (!exists $users{_default}) {
143 &status("First time run... adding _default user.");
144 $users{_default}{FLAGS} = "mrt";
145 $users{_default}{HOSTS} = "*!*@*";
148 if (scalar keys %users < 2) {
149 &status("Ok... now /msg $ident PASS <pass> to get master access through DCC CHAT.");
151 # end of first time run.
153 if (&IsChanConf("wingate")) {
154 my $file = "$bot_base_dir/$param{'ircUser'}.wingate";
158 next unless (/^(\S+)\*$/);
159 push(@wingateBad, $_);
165 &ScheduleThis(1, \&setupSchedulers);
169 if (&IsParam("ircUMode")) {
170 &VERB("Attempting change of user modes to $param{'ircUMode'}.", 2);
171 if ($param{'ircUMode'} !~ /^[-+]/) {
172 &WARN("ircUMode had no +- prefix; adding +");
173 $param{'ircUMode'} = "+".$param{'ircUMode'};
176 &rawout("MODE $ident $param{'ircUMode'}");
179 &status("End of motd. Now lets join some channels...");
180 if (!scalar @joinchan) {
181 &WARN("joinchan array is empty!!!");
182 @joinchan = &getJoinChans(1);
185 # unfortunately, Net::IRC does not implement this :(
186 # invalid command... what is it?
187 # &rawout("NOTIFY $ident");
188 # &DEBUG("adding self to NOTIFY list.");
194 my ($self, $event) = @_;
195 # &DEBUG("endofwho: chan => $chan");
196 $chan ||= ($event->args)[1];
197 # &DEBUG("endofwho: chan => $chan");
199 if (exists $cache{countryStats}) {
205 my ($self, $event) = @_;
206 my $type = uc( ($event->args)[1] );
207 my $nick = lc $event->nick();
209 # pity Net::IRC doesn't store nuh. Here's a hack :)
210 if (!exists $nuh{lc $nick}) {
212 $nuh{$nick} = "GETTING-NOW"; # trying.
216 if ($type eq 'SEND') { # GET for us.
217 # incoming DCC SEND. we're receiving a file.
218 my $get = ($event->args)[2];
219 open(DCCGET,">$get");
221 $self->new_get($nick,
228 } elsif ($type eq 'GET') { # SEND for us?
229 &status("DCC: Initializing SEND for $nick.");
230 $self->new_send($event->args);
231 } elsif ($type eq 'CHAT') {
232 &status("DCC: Initializing CHAT for $nick.");
233 $self->new_chat($event);
235 &WARN("${b_green}DCC $type$ob (1)");
240 my ($self, $event) = @_;
241 my $nick = $event->nick();
242 my $sock = ($event->to)[0];
244 # DCC CHAT close on fork exit workaround.
245 if ($bot_pid != $$) {
246 &WARN("run-away fork; exiting.");
250 if (exists $dcc{'SEND'}{$nick} and -f "$param{tempDir}/$nick.txt") {
251 &status("${b_green}DCC SEND$ob close from $b_cyan$nick$ob");
253 &status("dcc_close: purging $nick.txt from Debian.pl");
254 unlink "$param{tempDir}/$nick.txt";
256 delete $dcc{'SEND'}{$nick};
257 } elsif (exists $dcc{'CHAT'}{$nick} and $dcc{'CHAT'}{$nick} eq $sock) {
258 &status("${b_green}DCC CHAT$ob close from $b_cyan$nick$ob");
259 delete $dcc{'CHAT'}{$nick};
260 delete $dcc{'CHATvrfy'}{$nick};
262 &status("${b_green}DCC$ob UNKNOWN close from $b_cyan$nick$ob (2)");
267 my ($self, $event) = @_;
268 my $type = uc( ($event->args)[0] );
269 my $nick = lc $event->nick();
270 my $sock = ($event->to)[0];
274 ### BUG: who is set to bot's nick?
277 if ($type eq 'SEND') {
278 &status("${b_green}DCC lGET$ob established with $b_cyan$nick$ob");
280 } elsif ($type eq 'CHAT') {
282 ### TODO: run ScheduleThis inside on_dcc_open_chat recursively
283 ### 1,3,5,10 seconds then fail.
284 if ($nuh{$nick} eq "GETTING-NOW") {
285 &ScheduleThis(3/60, "on_dcc_open_chat", $nick, $sock);
287 on_dcc_open_chat(undef, $nick, $sock);
290 } elsif ($type eq 'SEND') {
291 &DEBUG("Starting DCC receive.");
292 foreach ($event->args) {
297 &WARN("${b_green}DCC $type$ob (3)");
302 # really custom sub to get NUH since Net::IRC doesn't appear to support
304 sub on_dcc_open_chat {
305 my(undef, $nick, $sock) = @_;
307 if ($nuh{$nick} eq "GETTING-NOW") {
308 &DEBUG("getting nuh for $nick failed. FIXME.");
312 &status("${b_green}DCC CHAT$ob established with $b_cyan$nick$ob $b_yellow($ob$nuh{$nick}$b_yellow)$ob");
314 &verifyUser($nick, $nuh{lc $nick});
316 if (!exists $users{$userHandle}{HOSTS}) {
317 &pSReply("you have no hosts defined in my user file; rejecting.");
318 ### TODO: $sock->close();
322 my $crypto = $users{$userHandle}{PASS};
323 $dcc{'CHAT'}{$nick} = $sock;
325 if (defined $crypto) {
326 &dccsay($nick,"Enter your password.");
328 &dccsay($nick,"Welcome to blootbot DCC CHAT interface, $userHandle.");
333 my ($self, $event) = @_;
334 my $from = $event->from();
335 my $what = ($event->args)[0];
337 &status("disconnect from $from ($what).");
338 $ircstats{'DisconnectTime'} = time();
339 $ircstats{'DisconnectReason'} = $what;
340 $ircstats{'DisconnectCount'}++;
341 $ircstats{'TotalTime'} += time() - $ircstats{'ConnectTime'};
343 # clear any variables on reconnection.
347 if (!$self->connect()) {
348 &WARN("not connected? help me. gonna call ircCheck() in 1800s");
349 &ScheduleThis(30, "ircCheck");
354 my ($self, $event) = @_;
355 my $chan = ($event->args)[1];
357 # sync time should be done in on_endofwho like in BitchX
358 if (exists $cache{jointime}{$chan}) {
359 my $delta_time = sprintf("%.03f", &gettimeofday() - $cache{jointime}{$chan});
360 $delta_time = 0 if ($delta_time < 0);
362 &status("$b_blue$chan$ob: sync in ${delta_time}s.");
365 rawout("MODE $chan");
369 foreach ("o","v","") {
370 my $count = scalar(keys %{ $channels{$chan}{$_} });
371 next unless ($count);
373 $txt = "total" if ($_ eq "");
374 $txt = "voice" if ($_ eq "v");
375 $txt = "ops" if ($_ eq "o");
377 push(@array, "$count $txt");
379 my $chanstats = join(' || ', @array);
380 &status("$b_blue$chan$ob: [$chanstats]");
382 &chanServCheck($chan);
387 my ($self, $event) = @_;
388 my (@args) = ($event->args);
395 my ($self, $event) = @_;
396 my $chan = lc( ($event->args)[0] );
397 my $nick = $event->nick;
399 if ($nick =~ /^\Q$ident\E$/) {
400 &DEBUG("on_invite: self invite.");
405 if (exists $chanconf{$chan}) {
406 if (&validChan($chan)) {
407 &msg($who, "i'm already in \002$chan\002.");
411 &status("invited to $b_blue$chan$ob by $b_cyan$nick$ob");
417 my ($self, $event) = @_;
418 my ($user,$host) = split(/\@/, $event->userhost);
419 $chan = lc( ($event->to)[0] ); # CASING!!!!
420 $who = $event->nick();
423 $chanstats{$chan}{'Join'}++;
424 $userstats{lc $who}{'Join'} = time() if (&IsChanConf("seenStats"));
426 &joinfloodCheck($who, $chan, $event->userhost);
430 if (exists $netsplit{lc $who}) {
431 delete $netsplit{lc $who};
435 if ($netsplit and !$netsplittime) {
436 &DEBUG("on_join: ok.... re-running chanlimitCheck in 60.");
437 $conn->schedule(60, sub {
439 $netsplittime = undef;
442 $netsplittime = time();
445 # how to tell if there's a netjoin???
447 my $netsplitstr = "";
448 $netsplitstr = " $b_yellow\[${ob}NETSPLIT VICTIM$b_yellow]$ob" if ($netsplit);
449 &status(">>> join/$b_blue$chan$ob $b_cyan$who$ob $b_yellow($ob$user\@$host$b_yellow)$ob$netsplitstr");
451 $channels{$chan}{''}{$who}++;
452 $nuh = $who."!".$user."\@".$host;
453 $nuh{lc $who} = $nuh unless (exists $nuh{lc $who});
457 push(@bans, keys %{ $bans{$chan} }) if (exists $bans{$chan});
458 push(@bans, keys %{ $bans{"*"} }) if (exists $bans{"*"});
464 next unless ($nuh =~ /^$mask$/i);
466 ### TODO: check $channels{$chan}{'b'} if ban already exists.
467 foreach (keys %{ $channels{$chan}{'b'} }) {
468 &DEBUG(" bans_on_chan($chan) => $_");
471 my $reason = "no reason";
472 foreach ($chan, "*") {
473 next unless (exists $bans{$_});
474 next unless (exists $bans{$_}{$ban});
476 my @array = @{ $bans{$_}{$ban} };
478 $reason = $array[4] if ($array[4]);
483 &kick($who, $chan, $reason);
488 # no need to go further.
489 return if ($netsplit);
491 if ($who eq $ident or $who =~ /^$ident$/i) {
492 if (defined( my $whojoin = $cache{join}{$chan} )) {
493 &msg($chan, "Okay, I'm here. (courtesy of $whojoin)");
494 delete $cache{join}{$chan};
497 ### TODO: move this to &joinchan()?
498 $cache{jointime}{$chan} = &gettimeofday();
505 &rootWarn($who,$user,$host,$chan)
506 if (&IsChanConf("rootWarn") &&
507 $user =~ /^r(oo|ew|00)t$/i &&
508 $channels{$chan}{'o'}{$ident});
511 if (&IsChanConf("news") && &IsChanConf("newsKeepRead")) {
512 if (!&loadMyModule("news")) { # just in case.
513 &DEBUG("could not load news.");
515 &News::latest($chan);
520 &chanLimitVerify($chan);
527 my ($self, $event) = @_;
528 my ($chan,$reason) = $event->args;
529 my $kicker = $event->nick;
530 my $kickee = ($event->to)[0];
531 my $uh = $event->userhost();
533 &status(">>> kick/$b_blue$chan$ob [$b$kickee!$uh$ob] by $b_cyan$kicker$ob $b_yellow($ob$reason$b_yellow)$ob");
535 $chan = lc $chan; # forgot about this, found by xsdg, 20001229.
536 $chanstats{$chan}{'Kick'}++;
538 if ($kickee eq $ident) {
539 &clearChanVars($chan);
541 &status("SELF attempting to rejoin lost channel $chan");
544 &DeleteUserInfo($kickee,$chan);
549 my ($self, $event) = @_;
550 my ($user, $host) = split(/\@/, $event->userhost);
551 my @args = $event->args();
552 my $nick = $event->nick();
553 my $chan = ($event->to)[0];
557 if ($nick eq $chan) { # UMODE
558 &status(">>> mode $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
560 &status(">>> mode/$b_blue$chan$ob $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
561 &hookMode($chan, @args);
566 my ($self, $event) = @_;
567 my $nick = $event->nick();
568 my ($myself,$chan,@args) = $event->args();
570 &hookMode(lc $chan, @args); # CASING.
574 my ($self, $event) = @_;
575 my $nick = $event->nick;
576 my $msg = ($event->args)[0];
578 ($user,$host) = split(/\@/, $event->userhost);
579 $uh = $event->userhost();
580 $nuh = $nick."!".$uh;
583 if ($nick eq $ident) { # hopefully ourselves.
584 if ($msg eq "TEST") {
585 &status("IRCTEST: Yes, we're alive.");
586 delete $cache{connect};
591 &hookMsg('private', undef, $nick, $msg);
598 my ($self, $event) = @_;
599 my @args = $event->args;
600 my $chan = lc $args[2]; # CASING, the last of them!
602 foreach (split / /, @args[3..$#args]) {
603 $channels{$chan}{'o'}{$_}++ if s/\@//;
604 $channels{$chan}{'v'}{$_}++ if s/\+//;
605 $channels{$chan}{''}{$_}++;
610 my ($self, $event) = @_;
611 my $nick = $event->nick();
612 my $newnick = ($event->args)[0];
614 if (exists $netsplit{lc $newnick}) {
615 &status("Netsplit: $newnick/$nick came back from netsplit and changed to original nick! removing from hash.");
616 delete $netsplit{lc $newnick};
620 foreach $chan (keys %channels) {
621 foreach $mode (keys %{ $channels{$chan} }) {
622 next unless (exists $channels{$chan}{$mode}{$nick});
624 $channels{$chan}{$mode}{$newnick} = $channels{$chan}{$mode}{$nick};
627 # todo: do %flood* aswell.
629 &DeleteUserInfo($nick,keys %channels);
630 $nuh{lc $newnick} = $nuh{lc $nick};
631 delete $nuh{lc $nick};
633 # successful self-nick change.
634 &DEBUG("on_nick... nick => $nick, ident => $ident");
635 if ($ident eq "$nick-" or "$ident-" eq $nick) {
636 &DEBUG("on_nick: well... we need this bug fixed.");
637 &DEBUG("ident => $ident");
638 &DEBUG("nick => $nick");
642 if ($nick eq $ident) {
643 &status(">>> I materialized into $b_green$newnick$ob from $nick");
646 &status(">>> $b_cyan$nick$ob materializes into $b_green$newnick$ob");
652 my $nick = $self->nick;
653 my $newnick = substr($nick,0,7)."-";
655 &status("nick taken; changing to temporary nick ($nick -> $newnick).");
661 my ($self, $event) = @_;
662 my $nick = $event->nick();
663 my $chan = ($event->to)[0];
664 my $args = ($event->args)[0];
666 if ($nick =~ /^NickServ$/i) { # nickserv.
667 &status("NickServ: <== '$args'");
670 $check++ if ($args =~ /^This nickname is registered/i);
671 $check++ if ($args =~ /nickname.*owned/i);
674 &status("nickserv told us to register; doing it.");
675 if (&IsParam("nickServ_pass")) {
676 &status("NickServ: ==> Identifying.");
677 &rawout("PRIVMSG NickServ :IDENTIFY $param{'nickServ_pass'}");
680 &status("We can't tell nickserv a passwd ;(");
685 if ($args =~ /^Password a/i) {
688 } elsif ($nick =~ /^ChanServ$/i) { # chanserv.
689 &status("ChanServ: <== '$args'.");
691 if ($chan =~ /^$mask{chan}$/) { # channel notice.
692 &status("-$nick/$chan- $args");
694 $server = $nick unless (defined $server);
695 &status("-$nick- $args"); # private or server notice.
701 my ($self, $event) = @_;
702 my $chan = ($event->to)[0];
703 my $nick = $event->nick;
705 &status("!!! other called.");
706 &status("!!! $event->args");
710 my ($self, $event) = @_;
711 $chan = lc( ($event->to)[0] ); # CASING!!!
712 my $nick = $event->nick;
713 my $userhost = $event->userhost;
717 if (exists $floodjoin{$chan}{$nick}{Time}) {
718 delete $floodjoin{$chan}{$nick};
721 $chanstats{$chan}{'Part'}++;
722 &DeleteUserInfo($nick,$chan);
723 &clearChanVars($chan) if ($nick eq $ident);
724 if (!&IsNickInAnyChan($nick) and &IsChanConf("seenStats")) {
725 delete $userstats{lc $nick};
728 &status(">>> part/$b_blue$chan$ob $b_cyan$nick$ob $b_yellow($ob$userhost$b_yellow)$ob");
732 my ($self, $event) = @_;
733 my $nick = $event->nick;
735 $self->ctcp_reply($nick, join(' ', ($event->args)));
736 &status(">>> ${b_green}CTCP PING$ob request from $b_cyan$nick$ob received.");
740 my ($self, $event) = @_;
741 my $nick = $event->nick;
742 my $lag = time() - ($event->args)[1];
744 &status(">>> ${b_green}CTCP PING$ob reply from $b_cyan$nick$ob: $lag sec.");
748 my ($self, $event) = @_;
749 my $msg = ($event->args)[0];
750 $chan = lc( ($event->to)[0] ); # CASING.
751 my $nick = $event->nick;
753 $uh = $event->userhost();
754 $nuh = $nick."!".$uh;
756 # todo: move this out of hookMsg to here?
757 ($user,$host) = split(/\@/, $uh);
759 if ($bot_pid != $$) {
760 &ERROR("run-away fork; exiting.");
765 if ($statcount < 200) {
766 foreach $chan (grep /[A-Z]/, keys %channels) {
767 &DEBUG("leak: chan => '$chan'.");
769 foreach $i (keys %{ $channels{$chan} }) {
770 foreach (keys %{ $channels{$chan}{$i} }) {
771 &DEBUG("leak: \$channels{$chan}{$i}{$_} ...");
778 $lastWho{$chan} = $nick;
779 ### TODO: use $nick or lc $nick?
780 if (&IsChanConf("seenStats")) {
781 $userstats{lc $nick}{'Count'}++;
782 $userstats{lc $nick}{'Time'} = time();
785 # if (&IsChanConf("hehCounter")) {
789 &hookMsg('public', $chan, $nick, $msg);
790 $chanstats{$chan}{'PublicMsg'}++;
797 my ($self, $event) = @_;
798 my $nick = $event->nick();
799 my $reason = ($event->args)[0];
804 ### $chan = $reason; # no.
807 foreach (keys %channels) {
808 # fixes inconsistent chanstats bug #1.
809 if (!&IsNickInChan($nick,$_)) {
813 $chanstats{$_}{'SignOff'}++;
816 if ($count == scalar keys %channels) {
817 &DEBUG("on_quit: nick $nick was not found in any chan.");
820 &DeleteUserInfo($nick, keys %channels);
822 if (exists $nuh{lc $nick}) {
823 delete $nuh{lc $nick};
825 &DEBUG("on_quit: nuh{lc $nick} does not exist! FIXME");
827 delete $userstats{lc $nick} if (&IsChanConf("seenStats"));
828 delete $chanstats{lc $nick};
830 # should fix chanstats inconsistencies bug #2.
831 if ($reason =~ /^($mask{host})\s($mask{host})$/) { # netsplit.
832 $reason = "NETSPLIT: $1 <=> $2";
834 if (&ChanConfList("chanlimitcheck") and !scalar keys %netsplit) {
835 &DEBUG("on_quit: netsplit detected; disabling chan limit.");
836 &rawout("MODE $chan -l");
839 $netsplit{lc $nick} = time();
840 if (!exists $netsplitservers{$1}{$2}) {
841 &status("netsplit detected between $1 and $2.");
842 $netsplitservers{$1}{$2} = time();
846 &status(">>> $b_cyan$nick$ob has signed off IRC $b_red($ob$reason$b_red)$ob");
847 if ($nick =~ /^\Q$ident\E$/) {
848 &DEBUG("^^^ THIS SHOULD NEVER HAPPEN.");
851 if ($nick !~ /^\Q$ident\E$/ and $nick =~ /^\Q$param{'ircNick'}\E$/i) {
852 &status("nickchange: own nickname became free; changing.");
853 &nick($param{'ircNick'});
857 sub on_targettoofast {
858 my ($self, $event) = @_;
859 my $nick = $event->nick();
860 my($me,$chan,$why) = $event->args();
862 ### TODO: incomplete.
863 if ($why =~ /.* wait (\d+) second/) {
868 &status("targettoofast: going to sleep for $max ($sleep)...");
871 &status("targettoofast: going to sleep for $sleep");
874 my $delta = time() - ($cache{sleepTime} || 0);
875 if ($delta > $max+2) {
877 $cache{sleepTime} = time();
881 if (!exists $cache{TargetTooFast}) {
882 &DEBUG("on_ttf: failed: $why");
883 $cache{TargetTooFast}++;
889 my ($self, $event) = @_;
891 if (scalar($event->args) == 1) { # change.
892 my $topic = ($event->args)[0];
893 my $chan = ($event->to)[0];
894 my $nick = $event->nick();
898 # race condition here. To fix, change '1' to '0'.
899 # This will keep track of topics set by bot only.
902 # this may be fixed at a later date with topic queueing.
905 $topic{$chan}{'Current'} = $topic if (1);
906 $chanstats{$chan}{'Topic'}++;
908 &status(">>> topic/$b_blue$chan$ob by $b_cyan$nick$ob -> $topic");
910 my ($nick, $chan, $topic) = $event->args;
911 if (&IsChanConf("topic")) {
912 $topic{$chan}{'Current'} = $topic;
913 &topicAddHistory($chan,$topic);
916 $topic = &fixString($topic, 1);
917 &status(">>> topic/$b_blue$chan$ob is $topic");
922 my ($self, $event) = @_;
923 my ($myself,$chan,$setby,$time) = $event->args();
926 if (time() - $time > 60*60*24) {
927 $timestr = "at ". localtime $time;
929 $timestr = &Time2String(time() - $time) ." ago";
932 &status(">>> set by $b_cyan$setby$ob $timestr");
936 my ($self, $event) = @_;
937 my $nick = $event->nick();
940 if (scalar $event->args() != 1) { # old.
941 $ver = join ' ', $event->args();
942 $ver =~ s/^VERSION //;
944 $ver = ($event->args())[0];
947 if (grep /^\Q$nick\E$/i, @vernick) {
948 &WARN("nick $nick found in vernick; skipping.");
951 push(@vernick, $nick);
953 if ($ver =~ /bitchx/i) {
954 $ver{bitchx}{$nick} = $ver;
955 } elsif ($ver =~ /xc\!|xchat/i) {
956 $ver{xchat}{$nick} = $ver;
957 } elsif ($ver =~ /irssi/i) {
958 $ver{irssi}{$nick} = $ver;
959 } elsif ($ver =~ /epic/i) {
960 $ver{epic}{$nick} = $ver;
961 } elsif ($ver =~ /mirc/i) {
962 $ver{mirc}{$nick} = $ver;
963 } elsif ($ver =~ /ircle/i) {
964 $ver{ircle}{$nick} = $ver;
965 } elsif ($ver =~ /ircII/i) {
966 $ver{ircII}{$nick} = $ver;
967 } elsif ($ver =~ /sirc /i) {
968 $ver{sirc}{$nick} = $ver;
969 } elsif ($ver =~ /kvirc/i) {
970 $ver{kvirc}{$nick} = $ver;
971 } elsif ($ver =~ /eggdrop/i) {
972 $ver{eggdrop}{$nick} = $ver;
973 } elsif ($ver =~ /xircon/i) {
974 $ver{xircon}{$nick} = $ver;
976 $ver{other}{$nick} = $ver;
981 my ($self, $event) = @_;
982 my $nick = $event->nick;
984 &status(">>> ${b_green}CTCP VERSION$ob request from $b_cyan$nick$ob");
985 $self->ctcp_reply($nick, "VERSION $bot_version");
989 my ($self, $event) = @_;
990 my @args = $event->args;
991 my $str = $args[5]."!".$args[2]."\@".$args[3];
993 if ($cache{on_who_Hack}) {
994 $cache{nuhInfo}{lc $args[5]}{Nick} = $args[5];
995 $cache{nuhInfo}{lc $args[5]}{User} = $args[2];
996 $cache{nuhInfo}{lc $args[5]}{Host} = $args[3];
1000 $nuh{lc $args[5]} = $args[5]."!".$args[2]."\@".$args[3];
1004 my ($self, $event) = @_;
1005 my @args = $event->args;
1007 &DEBUG("on_whoisuser: @args");
1009 $nuh{lc $args[1]} = $args[1]."!".$args[2]."\@".$args[3];
1013 ### since joinnextchan is hooked onto on_endofnames, these are needed.
1017 my ($self, $event) = @_;
1018 my @args = $event->args;
1019 &DEBUG("on_chanfull: args => @args");
1024 my ($self, $event) = @_;
1025 my @args = $event->args;
1026 &DEBUG("on_inviteonly: args => @args");
1031 my ($self, $event) = @_;
1032 my @args = $event->args;
1033 &DEBUG("on_banned: args => @args");
1038 my ($self, $event) = @_;
1039 my @args = $event->args;
1040 &DEBUG("on_badchankey: args => @args");