2 # IrcHooks.pl: IRC Hooks stuff.
5 # NOTE: Based on code by Kevin Lenzo & Patrick Cole (c) 1997
8 if (&IsParam("useStrict")) { use strict; }
14 my ($self, $event) = @_;
15 my $nick = $event->nick();
16 my $chan = ($event->to)[0];
18 &DEBUG("on_generic: nick => '$nick'.");
19 &DEBUG("on_generic: chan => '$chan'.");
21 foreach ($event->args) {
22 &DEBUG("on_generic: args => '$_'.");
27 my ($self, $event) = @_;
28 my ($nick, @args) = ($event->nick, $event->args);
29 my $chan = ($event->to)[0];
33 if ($chan eq $ident) {
34 &status("* [$nick] @args");
36 &status("* $nick/$chan @args");
41 my ($self, $event) = @_;
42 my $msg = ($event->args)[0];
43 my $sock = ($event->to)[0];
44 my $nick = $event->nick();
46 if (!exists $nuh{lc $nick}) {
47 &DEBUG("chat: nuh{$nick} doesn't exist; hrm should retry.");
53 $orig{message} = $msg;
55 $uh = (split /\!/, $nuh)[1];
60 if (!exists $dcc{'CHAT'}{$nick}) {
61 my $userHandle = &verifyUser($who, $nuh);
62 my $crypto = $userList{$userHandle}{'pass'};
65 if (!defined $crypto) {
66 &DEBUG("chat: no pass required.");
68 } elsif (&ckpasswd($msg, $crypto)) {
69 $self->privmsg($sock,"Authorized.");
70 $self->privmsg($sock,"I'll respond as if through /msg and addressed in public. Addition to that, access to 'user' commands will be allowed, like 'die' and 'jump'.");
71 # hrm... it's stupid to ask for factoids _within_ dcc chat.
72 # perhaps it should be default to commands, especially
73 # commands only authorized through DCC CHAT.
74 &status("DCC CHAT: passwd is ok.");
77 &status("DCC CHAT: incorrect pass; closing connection.");
78 &DEBUG("chat: sock => '$sock'.");
80 &DEBUG("chat: after closing sock. FIXME");
81 ### BUG: close seizes bot. why?
85 &status("DCC CHAT: user $nick is here!");
86 $dcc{'CHAT'}{$nick} = $sock;
87 &DCCBroadcast("$nick ($uh) has joined the chat arena.");
94 $userHandle = &verifyUser($who, $nuh);
95 &status("$b_red=$b_cyan$who$b_red=$ob $message");
96 if ($message =~ s/^\.//) { # dcc chat commands.
97 ### TODO: make use of &Forker(); here?
98 &loadMyModule($myModules{'ircdcc'});
99 return '$noreply from userD' if (&userDCC() eq $noreply);
100 $conn->privmsg($dcc{'CHAT'}{$who}, "Invalid command.");
102 } else { # dcc chat arena.
103 foreach (keys %{$dcc{'CHAT'}}) {
104 $conn->privmsg($dcc{'CHAT'}{$_}, "<$who> $orig{message}");
108 return 'DCC CHAT MESSAGE';
114 if (&IsParam("wingate")) {
115 my $file = "$bot_base_dir/$param{'ircUser'}.wingate";
119 next unless (/^(\S+)\*$/);
120 push(@wingateBad, $_);
126 &DEBUG("on_EOM: calling sS in 60s.");
127 $conn->schedule(60, \&setupSchedulers, "");
131 if (&IsParam("ircUMode")) {
132 &status("Attempting change of user modes to $param{'ircUMode'}.");
133 &rawout("MODE $ident $param{'ircUMode'}");
136 &status("End of motd. Now lets join some channels...");
137 if (!scalar @joinchan) {
138 &WARN("joinchan array is empty!!!");
139 @joinchan = split /[\t\s]+/, $param{'join_channels'};
146 my ($self, $event) = @_;
147 my $type = uc( ($event->args)[1] );
148 my $nick = $event->nick();
150 # pity Net::IRC doesn't store nuh. Here's a hack :)
153 if ($type eq 'SEND') { # GET for us.
154 # incoming DCC SEND. we're receiving a file.
155 my $get = ($event->args)[2];
156 open(DCCGET,">$get");
158 $self->new_get($nick,
165 } elsif ($type eq 'GET') { # SEND for us?
166 &DEBUG("starting get.");
167 $self->new_send($event->args);
168 } elsif ($type eq 'CHAT') {
169 &DEBUG("starting chat.");
170 $self->new_chat($event);
172 &status("${b_green}DCC $type$ob unknown ...");
177 my ($self, $event) = @_;
178 my $nick = $event->nick();
179 my $sock = ($event->to)[0];
181 # DCC CHAT close on fork exit workaround.
182 return if ($bot_pid != $$);
184 &DEBUG("dcc_close: nick => '$nick'.");
186 if (exists $dcc{'SEND'}{$nick} and -f "temp/$nick.txt") {
187 &status("${b_green}DCC SEND$ob close from $b_cyan$nick$ob");
189 &status("dcc_close: purging $nick.txt from Debian.pl");
190 unlink "temp/$nick.txt";
192 delete $dcc{'SEND'}{$nick};
193 } elsif (exists $dcc{'CHAT'}{$nick} and $dcc{'CHAT'}{$nick} eq $sock) {
194 &status("${b_green}DCC CHAT$ob close from $b_cyan$nick$ob");
195 delete $dcc{'CHAT'}{$nick};
197 &status("${b_green}DCC$ob UNKNOWN close from $b_cyan$nick$ob");
202 my ($self, $event) = @_;
203 my $type = uc( ($event->args)[0] );
204 my $nick = $event->nick();
205 my $sock = ($event->to)[0];
208 if ($type eq 'SEND') {
209 &status("${b_green}DCC lGET$ob established with $b_cyan$nick$ob");
210 } elsif ($type eq 'CHAT') {
211 &status("${b_green}DCC CHAT$ob established with $b_cyan$nick$ob ($nuh{$nick})");
212 my $userHandle = &verifyUser($nick, $nuh{lc $nick});
213 my $crypto = $userList{$userHandle}{'pass'};
214 if (defined $crypto) {
215 $self->privmsg($sock,"Enter Password, $userHandle.");
217 $self->privmsg($sock,"Welcome to blootbot DCC CHAT interface, $userHandle.");
219 } elsif ($type eq 'SEND') {
220 &DEBUG("Starting DCC receive.");
221 foreach ($event->args) {
225 &status("${b_green}DCC $type$ob unknown ...");
230 my ($self, $event) = @_;
231 my $from = $event->from();
232 my $what = ($event->args)[0];
234 &status("disconnect from $from ($what).");
235 $ircstats{'DisconnectTime'} = time();
236 $ircstats{'DisconnectReason'} = $what;
237 $ircstats{'DisconnectCount'}++;
239 # clear any variables on reconnection.
243 if (!$self->connect()) {
244 &WARN("not connected? help me. gonna call ircCheck() in 1800s");
245 $conn->schedule(1800, \&ircCheck(), "");
250 my ($self, $event) = @_;
251 my $chan = ($event->args)[1];
253 if (exists $jointime{$chan}) {
254 my $delta_time = sprintf("%.03f", &gettimeofday() - $jointime{$chan});
255 $delta_time = 0 if ($delta_time < 0);
257 &status("$b_blue$chan$ob: sync in ${delta_time}s.");
260 rawout("MODE $chan");
264 foreach ("o","v","") {
265 my $count = scalar(keys %{$channels{$chan}{$_}});
266 next unless ($count);
268 $txt = "total" if ($_ eq "");
269 $txt = "voice" if ($_ eq "v");
270 $txt = "ops" if ($_ eq "o");
272 push(@array, "$count $txt");
274 my $chanstats = join(' || ', @array);
275 &status("$b_blue$chan$ob: [$chanstats]");
277 if (scalar @joinchan) { # remaining channels to join.
280 ### chanserv support.
281 ### TODO: what if we rejoin a channel.. need to set a var that
282 ### we've done the request-for-ops-on-join.
283 return unless (&IsParam("chanServ_ops"));
284 return unless ($nickserv);
286 my @chans = split(/[\s\t]+/, $param{'chanServ_ops'});
288 ### TODO: since this function has a chan arg, why don't we use
289 ### that instead of doing the following?
290 foreach $chan (keys %channels) {
291 next unless (grep /^$chan$/i, @chans);
293 if (!exists $channels{$chan}{'o'}{$ident}) {
294 &status("ChanServ ==> Requesting ops for $chan.");
295 &rawout("PRIVMSG ChanServ :OP $chan $ident");
303 my ($self, $event) = @_;
304 my (@args) = ($event->args);
311 my ($self, $event) = @_;
312 my $chan = ($event->args)[0];
313 my $nick = $event->nick;
315 &DEBUG("on_invite: chan => '$chan', nick => '$nick'.");
317 # chan + possible_key.
318 ### do we need to know the key if we're invited???
319 ### grep the channel list?
320 foreach (split /[\s\t]+/, $param{'join_channels'}) {
321 next unless /^\Q$chan\E(,\S+)?$/i;
324 next if ($nick =~ /^\Q$ident\E$/);
325 if (&validChan($chan)) {
326 &msg($who, "i'm already in \002$chan\002.");
330 &status("invited to $b_blue$_$ob by $b_cyan$who$ob");
331 &joinchan($self, $_);
336 my ($self, $event) = @_;
337 my ($user,$host) = split(/\@/, $event->userhost);
338 $chan = lc( ($event->to)[0] ); # CASING!!!!
339 $who = $event->nick();
341 $chanstats{$chan}{'Join'}++;
342 $userstats{lc $who}{'Join'} = time() if (&IsParam("seenStats"));
346 if (exists $netsplit{lc $who}) {
347 delete $netsplit{lc $who};
351 # how to tell if there's a netjoin???
353 my $netsplitstr = "";
354 $netsplitstr = " $b_yellow\[${ob}NETSPLIT VICTIM$b_yellow]$ob" if ($netsplit);
355 &status(">>> join/$b_blue$chan$ob $b_cyan$who$ob $b_yellow($ob$user\@$host$b_yellow)$ob$netsplitstr");
357 $channels{$chan}{''}{$who}++;
358 $nuh{lc $who} = $who."!".$user."\@".$host unless (exists $nuh{lc $who});
361 &rootWarn($who,$user,$host,$chan)
362 if (&IsParam("rootWarn") &&
363 $user =~ /^r(oo|ew|00)t$/i &&
364 $channels{$chan}{'o'}{$ident});
366 # used to determine sync time.
367 if ($who =~ /^$ident$/i) {
368 if (defined( my $whojoin = $joinverb{$chan} )) {
369 &msg($chan, "Okay, I'm here. (courtesy of $whojoin)");
370 delete $joinverb{$chan};
373 ### TODO: move this to &joinchan()?
374 $jointime{$chan} = &gettimeofday();
377 ### TODO: this may go wild on a netjoin :)
384 my ($self, $event) = @_;
385 my ($chan,$reason) = $event->args;
386 my $kicker = $event->nick;
387 my $kickee = ($event->to)[0];
388 my $uh = $event->userhost();
390 &status(">>> kick/$b_blue$chan$ob [$b$kickee!$uh$ob] by $b_cyan$kicker$ob $b_yellow($ob$reason$b_yellow)$ob");
392 $chanstats{$chan}{'Kick'}++;
394 if ($kickee eq $ident) {
395 &clearChanVars($chan);
397 &status("SELF attempting to rejoin lost channel $chan");
400 &DeleteUserInfo($kickee,$chan);
405 my ($self, $event) = @_;
406 my ($user, $host) = split(/\@/, $event->userhost);
407 my @args = $event->args();
408 my $nick = $event->nick();
409 my $chan = ($event->to)[0];
413 if ($nick eq $chan) { # UMODE
414 &status(">>> mode $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
416 &status(">>> mode/$b_blue$chan$ob $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
417 &hookMode($chan, @args);
422 my ($self, $event) = @_;
423 my $nick = $event->nick();
424 my ($myself,$chan,@args) = $event->args();
426 &hookMode(lc $chan, @args); # CASING.
430 my ($self, $event) = @_;
431 my $nick = $event->nick;
432 my $chan = lc ( ($event->to)[0] ); # CASING.
433 my $msg = ($event->args)[0];
435 ($user,$host) = split(/\@/, $event->userhost);
436 $uh = $event->userhost();
437 $nuh = $nick."!".$uh;
439 &hookMsg('private', $chan, $nick, $msg);
443 my ($self, $event) = @_;
444 my @args = $event->args;
445 my $chan = lc $args[2]; # CASING, the last of them!
447 foreach (split / /, @args[3..$#args]) {
448 $channels{$chan}{'o'}{$_}++ if s/\@//;
449 $channels{$chan}{'v'}{$_}++ if s/\+//;
450 $channels{$chan}{''}{$_}++;
455 my ($self, $event) = @_;
456 my $nick = $event->nick();
457 my $newnick = ($event->args)[0];
459 if (exists $netsplit{lc $newnick}) {
460 &DEBUG("on_nick: $newnick/$nick came back from netsplit and changed to original nick! removing from hash.");
461 delete $netsplit{lc $newnick};
465 foreach $chan (keys %channels) {
466 foreach $mode (keys %{$channels{$chan}}) {
467 next unless (exists $channels{$chan}{$mode}{$nick});
469 $channels{$chan}{$mode}{$newnick} = $channels{$chan}{$mode}{$nick};
472 &DeleteUserInfo($nick,keys %channels);
473 $nuh{lc $newnick} = $nuh{lc $nick};
474 delete $nuh{lc $nick};
476 # successful self-nick change.
477 if ($nick eq $ident) {
478 &status(">>> I materialized into $b_green$newnick$ob from $nick");
481 &status(">>> $b_cyan$nick$ob materializes into $b_green$newnick$ob");
487 my $nick = $self->nick;
488 my $newnick = substr($nick,0,7)."-";
490 &status("nick taken; changing to temporary nick.");
496 my ($self, $event) = @_;
497 my $nick = $event->nick();
498 my $chan = ($event->to)[0];
499 my $args = ($event->args)[0];
501 if ($nick =~ /^NickServ$/i) { # nickserv.
502 &status("NickServ: <== '$args'");
504 if ($args =~ /^This nickname is registered/i) {
505 &status("nickserv told us to register; doing it.");
506 if (&IsParam("nickServ_pass")) {
507 &status("NickServ: ==> Identifying.");
508 &rawout("PRIVMSG NickServ :IDENTIFY $param{'nickServ_pass'}");
511 &status("We can't tell nickserv a passwd ;(");
516 if ($args =~ /^Password a/i) {
519 } elsif ($nick =~ /^ChanServ$/i) { # chanserv.
520 &status("ChanServ: <== '$args'.");
522 if ($chan =~ /^$mask{chan}$/) { # channel notice.
523 &status("-$nick/$chan- $args");
525 $server = $nick unless (defined $server);
526 &status("-$nick- $args"); # private or server notice.
532 my ($self, $event) = @_;
533 my $chan = ($event->to)[0];
534 my $nick = $event->nick;
536 &status("!!! other called.");
537 &status("!!! $event->args");
541 my ($self, $event) = @_;
542 my $chan = lc( ($event->to)[0] ); # CASING!!!
543 my $nick = $event->nick;
544 my $userhost = $event->userhost;
546 $chanstats{$chan}{'Part'}++;
547 &DeleteUserInfo($nick,$chan);
548 &clearChanVars($chan) if ($nick eq $ident);
549 if (!&IsNickInAnyChan($nick) and &IsParam("seenStats")) {
550 delete $userstats{lc $nick};
553 &status(">>> part/$b_blue$chan$ob $b_cyan$nick$ob $b_yellow($ob$userhost$b_yellow)$ob");
557 my ($self, $event) = @_;
558 my $nick = $event->nick;
560 $self->ctcp_reply($nick, join(' ', ($event->args)));
561 &status(">>> ${b_green}CTCP PING$ob request from $b_cyan$nick$ob received.");
565 my ($self, $event) = @_;
566 my $nick = $event->nick;
567 my $lag = time() - ($event->args)[1];
569 &status(">>> ${b_green}CTCP PING$ob reply from $b_cyan$nick$ob: $lag sec.");
573 my ($self, $event) = @_;
574 my $msg = ($event->args)[0];
575 my $chan = lc( ($event->to)[0] ); # CASING.
576 my $nick = $event->nick;
577 $uh = $event->userhost();
578 $nuh = $nick."!".$uh;
579 ($user,$host) = split(/\@/, $uh);
582 if ($statcount < 200) {
583 foreach $chan (grep /[A-Z]/, keys %channels) {
584 &DEBUG("leak: chan => '$chan'.");
586 foreach $i (keys %{$channels{$chan}}) {
587 foreach (keys %{$channels{$chan}{$i}}) {
588 &DEBUG("leak: \$channels{$chan}{$i}{$_} ...");
596 $lastWho{$chan} = $nick;
597 ### TODO: use $nick or lc $nick?
598 if (&IsParam("seenStats")) {
599 $userstats{lc $nick}{'Count'}++;
600 $userstats{lc $nick}{'Time'} = time();
603 # if (&IsParam("hehCounter")) {
607 &hookMsg('public', $chan, $nick, $msg);
608 $chanstats{$chan}{'PublicMsg'}++;
612 my ($self, $event) = @_;
613 my $nick = $event->nick();
614 my $reason = ($event->args)[0];
616 foreach (keys %channels) {
617 # fixes inconsistent chanstats bug #1.
618 next unless (&IsNickInChan($nick,$_));
619 $chanstats{$_}{'SignOff'}++;
621 &DeleteUserInfo($nick, keys %channels);
622 if (exists $nuh{lc $nick}) {
623 delete $nuh{lc $nick};
625 &DEBUG("on_quit: nuh{lc $nick} does not exist! FIXME");
627 delete $userstats{lc $nick} if (&IsParam("seenStats"));
629 # should fix chanstats inconsistencies bug #2.
630 if ($reason=~/^($mask{host})\s($mask{host})$/) { # netsplit.
631 $reason = "NETSPLIT: $1 <=> $2";
633 $netsplit{lc $nick} = time();
634 if (!exists $netsplitservers{$1}{$2}) {
635 &status("netsplit detected between $1 and $2.");
636 $netsplitservers{$1}{$2} = time();
640 &status(">>> $b_cyan$nick$ob has signed off IRC $b_red($ob$reason$b_red)$ob");
641 if ($nick =~ /^\Q$ident\E$/) {
642 &DEBUG("!!! THIS SHOULD NEVER HAPPEN. FIXME HOPEFULLY");
644 if ($nick !~ /^\Q$ident\E$/ and $nick =~ /^\Q$param{'ircNick'}\E$/i) {
645 &status("own nickname became free; changing.");
646 &nick($param{'ircNick'});
650 sub on_targettoofast {
651 my ($self, $event) = @_;
652 my $nick = $event->nick();
653 my $chan = ($event->to)[0];
655 &DEBUG("on_targettoofast: nick => '$nick'.");
656 &DEBUG("on_targettoofast: chan => '$chan'.");
658 foreach ($event->args) {
659 &DEBUG("on_targettoofast: args => '$_'.");
662 ### .* wait (\d+) second/) {
666 &status("going to sleep for $sleep...");
673 my ($self, $event) = @_;
675 if (scalar($event->args) == 1) { # change.
676 my $topic = ($event->args)[0];
677 my $chan = ($event->to)[0];
678 my $nick = $event->nick();
682 # race condition here. To fix, change '1' to '0'.
683 # This will keep track of topics set by bot only.
686 # this may be fixed at a later date with topic queueing.
689 $topic{$chan}{'Current'} = $topic if (1 and &IsParam("topic") == 1);
690 $chanstats{$chan}{'Topic'}++;
692 &status(">>> topic/$b_blue$chan$ob by $b_cyan$nick$ob -> $topic");
694 my ($nick, $chan, $topic) = $event->args;
695 if (&IsParam("topic")) {
696 $topic{$chan}{'Current'} = $topic;
697 &topicAddHistory($chan,$topic);
700 $topic = &fixString($topic, 1);
701 &status(">>> topic/$b_blue$chan$ob is $topic");
706 my ($self, $event) = @_;
707 my ($myself,$chan,$setby,$time) = $event->args();
710 if (time() - $time > 60*60*24) {
711 $timestr = "at ". localtime $time;
713 $timestr = &Time2String(time() - $time) ." ago";
716 &status(">>> set by $b_cyan$setby$ob $timestr");
720 my ($self, $event) = @_;
721 my $nick = $event->nick;
723 &status(">>> ${b_green}CTCP VERSION$ob request from $b_cyan$nick$ob");
724 $self->ctcp_reply($nick, "VERSION $bot_version");
728 my ($self, $event) = @_;
729 my @args = $event->args;
731 $nuh{lc $args[5]} = $args[5]."!".$args[2]."\@".$args[3];
735 my ($self, $event) = @_;
736 my @args = $event->args;
738 $nuh{lc $args[1]} = $args[1]."!".$args[2]."\@".$args[3];
741 #######################################################################
742 ####### IRC HOOK HELPERS IRC HOOK HELPERS IRC HOOK HELPERS ########
743 #######################################################################
746 # Usage: &hookMode($chan, $modes, @targets);
748 my ($chan, $modes, @targets) = @_;
751 $chan = lc $chan; # !!!.
754 foreach $mode (split(//, $modes)) {
756 if ($mode =~ /[-+]/) {
757 $parity = 1 if ($mode eq "+");
758 $parity = 0 if ($mode eq "-");
763 if ($mode =~ /[bklov]/) {
764 my $target = shift @targets;
767 $chanstats{$chan}{'Op'}++ if ($mode eq "o");
768 $chanstats{$chan}{'Ban'}++ if ($mode eq "b");
770 $chanstats{$chan}{'Deop'}++ if ($mode eq "o");
771 $chanstats{$chan}{'Unban'}++ if ($mode eq "b");
774 # modes w/ target affecting nick => cache it.
775 if ($mode =~ /[ov]/) {
776 $channels{$chan}{$mode}{$target}++ if $parity;
777 delete $channels{$chan}{$mode}{$target} if !$parity;
780 if ($mode =~ /[l]/) {
781 $channels{$chan}{$mode} = $target if $parity;
782 delete $channels{$chan}{$mode} if !$parity;
786 # important channel modes, targetless.
787 if ($mode =~ /[mt]/) {
788 $channels{$chan}{$mode}++ if $parity;
789 delete $channels{$chan}{$mode} if !$parity;
795 ($msgType, $chan, $who, $message) = @_;
799 $orig{message} = $message;
803 $message =~ s/[\cA-\c_]//ig; # strip control characters
804 $message =~ s/^\s+//; # initial whitespaces.
805 $who =~ tr/A-Z/a-z/; # lowercase.
810 if ($msgType =~ /private/) {
815 # addressing revamped by the xk.
816 ### below needs to be fixed...
817 if (&IsParam("addressCharacter")) {
818 if ($message =~ s/^$param{'addressCharacter'}//) {
824 if ($message =~ /^($mask{nick})([\;\:\>\, ]+) */) {
826 if ($1 =~ /^\Q$ident\E$/i) {
827 $message = $newmessage;
830 # ignore messages addressed to other people or unaddressed.
831 $skipmessage++ if ($2 ne "" and $2 !~ /^ /);
836 # Determine floodwho.
837 if ($msgType =~ /public/i) { # public.
838 $floodwho = lc $chan;
839 } elsif ($msgType =~ /private/i) { # private.
842 &DEBUG("FIXME: floodwho = ???");
845 my ($count, $interval) = split(/:/, $param{'floodRepeat'} || "2:10");
847 # flood repeat protection.
849 my $time = $flood{$floodwho}{$message};
851 if (defined $time and (time - $time < $interval)) {
852 ### public != personal who so the below is kind of pointless.
854 foreach (keys %flood) {
855 next if (/^\Q$floodwho\E$/ or /^\Q$chan\E$/);
856 push(@who, grep /^\Q$message\E$/i, keys %{$flood{$_}});
859 &msg($who, "you already said what ".join(@who)." have said.");
861 &msg($who,"Someone already said that ". (time - $time) ." seconds ago" );
864 ### TODO: delete old floodwarn{} keys.
866 if (!exists $floodwarn{$floodwho}) {
869 $floodwarn++ if (time() - $floodwarn{$floodwho} > $interval);
873 &status("FLOOD repetition detected from $floodwho.");
874 $floodwarn{$floodwho} = time();
881 &status("$b_cyan$who$ob is short-addressing me");
883 &status("$b_cyan$who$ob is addressing me");
886 $flood{$floodwho}{$message} = time();
889 ($count, $interval) = split(/:/, $param{'floodMessages'} || "5:30");
890 # flood overflow protection.
892 foreach (keys %{$flood{$floodwho}}) {
893 next unless (time() - $flood{$floodwho}{$_} > $interval);
894 delete $flood{$floodwho}{$_};
897 my $i = scalar keys %{$flood{$floodwho}};
899 &msg($who,"overflow of messages ($i > $count)");
900 &status("FLOOD overflow detected from $floodwho; ignoring");
902 my $expire = $param{'ignoreAutoExpire'} || 5;
903 $ignoreList{"*!$uh"} = time() + ($expire * 60);
907 $flood{$floodwho}{$message} = time();
911 if ($msgType =~ /public/i) {
912 $talkchannel = $chan;
913 &status("<$orig{who}/$chan> $orig{message}");
917 if ($msgType =~ /private/i) {
918 &status("[$orig{who}] $orig{message}");
921 if ((!$skipmessage or &IsParam("seenStoreAll")) and
925 $seencache{$who}{'time'} = time();
926 $seencache{$who}{'nick'} = $orig{who};
927 $seencache{$who}{'host'} = $uh;
928 $seencache{$who}{'chan'} = $talkchannel;
929 $seencache{$who}{'msg'} = $orig{message};
930 $seencache{$who}{'msgcount'}++;
933 return if ($skipmessage);
934 return unless (&IsParam("minVolunteerLength") or $addressed);
937 foreach (keys %ignoreList) {
939 my @parts = split /\*/, "a${ignoreRE}a";
940 my $recast = join '\S*', map quotemeta($_), @parts;
941 $recast =~ s/^a(.*)a$/$1/;
942 if ($nuh =~ /^$recast$/) {
949 $userHandle = &verifyUser($who, $nuh);
951 &DEBUG("hookMsg: 'nuh' not defined?");
954 ### For extra debugging purposes...
955 if ($_ = &process()) {
956 # &DEBUG("IrcHooks: process returned '$_'.");