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 my $type = uc( ($event->args)[1] );
196 my $nick = lc $event->nick();
198 # pity Net::IRC doesn't store nuh. Here's a hack :)
199 if (!exists $nuh{lc $nick}) {
201 $nuh{$nick} = "GETTING-NOW"; # trying.
205 if ($type eq 'SEND') { # GET for us.
206 # incoming DCC SEND. we're receiving a file.
207 my $get = ($event->args)[2];
208 open(DCCGET,">$get");
210 $self->new_get($nick,
217 } elsif ($type eq 'GET') { # SEND for us?
218 &status("DCC: Initializing SEND for $nick.");
219 $self->new_send($event->args);
220 } elsif ($type eq 'CHAT') {
221 &status("DCC: Initializing CHAT for $nick.");
222 $self->new_chat($event);
224 &WARN("${b_green}DCC $type$ob (1)");
229 my ($self, $event) = @_;
230 my $nick = $event->nick();
231 my $sock = ($event->to)[0];
233 # DCC CHAT close on fork exit workaround.
234 if ($bot_pid != $$) {
235 &WARN("run-away fork; exiting.");
239 if (exists $dcc{'SEND'}{$nick} and -f "$param{tempDir}/$nick.txt") {
240 &status("${b_green}DCC SEND$ob close from $b_cyan$nick$ob");
242 &status("dcc_close: purging $nick.txt from Debian.pl");
243 unlink "$param{tempDir}/$nick.txt";
245 delete $dcc{'SEND'}{$nick};
246 } elsif (exists $dcc{'CHAT'}{$nick} and $dcc{'CHAT'}{$nick} eq $sock) {
247 &status("${b_green}DCC CHAT$ob close from $b_cyan$nick$ob");
248 delete $dcc{'CHAT'}{$nick};
249 delete $dcc{'CHATvrfy'}{$nick};
251 &status("${b_green}DCC$ob UNKNOWN close from $b_cyan$nick$ob (2)");
256 my ($self, $event) = @_;
257 my $type = uc( ($event->args)[0] );
258 my $nick = lc $event->nick();
259 my $sock = ($event->to)[0];
263 ### BUG: who is set to bot's nick?
266 if ($type eq 'SEND') {
267 &status("${b_green}DCC lGET$ob established with $b_cyan$nick$ob");
269 } elsif ($type eq 'CHAT') {
271 ### TODO: run ScheduleThis inside on_dcc_open_chat recursively
272 ### 1,3,5,10 seconds then fail.
273 if ($nuh{$nick} eq "GETTING-NOW") {
274 &ScheduleThis(3/60, "on_dcc_open_chat", $nick, $sock);
276 on_dcc_open_chat(undef, $nick, $sock);
279 } elsif ($type eq 'SEND') {
280 &DEBUG("Starting DCC receive.");
281 foreach ($event->args) {
286 &WARN("${b_green}DCC $type$ob (3)");
291 # really custom sub to get NUH since Net::IRC doesn't appear to support
293 sub on_dcc_open_chat {
294 my(undef, $nick, $sock) = @_;
296 if ($nuh{$nick} eq "GETTING-NOW") {
297 &DEBUG("getting nuh for $nick failed. FIXME.");
301 &status("${b_green}DCC CHAT$ob established with $b_cyan$nick$ob $b_yellow($ob$nuh{$nick}$b_yellow)$ob");
303 &verifyUser($nick, $nuh{lc $nick});
305 if (!exists $users{$userHandle}{HOSTS}) {
306 &pSReply("you have no hosts defined in my user file; rejecting.");
307 ### TODO: $sock->close();
311 my $crypto = $users{$userHandle}{PASS};
312 $dcc{'CHAT'}{$nick} = $sock;
314 if (defined $crypto) {
315 &dccsay($nick,"Enter your password.");
317 &dccsay($nick,"Welcome to blootbot DCC CHAT interface, $userHandle.");
322 my ($self, $event) = @_;
323 my $from = $event->from();
324 my $what = ($event->args)[0];
326 &status("disconnect from $from ($what).");
327 $ircstats{'DisconnectTime'} = time();
328 $ircstats{'DisconnectReason'} = $what;
329 $ircstats{'DisconnectCount'}++;
330 $ircstats{'TotalTime'} += time() - $ircstats{'ConnectTime'};
332 # clear any variables on reconnection.
336 if (!$self->connect()) {
337 &WARN("not connected? help me. gonna call ircCheck() in 1800s");
338 &ScheduleThis(30, "ircCheck");
343 my ($self, $event) = @_;
344 my $chan = ($event->args)[1];
346 # sync time should be done in on_endofwho like in BitchX
347 if (exists $cache{jointime}{$chan}) {
348 my $delta_time = sprintf("%.03f", &gettimeofday() - $cache{jointime}{$chan});
349 $delta_time = 0 if ($delta_time < 0);
351 &status("$b_blue$chan$ob: sync in ${delta_time}s.");
354 rawout("MODE $chan");
358 foreach ("o","v","") {
359 my $count = scalar(keys %{ $channels{$chan}{$_} });
360 next unless ($count);
362 $txt = "total" if ($_ eq "");
363 $txt = "voice" if ($_ eq "v");
364 $txt = "ops" if ($_ eq "o");
366 push(@array, "$count $txt");
368 my $chanstats = join(' || ', @array);
369 &status("$b_blue$chan$ob: [$chanstats]");
371 &chanServCheck($chan);
376 my ($self, $event) = @_;
377 my (@args) = ($event->args);
384 my ($self, $event) = @_;
385 my $chan = lc( ($event->args)[0] );
386 my $nick = $event->nick;
388 if ($nick =~ /^\Q$ident\E$/) {
389 &DEBUG("on_invite: self invite.");
394 if (exists $chanconf{$chan}) {
395 if (&validChan($chan)) {
396 &msg($who, "i'm already in \002$chan\002.");
400 &status("invited to $b_blue$chan$ob by $b_cyan$nick$ob");
406 my ($self, $event) = @_;
407 my ($user,$host) = split(/\@/, $event->userhost);
408 $chan = lc( ($event->to)[0] ); # CASING!!!!
409 $who = $event->nick();
412 $chanstats{$chan}{'Join'}++;
413 $userstats{lc $who}{'Join'} = time() if (&IsChanConf("seenStats"));
415 &joinfloodCheck($who, $chan, $event->userhost);
419 if (exists $netsplit{lc $who}) {
420 delete $netsplit{lc $who};
424 if ($netsplit and !$netsplittime) {
425 &DEBUG("on_join: ok.... re-running chanlimitCheck in 60.");
426 $conn->schedule(60, sub {
428 $netsplittime = undef;
431 $netsplittime = time();
434 # how to tell if there's a netjoin???
436 my $netsplitstr = "";
437 $netsplitstr = " $b_yellow\[${ob}NETSPLIT VICTIM$b_yellow]$ob" if ($netsplit);
438 &status(">>> join/$b_blue$chan$ob $b_cyan$who$ob $b_yellow($ob$user\@$host$b_yellow)$ob$netsplitstr");
440 $channels{$chan}{''}{$who}++;
441 $nuh = $who."!".$user."\@".$host;
442 $nuh{lc $who} = $nuh unless (exists $nuh{lc $who});
446 push(@bans, keys %{ $bans{$chan} }) if (exists $bans{$chan});
447 push(@bans, keys %{ $bans{"*"} }) if (exists $bans{"*"});
453 next unless ($nuh =~ /^$mask$/i);
455 ### TODO: check $channels{$chan}{'b'} if ban already exists.
456 foreach (keys %{ $channels{$chan}{'b'} }) {
457 &DEBUG(" bans_on_chan($chan) => $_");
460 my $reason = "no reason";
461 foreach ($chan, "*") {
462 next unless (exists $bans{$_});
463 next unless (exists $bans{$_}{$ban});
465 my @array = @{ $bans{$_}{$ban} };
467 $reason = $array[4] if ($array[4]);
472 &kick($who, $chan, $reason);
477 # no need to go further.
478 return if ($netsplit);
480 if ($who eq $ident or $who =~ /^$ident$/i) {
481 if (defined( my $whojoin = $cache{join}{$chan} )) {
482 &msg($chan, "Okay, I'm here. (courtesy of $whojoin)");
483 delete $cache{join}{$chan};
486 ### TODO: move this to &joinchan()?
487 $cache{jointime}{$chan} = &gettimeofday();
494 &rootWarn($who,$user,$host,$chan)
495 if (&IsChanConf("rootWarn") &&
496 $user =~ /^r(oo|ew|00)t$/i &&
497 $channels{$chan}{'o'}{$ident});
500 if (&IsChanConf("news") && &IsChanConf("newsKeepRead")) {
501 if (!&loadMyModule("news")) { # just in case.
502 &DEBUG("could not load news.");
504 &News::latest($chan);
509 &chanLimitVerify($chan);
516 my ($self, $event) = @_;
517 my ($chan,$reason) = $event->args;
518 my $kicker = $event->nick;
519 my $kickee = ($event->to)[0];
520 my $uh = $event->userhost();
522 &status(">>> kick/$b_blue$chan$ob [$b$kickee!$uh$ob] by $b_cyan$kicker$ob $b_yellow($ob$reason$b_yellow)$ob");
524 $chan = lc $chan; # forgot about this, found by xsdg, 20001229.
525 $chanstats{$chan}{'Kick'}++;
527 if ($kickee eq $ident) {
528 &clearChanVars($chan);
530 &status("SELF attempting to rejoin lost channel $chan");
533 &DeleteUserInfo($kickee,$chan);
538 my ($self, $event) = @_;
539 my ($user, $host) = split(/\@/, $event->userhost);
540 my @args = $event->args();
541 my $nick = $event->nick();
542 my $chan = ($event->to)[0];
546 if ($nick eq $chan) { # UMODE
547 &status(">>> mode $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
549 &status(">>> mode/$b_blue$chan$ob $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
550 &hookMode($chan, @args);
555 my ($self, $event) = @_;
556 my $nick = $event->nick();
557 my ($myself,$chan,@args) = $event->args();
559 &hookMode(lc $chan, @args); # CASING.
563 my ($self, $event) = @_;
564 my $nick = $event->nick;
565 my $msg = ($event->args)[0];
567 ($user,$host) = split(/\@/, $event->userhost);
568 $uh = $event->userhost();
569 $nuh = $nick."!".$uh;
572 if ($nick eq $ident) { # hopefully ourselves.
573 if ($msg eq "TEST") {
574 &status("IRCTEST: Yes, we're alive.");
575 delete $cache{connect};
580 &hookMsg('private', undef, $nick, $msg);
587 my ($self, $event) = @_;
588 my @args = $event->args;
589 my $chan = lc $args[2]; # CASING, the last of them!
591 foreach (split / /, @args[3..$#args]) {
592 $channels{$chan}{'o'}{$_}++ if s/\@//;
593 $channels{$chan}{'v'}{$_}++ if s/\+//;
594 $channels{$chan}{''}{$_}++;
599 my ($self, $event) = @_;
600 my $nick = $event->nick();
601 my $newnick = ($event->args)[0];
603 if (exists $netsplit{lc $newnick}) {
604 &status("Netsplit: $newnick/$nick came back from netsplit and changed to original nick! removing from hash.");
605 delete $netsplit{lc $newnick};
609 foreach $chan (keys %channels) {
610 foreach $mode (keys %{ $channels{$chan} }) {
611 next unless (exists $channels{$chan}{$mode}{$nick});
613 $channels{$chan}{$mode}{$newnick} = $channels{$chan}{$mode}{$nick};
616 # todo: do %flood* aswell.
618 &DeleteUserInfo($nick,keys %channels);
619 $nuh{lc $newnick} = $nuh{lc $nick};
620 delete $nuh{lc $nick};
622 # successful self-nick change.
623 &DEBUG("on_nick... nick => $nick, ident => $ident");
624 if ($ident eq "$nick-" or "$ident-" eq $nick) {
625 &DEBUG("on_nick: well... we need this bug fixed.");
626 &DEBUG("ident => $ident");
627 &DEBUG("nick => $nick");
631 if ($nick eq $ident) {
632 &status(">>> I materialized into $b_green$newnick$ob from $nick");
635 &status(">>> $b_cyan$nick$ob materializes into $b_green$newnick$ob");
641 my $nick = $self->nick;
642 my $newnick = substr($nick,0,7)."-";
644 &status("nick taken; changing to temporary nick ($nick -> $newnick).");
650 my ($self, $event) = @_;
651 my $nick = $event->nick();
652 my $chan = ($event->to)[0];
653 my $args = ($event->args)[0];
655 if ($nick =~ /^NickServ$/i) { # nickserv.
656 &status("NickServ: <== '$args'");
659 $check++ if ($args =~ /^This nickname is registered/i);
660 $check++ if ($args =~ /nickname.*owned/i);
663 &status("nickserv told us to register; doing it.");
664 if (&IsParam("nickServ_pass")) {
665 &status("NickServ: ==> Identifying.");
666 &rawout("PRIVMSG NickServ :IDENTIFY $param{'nickServ_pass'}");
669 &status("We can't tell nickserv a passwd ;(");
674 if ($args =~ /^Password a/i) {
677 } elsif ($nick =~ /^ChanServ$/i) { # chanserv.
678 &status("ChanServ: <== '$args'.");
680 if ($chan =~ /^$mask{chan}$/) { # channel notice.
681 &status("-$nick/$chan- $args");
683 $server = $nick unless (defined $server);
684 &status("-$nick- $args"); # private or server notice.
690 my ($self, $event) = @_;
691 my $chan = ($event->to)[0];
692 my $nick = $event->nick;
694 &status("!!! other called.");
695 &status("!!! $event->args");
699 my ($self, $event) = @_;
700 $chan = lc( ($event->to)[0] ); # CASING!!!
701 my $nick = $event->nick;
702 my $userhost = $event->userhost;
706 if (exists $floodjoin{$chan}{$nick}{Time}) {
707 delete $floodjoin{$chan}{$nick};
710 $chanstats{$chan}{'Part'}++;
711 &DeleteUserInfo($nick,$chan);
712 &clearChanVars($chan) if ($nick eq $ident);
713 if (!&IsNickInAnyChan($nick) and &IsChanConf("seenStats")) {
714 delete $userstats{lc $nick};
717 &status(">>> part/$b_blue$chan$ob $b_cyan$nick$ob $b_yellow($ob$userhost$b_yellow)$ob");
721 my ($self, $event) = @_;
722 my $nick = $event->nick;
724 $self->ctcp_reply($nick, join(' ', ($event->args)));
725 &status(">>> ${b_green}CTCP PING$ob request from $b_cyan$nick$ob received.");
729 my ($self, $event) = @_;
730 my $nick = $event->nick;
731 my $lag = time() - ($event->args)[1];
733 &status(">>> ${b_green}CTCP PING$ob reply from $b_cyan$nick$ob: $lag sec.");
737 my ($self, $event) = @_;
738 my $msg = ($event->args)[0];
739 $chan = lc( ($event->to)[0] ); # CASING.
740 my $nick = $event->nick;
742 $uh = $event->userhost();
743 $nuh = $nick."!".$uh;
745 # todo: move this out of hookMsg to here?
746 ($user,$host) = split(/\@/, $uh);
748 if ($bot_pid != $$) {
749 &ERROR("run-away fork; exiting.");
754 if ($statcount < 200) {
755 foreach $chan (grep /[A-Z]/, keys %channels) {
756 &DEBUG("leak: chan => '$chan'.");
758 foreach $i (keys %{ $channels{$chan} }) {
759 foreach (keys %{ $channels{$chan}{$i} }) {
760 &DEBUG("leak: \$channels{$chan}{$i}{$_} ...");
767 $lastWho{$chan} = $nick;
768 ### TODO: use $nick or lc $nick?
769 if (&IsChanConf("seenStats")) {
770 $userstats{lc $nick}{'Count'}++;
771 $userstats{lc $nick}{'Time'} = time();
774 # if (&IsChanConf("hehCounter")) {
778 &hookMsg('public', $chan, $nick, $msg);
779 $chanstats{$chan}{'PublicMsg'}++;
786 my ($self, $event) = @_;
787 my $nick = $event->nick();
788 my $reason = ($event->args)[0];
793 ### $chan = $reason; # no.
796 foreach (keys %channels) {
797 # fixes inconsistent chanstats bug #1.
798 if (!&IsNickInChan($nick,$_)) {
802 $chanstats{$_}{'SignOff'}++;
805 if ($count == scalar keys %channels) {
806 &DEBUG("on_quit: nick $nick was not found in any chan.");
809 &DeleteUserInfo($nick, keys %channels);
811 if (exists $nuh{lc $nick}) {
812 delete $nuh{lc $nick};
814 &DEBUG("on_quit: nuh{lc $nick} does not exist! FIXME");
816 delete $userstats{lc $nick} if (&IsChanConf("seenStats"));
817 delete $chanstats{lc $nick};
819 # should fix chanstats inconsistencies bug #2.
820 if ($reason =~ /^($mask{host})\s($mask{host})$/) { # netsplit.
821 $reason = "NETSPLIT: $1 <=> $2";
823 if (&ChanConfList("chanlimitcheck") and !scalar keys %netsplit) {
824 &DEBUG("on_quit: netsplit detected; disabling chan limit.");
825 &rawout("MODE $chan -l");
828 $netsplit{lc $nick} = time();
829 if (!exists $netsplitservers{$1}{$2}) {
830 &status("netsplit detected between $1 and $2.");
831 $netsplitservers{$1}{$2} = time();
835 &status(">>> $b_cyan$nick$ob has signed off IRC $b_red($ob$reason$b_red)$ob");
836 if ($nick =~ /^\Q$ident\E$/) {
837 &DEBUG("^^^ THIS SHOULD NEVER HAPPEN.");
840 if ($nick !~ /^\Q$ident\E$/ and $nick =~ /^\Q$param{'ircNick'}\E$/i) {
841 &status("nickchange: own nickname became free; changing.");
842 &nick($param{'ircNick'});
846 sub on_targettoofast {
847 my ($self, $event) = @_;
848 my $nick = $event->nick();
849 my($me,$chan,$why) = $event->args();
851 ### TODO: incomplete.
852 if ($why =~ /.* wait (\d+) second/) {
857 &status("targettoofast: going to sleep for $max ($sleep)...");
860 &status("targettoofast: going to sleep for $sleep");
863 my $delta = time() - ($cache{sleepTime} || 0);
864 if ($delta > $max+2) {
866 $cache{sleepTime} = time();
870 if (!exists $cache{TargetTooFast}) {
871 &DEBUG("on_ttf: failed: $why");
872 $cache{TargetTooFast}++;
878 my ($self, $event) = @_;
880 if (scalar($event->args) == 1) { # change.
881 my $topic = ($event->args)[0];
882 my $chan = ($event->to)[0];
883 my $nick = $event->nick();
887 # race condition here. To fix, change '1' to '0'.
888 # This will keep track of topics set by bot only.
891 # this may be fixed at a later date with topic queueing.
894 $topic{$chan}{'Current'} = $topic if (1);
895 $chanstats{$chan}{'Topic'}++;
897 &status(">>> topic/$b_blue$chan$ob by $b_cyan$nick$ob -> $topic");
899 my ($nick, $chan, $topic) = $event->args;
900 if (&IsChanConf("topic")) {
901 $topic{$chan}{'Current'} = $topic;
902 &topicAddHistory($chan,$topic);
905 $topic = &fixString($topic, 1);
906 &status(">>> topic/$b_blue$chan$ob is $topic");
911 my ($self, $event) = @_;
912 my ($myself,$chan,$setby,$time) = $event->args();
915 if (time() - $time > 60*60*24) {
916 $timestr = "at ". localtime $time;
918 $timestr = &Time2String(time() - $time) ." ago";
921 &status(">>> set by $b_cyan$setby$ob $timestr");
925 my ($self, $event) = @_;
926 my $nick = $event->nick();
929 if (scalar $event->args() != 1) { # old.
930 $ver = join ' ', $event->args();
931 $ver =~ s/^VERSION //;
933 $ver = ($event->args())[0];
936 if (grep /^\Q$nick\E$/i, @vernick) {
937 &WARN("nick $nick found in vernick; skipping.");
940 push(@vernick, $nick);
942 if ($ver =~ /bitchx/i) {
943 $ver{bitchx}{$nick} = $ver;
944 } elsif ($ver =~ /xc\!|xchat/i) {
945 $ver{xchat}{$nick} = $ver;
946 } elsif ($ver =~ /irssi/i) {
947 $ver{irssi}{$nick} = $ver;
948 } elsif ($ver =~ /epic/i) {
949 $ver{epic}{$nick} = $ver;
950 } elsif ($ver =~ /mirc/i) {
951 $ver{mirc}{$nick} = $ver;
952 } elsif ($ver =~ /ircle/i) {
953 $ver{ircle}{$nick} = $ver;
954 } elsif ($ver =~ /ircII/i) {
955 $ver{ircII}{$nick} = $ver;
956 } elsif ($ver =~ /sirc /i) {
957 $ver{sirc}{$nick} = $ver;
958 } elsif ($ver =~ /kvirc/i) {
959 $ver{kvirc}{$nick} = $ver;
960 } elsif ($ver =~ /eggdrop/i) {
961 $ver{eggdrop}{$nick} = $ver;
962 } elsif ($ver =~ /xircon/i) {
963 $ver{xircon}{$nick} = $ver;
965 $ver{other}{$nick} = $ver;
970 my ($self, $event) = @_;
971 my $nick = $event->nick;
973 &status(">>> ${b_green}CTCP VERSION$ob request from $b_cyan$nick$ob");
974 $self->ctcp_reply($nick, "VERSION $bot_version");
978 my ($self, $event) = @_;
979 my @args = $event->args;
981 $nuh{lc $args[5]} = $args[5]."!".$args[2]."\@".$args[3];
985 my ($self, $event) = @_;
986 my @args = $event->args;
988 &DEBUG("on_whoisuser: @args");
990 $nuh{lc $args[1]} = $args[1]."!".$args[2]."\@".$args[3];
994 ### since joinnextchan is hooked onto on_endofnames, these are needed.
998 my ($self, $event) = @_;
999 my @args = $event->args;
1000 &DEBUG("on_chanfull: args => @args");
1005 my ($self, $event) = @_;
1006 my @args = $event->args;
1007 &DEBUG("on_inviteonly: args => @args");
1012 my ($self, $event) = @_;
1013 my @args = $event->args;
1014 &DEBUG("on_banned: args => @args");
1019 my ($self, $event) = @_;
1020 my @args = $event->args;
1021 &DEBUG("on_badchankey: args => @args");