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';
134 $ident ||= $param{'ircNick'}; # hack.
135 $ircstats{'ConnectTime'} = time();
136 $ircstats{'ConnectCount'}++;
137 $ircstats{'OffTime'} += time() - $ircstats{'DisconnectTime'}
138 if (defined $ircstats{'DisconnectTime'});
141 if (!exists $users{_default}) {
142 &status("First time run... adding _default user.");
143 $users{_default}{FLAGS} = "mrt";
144 $users{_default}{HOSTS} = "*!*@*";
147 if (scalar keys %users < 2) {
148 &status("Ok... now /msg $ident PASS <pass> to get master access through DCC CHAT.");
150 # end of first time run.
152 if (&IsChanConf("wingate")) {
153 my $file = "$bot_base_dir/$param{'ircUser'}.wingate";
157 next unless (/^(\S+)\*$/);
158 push(@wingateBad, $_);
164 &ScheduleThis(1, \&setupSchedulers);
168 if (&IsParam("ircUMode")) {
169 &VERB("Attempting change of user modes to $param{'ircUMode'}.", 2);
170 if ($param{'ircUMode'} !~ /^[-+]/) {
171 &WARN("ircUMode had no +- prefix; adding +");
172 $param{'ircUMode'} = "+".$param{'ircUMode'};
175 &rawout("MODE $ident $param{'ircUMode'}");
178 &status("End of motd. Now lets join some channels...");
179 if (!scalar @joinchan) {
180 &WARN("joinchan array is empty!!!");
181 @joinchan = &getJoinChans(1);
184 # unfortunately, Net::IRC does not implement this :(
185 # invalid command... what is it?
186 # &rawout("NOTIFY $ident");
187 # &DEBUG("adding self to NOTIFY list.");
193 my ($self, $event) = @_;
194 # &DEBUG("endofwho: chan => $chan");
195 $chan ||= ($event->args)[1];
196 # &DEBUG("endofwho: chan => $chan");
198 if (exists $cache{countryStats}) {
204 my ($self, $event) = @_;
205 my $type = uc( ($event->args)[1] );
206 my $nick = lc $event->nick();
208 # pity Net::IRC doesn't store nuh. Here's a hack :)
209 if (!exists $nuh{lc $nick}) {
211 $nuh{$nick} = "GETTING-NOW"; # trying.
215 if ($type eq 'SEND') { # GET for us.
216 # incoming DCC SEND. we're receiving a file.
217 my $get = ($event->args)[2];
218 open(DCCGET,">$get");
220 $self->new_get($nick,
227 } elsif ($type eq 'GET') { # SEND for us?
228 &status("DCC: Initializing SEND for $nick.");
229 $self->new_send($event->args);
230 } elsif ($type eq 'CHAT') {
231 &status("DCC: Initializing CHAT for $nick.");
232 $self->new_chat($event);
234 &WARN("${b_green}DCC $type$ob (1)");
239 my ($self, $event) = @_;
240 my $nick = $event->nick();
241 my $sock = ($event->to)[0];
243 # DCC CHAT close on fork exit workaround.
244 if ($bot_pid != $$) {
245 &WARN("run-away fork; exiting.");
249 if (exists $dcc{'SEND'}{$nick} and -f "$param{tempDir}/$nick.txt") {
250 &status("${b_green}DCC SEND$ob close from $b_cyan$nick$ob");
252 &status("dcc_close: purging $nick.txt from Debian.pl");
253 unlink "$param{tempDir}/$nick.txt";
255 delete $dcc{'SEND'}{$nick};
256 } elsif (exists $dcc{'CHAT'}{$nick} and $dcc{'CHAT'}{$nick} eq $sock) {
257 &status("${b_green}DCC CHAT$ob close from $b_cyan$nick$ob");
258 delete $dcc{'CHAT'}{$nick};
259 delete $dcc{'CHATvrfy'}{$nick};
261 &status("${b_green}DCC$ob UNKNOWN close from $b_cyan$nick$ob (2)");
266 my ($self, $event) = @_;
267 my $type = uc( ($event->args)[0] );
268 my $nick = lc $event->nick();
269 my $sock = ($event->to)[0];
273 ### BUG: who is set to bot's nick?
276 if ($type eq 'SEND') {
277 &status("${b_green}DCC lGET$ob established with $b_cyan$nick$ob");
279 } elsif ($type eq 'CHAT') {
281 ### TODO: run ScheduleThis inside on_dcc_open_chat recursively
282 ### 1,3,5,10 seconds then fail.
283 if ($nuh{$nick} eq "GETTING-NOW") {
284 &ScheduleThis(3/60, "on_dcc_open_chat", $nick, $sock);
286 on_dcc_open_chat(undef, $nick, $sock);
289 } elsif ($type eq 'SEND') {
290 &DEBUG("Starting DCC receive.");
291 foreach ($event->args) {
296 &WARN("${b_green}DCC $type$ob (3)");
301 # really custom sub to get NUH since Net::IRC doesn't appear to support
303 sub on_dcc_open_chat {
304 my(undef, $nick, $sock) = @_;
306 if ($nuh{$nick} eq "GETTING-NOW") {
307 &DEBUG("getting nuh for $nick failed. FIXME.");
311 &status("${b_green}DCC CHAT$ob established with $b_cyan$nick$ob $b_yellow($ob$nuh{$nick}$b_yellow)$ob");
313 &verifyUser($nick, $nuh{lc $nick});
315 if (!exists $users{$userHandle}{HOSTS}) {
316 &pSReply("you have no hosts defined in my user file; rejecting.");
317 ### TODO: $sock->close();
321 my $crypto = $users{$userHandle}{PASS};
322 $dcc{'CHAT'}{$nick} = $sock;
324 if (defined $crypto) {
325 &dccsay($nick,"Enter your password.");
327 &dccsay($nick,"Welcome to blootbot DCC CHAT interface, $userHandle.");
332 my ($self, $event) = @_;
333 my $from = $event->from();
334 my $what = ($event->args)[0];
336 &status("disconnect from $from ($what).");
337 $ircstats{'DisconnectTime'} = time();
338 $ircstats{'DisconnectReason'} = $what;
339 $ircstats{'DisconnectCount'}++;
340 $ircstats{'TotalTime'} += time() - $ircstats{'ConnectTime'};
342 # clear any variables on reconnection.
346 if (!$self->connect()) {
347 &WARN("not connected? help me. gonna call ircCheck() in 1800s");
348 &ScheduleThis(30, "ircCheck");
353 my ($self, $event) = @_;
354 my $chan = ($event->args)[1];
356 # sync time should be done in on_endofwho like in BitchX
357 if (exists $cache{jointime}{$chan}) {
358 my $delta_time = sprintf("%.03f", &timeget() - $cache{jointime}{$chan});
359 $delta_time = 0 if ($delta_time < 0);
361 &status("$b_blue$chan$ob: sync in ${delta_time}s.");
364 rawout("MODE $chan");
368 foreach ("o","v","") {
369 my $count = scalar(keys %{ $channels{$chan}{$_} });
370 next unless ($count);
372 $txt = "total" if ($_ eq "");
373 $txt = "voice" if ($_ eq "v");
374 $txt = "ops" if ($_ eq "o");
376 push(@array, "$count $txt");
378 my $chanstats = join(' || ', @array);
379 &status("$b_blue$chan$ob: [$chanstats]");
381 &chanServCheck($chan);
386 my ($self, $event) = @_;
387 my (@args) = ($event->args);
394 my ($self, $event) = @_;
395 my $chan = lc( ($event->args)[0] );
396 my $nick = $event->nick;
398 if ($nick =~ /^\Q$ident\E$/) {
399 &DEBUG("on_invite: self invite.");
404 if (exists $chanconf{$chan}) {
405 if (&validChan($chan)) {
406 &msg($who, "i'm already in \002$chan\002.");
410 &status("invited to $b_blue$chan$ob by $b_cyan$nick$ob");
416 my ($self, $event) = @_;
417 my ($user,$host) = split(/\@/, $event->userhost);
418 $chan = lc( ($event->to)[0] ); # CASING!!!!
419 $who = $event->nick();
422 $chanstats{$chan}{'Join'}++;
423 $userstats{lc $who}{'Join'} = time() if (&IsChanConf("seenStats"));
425 &joinfloodCheck($who, $chan, $event->userhost);
429 if (exists $netsplit{lc $who}) {
430 delete $netsplit{lc $who};
434 if ($netsplit and !$netsplittime) {
435 &DEBUG("on_join: ok.... re-running chanlimitCheck in 60.");
436 $conn->schedule(60, sub {
438 $netsplittime = undef;
441 $netsplittime = time();
444 # how to tell if there's a netjoin???
446 my $netsplitstr = "";
447 $netsplitstr = " $b_yellow\[${ob}NETSPLIT VICTIM$b_yellow]$ob" if ($netsplit);
448 &status(">>> join/$b_blue$chan$ob $b_cyan$who$ob $b_yellow($ob$user\@$host$b_yellow)$ob$netsplitstr");
450 $channels{$chan}{''}{$who}++;
451 $nuh = $who."!".$user."\@".$host;
452 $nuh{lc $who} = $nuh unless (exists $nuh{lc $who});
456 push(@bans, keys %{ $bans{$chan} }) if (exists $bans{$chan});
457 push(@bans, keys %{ $bans{"*"} }) if (exists $bans{"*"});
463 next unless ($nuh =~ /^$mask$/i);
465 ### TODO: check $channels{$chan}{'b'} if ban already exists.
466 foreach (keys %{ $channels{$chan}{'b'} }) {
467 &DEBUG(" bans_on_chan($chan) => $_");
470 my $reason = "no reason";
471 foreach ($chan, "*") {
472 next unless (exists $bans{$_});
473 next unless (exists $bans{$_}{$ban});
475 my @array = @{ $bans{$_}{$ban} };
477 $reason = $array[4] if ($array[4]);
482 &kick($who, $chan, $reason);
487 # no need to go further.
488 return if ($netsplit);
490 if ($who eq $ident or $who =~ /^$ident$/i) {
491 if (defined( my $whojoin = $cache{join}{$chan} )) {
492 &msg($chan, "Okay, I'm here. (courtesy of $whojoin)");
493 delete $cache{join}{$chan};
496 ### TODO: move this to &joinchan()?
497 $cache{jointime}{$chan} = &timeget();
504 &rootWarn($who,$user,$host,$chan)
505 if (&IsChanConf("rootWarn") &&
506 $user =~ /^r(oo|ew|00)t$/i &&
507 $channels{$chan}{'o'}{$ident});
510 if (&IsChanConf("news") && &IsChanConf("newsKeepRead")) {
511 if (!&loadMyModule("news")) { # just in case.
512 &DEBUG("could not load news.");
514 &News::latest($chan);
519 &chanLimitVerify($chan);
526 my ($self, $event) = @_;
527 my ($chan,$reason) = $event->args;
528 my $kicker = $event->nick;
529 my $kickee = ($event->to)[0];
530 my $uh = $event->userhost();
532 &status(">>> kick/$b_blue$chan$ob [$b$kickee!$uh$ob] by $b_cyan$kicker$ob $b_yellow($ob$reason$b_yellow)$ob");
534 $chan = lc $chan; # forgot about this, found by xsdg, 20001229.
535 $chanstats{$chan}{'Kick'}++;
537 if ($kickee eq $ident) {
538 &clearChanVars($chan);
540 &status("SELF attempting to rejoin lost channel $chan");
543 &delUserInfo($kickee,$chan);
548 my ($self, $event) = @_;
549 my ($user, $host) = split(/\@/, $event->userhost);
550 my @args = $event->args();
551 my $nick = $event->nick();
552 $chan = ($event->to)[0];
556 if ($nick eq $chan) { # UMODE
557 &status(">>> mode $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
559 &status(">>> mode/$b_blue$chan$ob $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
560 &hookMode($nick, @args);
565 my ($self, $event) = @_;
566 my $nick = $event->nick();
567 my ($myself, undef,@args) = $event->args();
568 $chan = ($event->args())[1];
570 &hookMode($nick, @args);
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 &delUserInfo($nick, keys %channels);
630 $nuh{lc $newnick} = $nuh{lc $nick};
631 delete $nuh{lc $nick};
633 if ($nick eq $ident) {
634 &status(">>> I materialized into $b_green$newnick$ob from $nick");
637 &status(">>> $b_cyan$nick$ob materializes into $b_green$newnick$ob");
639 if ($nick =~ /^\Q$param{'ircNick'}\E$/i) {
647 my $nick = $self->nick;
648 my $newnick = $nick."-";
650 &status("nick taken ($nick); preparing nick change.");
653 $conn->schedule(5, sub {
654 &status("nick taken; changing to temporary nick ($nick -> $newnick).");
660 my ($self, $event) = @_;
661 my $nick = $event->nick();
662 my $chan = ($event->to)[0];
663 my $args = ($event->args)[0];
665 if ($nick =~ /^NickServ$/i) { # nickserv.
666 &status("NickServ: <== '$args'");
669 $check++ if ($args =~ /^This nickname is registered/i);
670 $check++ if ($args =~ /nickname.*owned/i);
673 &status("nickserv told us to register; doing it.");
674 if (&IsParam("nickServ_pass")) {
675 &status("NickServ: ==> Identifying.");
676 &rawout("PRIVMSG NickServ :IDENTIFY $param{'nickServ_pass'}");
679 &status("We can't tell nickserv a passwd ;(");
684 if ($args =~ /^Password a/i) {
687 foreach ( &ChanConfList("chanServ_ops") ) {
688 next unless &chanServCheck($_);
690 &DEBUG("nickserv activated or restarted; doing chanserv check.");
696 } elsif ($nick =~ /^ChanServ$/i) { # chanserv.
697 &status("ChanServ: <== '$args'.");
699 if ($chan =~ /^$mask{chan}$/) { # channel notice.
700 &status("-$nick/$chan- $args");
702 $server = $nick unless (defined $server);
703 &status("-$nick- $args"); # private or server notice.
709 my ($self, $event) = @_;
710 my $chan = ($event->to)[0];
711 my $nick = $event->nick;
713 &status("!!! other called.");
714 &status("!!! $event->args");
718 my ($self, $event) = @_;
719 $chan = lc( ($event->to)[0] ); # CASING!!!
720 my $nick = $event->nick;
721 my $userhost = $event->userhost;
725 if (exists $floodjoin{$chan}{$nick}{Time}) {
726 delete $floodjoin{$chan}{$nick};
729 $chanstats{$chan}{'Part'}++;
730 &delUserInfo($nick,$chan);
731 &clearChanVars($chan) if ($nick eq $ident);
732 if (!&IsNickInAnyChan($nick) and &IsChanConf("seenStats")) {
733 delete $userstats{lc $nick};
736 &status(">>> part/$b_blue$chan$ob $b_cyan$nick$ob $b_yellow($ob$userhost$b_yellow)$ob");
740 my ($self, $event) = @_;
741 my $nick = $event->nick;
743 $self->ctcp_reply($nick, join(' ', ($event->args)));
744 &status(">>> ${b_green}CTCP PING$ob request from $b_cyan$nick$ob received.");
748 my ($self, $event) = @_;
749 my $nick = $event->nick;
750 my $lag = time() - ($event->args)[1];
752 &status(">>> ${b_green}CTCP PING$ob reply from $b_cyan$nick$ob: $lag sec.");
756 my ($self, $event) = @_;
757 my $msg = ($event->args)[0];
758 $chan = lc( ($event->to)[0] ); # CASING.
759 my $nick = $event->nick;
761 $uh = $event->userhost();
762 $nuh = $nick."!".$uh;
764 # todo: move this out of hookMsg to here?
765 ($user,$host) = split(/\@/, $uh);
767 # rare case should this happen - catch it just in case.
768 if ($bot_pid != $$) {
769 &ERROR("run-away fork; exiting.");
774 $lastWho{$chan} = $nick;
775 ### TODO: use $nick or lc $nick?
776 if (&IsChanConf("seenStats")) {
777 $userstats{lc $nick}{'Count'}++;
778 $userstats{lc $nick}{'Time'} = time();
781 # if (&IsChanConf("hehCounter")) {
785 &hookMsg('public', $chan, $nick, $msg);
786 $chanstats{$chan}{'PublicMsg'}++;
793 my ($self, $event) = @_;
794 my $nick = $event->nick();
795 my $reason = ($event->args)[0];
800 ### $chan = $reason; # no.
803 foreach (keys %channels) {
804 # fixes inconsistent chanstats bug #1.
805 if (!&IsNickInChan($nick,$_)) {
809 $chanstats{$_}{'SignOff'}++;
812 if ($count == scalar keys %channels) {
813 &DEBUG("on_quit: nick $nick was not found in any chan.");
816 &delUserInfo($nick, keys %channels);
818 if (exists $nuh{lc $nick}) {
819 delete $nuh{lc $nick};
821 &DEBUG("on_quit: nuh{lc $nick} does not exist! FIXME");
823 delete $userstats{lc $nick} if (&IsChanConf("seenStats"));
824 delete $chanstats{lc $nick};
826 # should fix chanstats inconsistencies bug #2.
827 if ($reason =~ /^($mask{host})\s($mask{host})$/) { # netsplit.
828 $reason = "NETSPLIT: $1 <=> $2";
831 if (&ChanConfList("chanlimitcheck") and !scalar keys %netsplit) {
832 &DEBUG("on_quit: netsplit detected; disabling chan limit.");
833 &rawout("MODE $chan -l");
836 $netsplit{lc $nick} = time();
837 if (!exists $netsplitservers{$1}{$2}) {
838 &status("netsplit detected between $1 and $2.");
839 $netsplitservers{$1}{$2} = time();
843 my $chans = join(' ', &getNickInChans($nick) );
844 &status(">>> $b_cyan$nick$ob has signed off IRC $b_red($ob$reason$b_red)$ob [$chans]");
845 if ($nick =~ /^\Q$ident\E$/) {
846 &ERROR("^^^ THIS SHOULD NEVER HAPPEN (10).");
849 if ($nick !~ /^\Q$ident\E$/ and $nick =~ /^\Q$param{'ircNick'}\E$/i) {
850 &status("nickchange: own nickname became free; changing.");
851 &nick($param{'ircNick'});
855 sub on_targettoofast {
856 my ($self, $event) = @_;
857 my $nick = $event->nick();
858 my($me,$chan,$why) = $event->args();
860 ### TODO: incomplete.
861 if ($why =~ /.* wait (\d+) second/) {
866 &status("targettoofast: going to sleep for $max ($sleep)...");
869 &status("targettoofast: going to sleep for $sleep");
872 my $delta = time() - ($cache{sleepTime} || 0);
873 if ($delta > $max+2) {
875 $cache{sleepTime} = time();
879 if (!exists $cache{TargetTooFast}) {
880 &DEBUG("on_ttf: failed: $why");
881 $cache{TargetTooFast}++;
887 my ($self, $event) = @_;
889 if (scalar($event->args) == 1) { # change.
890 my $topic = ($event->args)[0];
891 my $chan = ($event->to)[0];
892 my $nick = $event->nick();
896 # race condition here. To fix, change '1' to '0'.
897 # This will keep track of topics set by bot only.
900 # this may be fixed at a later date with topic queueing.
903 $topic{$chan}{'Current'} = $topic if (1);
904 $chanstats{$chan}{'Topic'}++;
906 &status(">>> topic/$b_blue$chan$ob by $b_cyan$nick$ob -> $topic");
908 my ($nick, $chan, $topic) = $event->args;
909 if (&IsChanConf("topic")) {
910 $topic{$chan}{'Current'} = $topic;
911 &topicAddHistory($chan,$topic);
914 $topic = &fixString($topic, 1);
915 &status(">>> topic/$b_blue$chan$ob is $topic");
920 my ($self, $event) = @_;
921 my ($myself,$chan,$setby,$time) = $event->args();
924 if (time() - $time > 60*60*24) {
925 $timestr = "at ". localtime $time;
927 $timestr = &Time2String(time() - $time) ." ago";
930 &status(">>> set by $b_cyan$setby$ob $timestr");
934 my ($self, $event) = @_;
935 my $nick = $event->nick();
938 if (scalar $event->args() != 1) { # old.
939 $ver = join ' ', $event->args();
940 $ver =~ s/^VERSION //;
942 $ver = ($event->args())[0];
945 if (grep /^\Q$nick\E$/i, @vernick) {
946 &WARN("nick $nick found in vernick; skipping.");
949 push(@vernick, $nick);
951 if ($ver =~ /bitchx/i) {
952 $ver{bitchx}{$nick} = $ver;
953 } elsif ($ver =~ /xc\!|xchat/i) {
954 $ver{xchat}{$nick} = $ver;
955 } elsif ($ver =~ /irssi/i) {
956 $ver{irssi}{$nick} = $ver;
957 } elsif ($ver =~ /epic/i) {
958 $ver{epic}{$nick} = $ver;
959 } elsif ($ver =~ /mirc/i) {
960 &DEBUG("verstats: mirc: $nick => '$ver'.");
961 $ver{mirc}{$nick} = $ver;
962 } elsif ($ver =~ /ircle/i) {
963 $ver{ircle}{$nick} = $ver;
964 } elsif ($ver =~ /ircII/i) {
965 $ver{ircII}{$nick} = $ver;
966 } elsif ($ver =~ /sirc /i) {
967 $ver{sirc}{$nick} = $ver;
968 } elsif ($ver =~ /kvirc/i) {
969 $ver{kvirc}{$nick} = $ver;
970 } elsif ($ver =~ /eggdrop/i) {
971 $ver{eggdrop}{$nick} = $ver;
972 } elsif ($ver =~ /xircon/i) {
973 $ver{xircon}{$nick} = $ver;
975 &DEBUG("verstats: other: $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");