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.");
48 &msg($nick, "could not get whois info?");
54 $orig{message} = $msg;
56 $uh = (split /\!/, $nuh)[1];
61 if (!exists $dcc{'CHAT'}{$nick}) {
62 $userHandle = &verifyUser($who, $nuh);
63 my $crypto = $userList{$userHandle}{'pass'};
66 if (!defined $crypto) {
67 &DEBUG("chat: no pass required.");
69 } elsif (&ckpasswd($msg, $crypto)) {
70 $self->privmsg($sock,"Authorized.");
71 $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'.");
72 # hrm... it's stupid to ask for factoids _within_ dcc chat.
73 # perhaps it should be default to commands, especially
74 # commands only authorized through DCC CHAT.
75 &status("DCC CHAT: passwd is ok.");
78 &status("DCC CHAT: incorrect pass; closing connection.");
79 &DEBUG("chat: sock => '$sock'.");
81 &DEBUG("chat: after closing sock. FIXME");
82 ### BUG: close seizes bot. why?
86 &status("DCC CHAT: user $nick is here!");
87 $dcc{'CHAT'}{$nick} = $sock;
88 &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 "$param{tempDir}/$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 "$param{tempDir}/$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 $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 if ($netsplit and !$netsplittime) {
352 &status("ok.... re-running chanlimitCheck in 60.");
353 $conn->schedule(60, sub {
355 $netsplittime = undef;
358 $netsplittime = time();
361 # how to tell if there's a netjoin???
363 my $netsplitstr = "";
364 $netsplitstr = " $b_yellow\[${ob}NETSPLIT VICTIM$b_yellow]$ob" if ($netsplit);
365 &status(">>> join/$b_blue$chan$ob $b_cyan$who$ob $b_yellow($ob$user\@$host$b_yellow)$ob$netsplitstr");
367 $channels{$chan}{''}{$who}++;
368 $nuh{lc $who} = $who."!".$user."\@".$host unless (exists $nuh{lc $who});
371 &rootWarn($who,$user,$host,$chan)
372 if (&IsParam("rootWarn") &&
373 $user =~ /^r(oo|ew|00)t$/i &&
374 $channels{$chan}{'o'}{$ident});
376 # used to determine sync time.
377 if ($who =~ /^$ident$/i) {
378 if (defined( my $whojoin = $joinverb{$chan} )) {
379 &msg($chan, "Okay, I'm here. (courtesy of $whojoin)");
380 delete $joinverb{$chan};
383 ### TODO: move this to &joinchan()?
384 $jointime{$chan} = &gettimeofday();
387 ### TODO: this may go wild on a netjoin :)
394 my ($self, $event) = @_;
395 my ($chan,$reason) = $event->args;
396 my $kicker = $event->nick;
397 my $kickee = ($event->to)[0];
398 my $uh = $event->userhost();
400 &status(">>> kick/$b_blue$chan$ob [$b$kickee!$uh$ob] by $b_cyan$kicker$ob $b_yellow($ob$reason$b_yellow)$ob");
402 $chanstats{$chan}{'Kick'}++;
404 if ($kickee eq $ident) {
405 &clearChanVars($chan);
407 &status("SELF attempting to rejoin lost channel $chan");
410 &DeleteUserInfo($kickee,$chan);
415 my ($self, $event) = @_;
416 my ($user, $host) = split(/\@/, $event->userhost);
417 my @args = $event->args();
418 my $nick = $event->nick();
419 my $chan = ($event->to)[0];
423 if ($nick eq $chan) { # UMODE
424 &status(">>> mode $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
426 &status(">>> mode/$b_blue$chan$ob $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
427 &hookMode($chan, @args);
432 my ($self, $event) = @_;
433 my $nick = $event->nick();
434 my ($myself,$chan,@args) = $event->args();
436 &hookMode(lc $chan, @args); # CASING.
440 my ($self, $event) = @_;
441 my $nick = $event->nick;
442 my $chan = lc ( ($event->to)[0] ); # CASING.
443 my $msg = ($event->args)[0];
445 ($user,$host) = split(/\@/, $event->userhost);
446 $uh = $event->userhost();
447 $nuh = $nick."!".$uh;
449 &hookMsg('private', $chan, $nick, $msg);
453 my ($self, $event) = @_;
454 my @args = $event->args;
455 my $chan = lc $args[2]; # CASING, the last of them!
457 foreach (split / /, @args[3..$#args]) {
458 $channels{$chan}{'o'}{$_}++ if s/\@//;
459 $channels{$chan}{'v'}{$_}++ if s/\+//;
460 $channels{$chan}{''}{$_}++;
465 my ($self, $event) = @_;
466 my $nick = $event->nick();
467 my $newnick = ($event->args)[0];
469 if (exists $netsplit{lc $newnick}) {
470 &status("Netsplit: $newnick/$nick came back from netsplit and changed to original nick! removing from hash.");
471 delete $netsplit{lc $newnick};
475 foreach $chan (keys %channels) {
476 foreach $mode (keys %{$channels{$chan}}) {
477 next unless (exists $channels{$chan}{$mode}{$nick});
479 $channels{$chan}{$mode}{$newnick} = $channels{$chan}{$mode}{$nick};
482 &DeleteUserInfo($nick,keys %channels);
483 $nuh{lc $newnick} = $nuh{lc $nick};
484 delete $nuh{lc $nick};
486 # successful self-nick change.
487 if ($nick eq $ident) {
488 &status(">>> I materialized into $b_green$newnick$ob from $nick");
491 &status(">>> $b_cyan$nick$ob materializes into $b_green$newnick$ob");
497 my $nick = $self->nick;
498 my $newnick = substr($nick,0,7)."-";
500 &status("nick taken; changing to temporary nick.");
506 my ($self, $event) = @_;
507 my $nick = $event->nick();
508 my $chan = ($event->to)[0];
509 my $args = ($event->args)[0];
511 if ($nick =~ /^NickServ$/i) { # nickserv.
512 &status("NickServ: <== '$args'");
514 if ($args =~ /^This nickname is registered/i) {
515 &status("nickserv told us to register; doing it.");
516 if (&IsParam("nickServ_pass")) {
517 &status("NickServ: ==> Identifying.");
518 &rawout("PRIVMSG NickServ :IDENTIFY $param{'nickServ_pass'}");
521 &status("We can't tell nickserv a passwd ;(");
526 if ($args =~ /^Password a/i) {
529 } elsif ($nick =~ /^ChanServ$/i) { # chanserv.
530 &status("ChanServ: <== '$args'.");
532 if ($chan =~ /^$mask{chan}$/) { # channel notice.
533 &status("-$nick/$chan- $args");
535 $server = $nick unless (defined $server);
536 &status("-$nick- $args"); # private or server notice.
542 my ($self, $event) = @_;
543 my $chan = ($event->to)[0];
544 my $nick = $event->nick;
546 &status("!!! other called.");
547 &status("!!! $event->args");
551 my ($self, $event) = @_;
552 my $chan = lc( ($event->to)[0] ); # CASING!!!
553 my $nick = $event->nick;
554 my $userhost = $event->userhost;
556 $chanstats{$chan}{'Part'}++;
557 &DeleteUserInfo($nick,$chan);
558 &clearChanVars($chan) if ($nick eq $ident);
559 if (!&IsNickInAnyChan($nick) and &IsParam("seenStats")) {
560 delete $userstats{lc $nick};
563 &status(">>> part/$b_blue$chan$ob $b_cyan$nick$ob $b_yellow($ob$userhost$b_yellow)$ob");
567 my ($self, $event) = @_;
568 my $nick = $event->nick;
570 $self->ctcp_reply($nick, join(' ', ($event->args)));
571 &status(">>> ${b_green}CTCP PING$ob request from $b_cyan$nick$ob received.");
575 my ($self, $event) = @_;
576 my $nick = $event->nick;
577 my $lag = time() - ($event->args)[1];
579 &status(">>> ${b_green}CTCP PING$ob reply from $b_cyan$nick$ob: $lag sec.");
583 my ($self, $event) = @_;
584 my $msg = ($event->args)[0];
585 my $chan = lc( ($event->to)[0] ); # CASING.
586 my $nick = $event->nick;
587 $uh = $event->userhost();
588 $nuh = $nick."!".$uh;
589 ($user,$host) = split(/\@/, $uh);
591 if ($$ != $bot_pid) {
592 &ERROR("SHOULD NEVER HAPPEN.");
597 if ($statcount < 200) {
598 foreach $chan (grep /[A-Z]/, keys %channels) {
599 &DEBUG("leak: chan => '$chan'.");
601 foreach $i (keys %{$channels{$chan}}) {
602 foreach (keys %{$channels{$chan}{$i}}) {
603 &DEBUG("leak: \$channels{$chan}{$i}{$_} ...");
611 $lastWho{$chan} = $nick;
612 ### TODO: use $nick or lc $nick?
613 if (&IsParam("seenStats")) {
614 $userstats{lc $nick}{'Count'}++;
615 $userstats{lc $nick}{'Time'} = time();
618 # if (&IsParam("hehCounter")) {
622 &hookMsg('public', $chan, $nick, $msg);
623 $chanstats{$chan}{'PublicMsg'}++;
627 my ($self, $event) = @_;
628 my $nick = $event->nick();
629 my $reason = ($event->args)[0];
631 foreach (keys %channels) {
632 # fixes inconsistent chanstats bug #1.
633 next unless (&IsNickInChan($nick,$_));
634 $chanstats{$_}{'SignOff'}++;
636 &DeleteUserInfo($nick, keys %channels);
637 if (exists $nuh{lc $nick}) {
638 delete $nuh{lc $nick};
640 &DEBUG("on_quit: nuh{lc $nick} does not exist! FIXME");
642 delete $userstats{lc $nick} if (&IsParam("seenStats"));
644 # should fix chanstats inconsistencies bug #2.
645 if ($reason=~/^($mask{host})\s($mask{host})$/) { # netsplit.
646 $reason = "NETSPLIT: $1 <=> $2";
648 $netsplit{lc $nick} = time();
649 if (!exists $netsplitservers{$1}{$2}) {
650 &status("netsplit detected between $1 and $2.");
651 $netsplitservers{$1}{$2} = time();
655 &status(">>> $b_cyan$nick$ob has signed off IRC $b_red($ob$reason$b_red)$ob");
656 if ($nick =~ /^\Q$ident\E$/) {
657 &DEBUG("!!! THIS SHOULD NEVER HAPPEN. FIXME HOPEFULLY");
659 if ($nick !~ /^\Q$ident\E$/ and $nick =~ /^\Q$param{'ircNick'}\E$/i) {
660 &status("own nickname became free; changing.");
661 &nick($param{'ircNick'});
665 sub on_targettoofast {
666 my ($self, $event) = @_;
667 my $nick = $event->nick();
668 my $chan = ($event->to)[0];
670 &DEBUG("on_targettoofast: nick => '$nick'.");
671 &DEBUG("on_targettoofast: chan => '$chan'.");
673 foreach ($event->args) {
674 &DEBUG("on_targettoofast: args => '$_'.");
677 ### .* wait (\d+) second/) {
681 &status("going to sleep for $sleep...");
688 my ($self, $event) = @_;
690 if (scalar($event->args) == 1) { # change.
691 my $topic = ($event->args)[0];
692 my $chan = ($event->to)[0];
693 my $nick = $event->nick();
697 # race condition here. To fix, change '1' to '0'.
698 # This will keep track of topics set by bot only.
701 # this may be fixed at a later date with topic queueing.
704 $topic{$chan}{'Current'} = $topic if (1 and &IsParam("topic") == 1);
705 $chanstats{$chan}{'Topic'}++;
707 &status(">>> topic/$b_blue$chan$ob by $b_cyan$nick$ob -> $topic");
709 my ($nick, $chan, $topic) = $event->args;
710 if (&IsParam("topic")) {
711 $topic{$chan}{'Current'} = $topic;
712 &topicAddHistory($chan,$topic);
715 $topic = &fixString($topic, 1);
716 &status(">>> topic/$b_blue$chan$ob is $topic");
721 my ($self, $event) = @_;
722 my ($myself,$chan,$setby,$time) = $event->args();
725 if (time() - $time > 60*60*24) {
726 $timestr = "at ". localtime $time;
728 $timestr = &Time2String(time() - $time) ." ago";
731 &status(">>> set by $b_cyan$setby$ob $timestr");
735 my ($self, $event) = @_;
736 my $nick = $event->nick;
738 &status(">>> ${b_green}CTCP VERSION$ob request from $b_cyan$nick$ob");
739 $self->ctcp_reply($nick, "VERSION $bot_version");
743 my ($self, $event) = @_;
744 my @args = $event->args;
746 $nuh{lc $args[5]} = $args[5]."!".$args[2]."\@".$args[3];
750 my ($self, $event) = @_;
751 my @args = $event->args;
753 $nuh{lc $args[1]} = $args[1]."!".$args[2]."\@".$args[3];
756 #######################################################################
757 ####### IRC HOOK HELPERS IRC HOOK HELPERS IRC HOOK HELPERS ########
758 #######################################################################
761 # Usage: &hookMode($chan, $modes, @targets);
763 my ($chan, $modes, @targets) = @_;
766 $chan = lc $chan; # !!!.
769 foreach $mode (split(//, $modes)) {
771 if ($mode =~ /[-+]/) {
772 $parity = 1 if ($mode eq "+");
773 $parity = 0 if ($mode eq "-");
778 if ($mode =~ /[bklov]/) {
779 my $target = shift @targets;
782 $chanstats{$chan}{'Op'}++ if ($mode eq "o");
783 $chanstats{$chan}{'Ban'}++ if ($mode eq "b");
785 $chanstats{$chan}{'Deop'}++ if ($mode eq "o");
786 $chanstats{$chan}{'Unban'}++ if ($mode eq "b");
789 # modes w/ target affecting nick => cache it.
790 if ($mode =~ /[ov]/) {
791 $channels{$chan}{$mode}{$target}++ if $parity;
792 delete $channels{$chan}{$mode}{$target} if !$parity;
795 if ($mode =~ /[l]/) {
796 $channels{$chan}{$mode} = $target if $parity;
797 delete $channels{$chan}{$mode} if !$parity;
801 # important channel modes, targetless.
802 if ($mode =~ /[mt]/) {
803 $channels{$chan}{$mode}++ if $parity;
804 delete $channels{$chan}{$mode} if !$parity;
810 ($msgType, $chan, $who, $message) = @_;
814 $orig{message} = $message;
818 $message =~ s/[\cA-\c_]//ig; # strip control characters
819 $message =~ s/^\s+//; # initial whitespaces.
820 $who =~ tr/A-Z/a-z/; # lowercase.
825 if ($msgType =~ /private/) {
830 # addressing revamped by the xk.
831 ### below needs to be fixed...
832 if (&IsParam("addressCharacter")) {
833 if ($message =~ s/^$param{'addressCharacter'}//) {
839 if ($message =~ /^($mask{nick})([\;\:\>\, ]+) */) {
841 if ($1 =~ /^\Q$ident\E$/i) {
842 $message = $newmessage;
845 # ignore messages addressed to other people or unaddressed.
846 $skipmessage++ if ($2 ne "" and $2 !~ /^ /);
851 # Determine floodwho.
852 if ($msgType =~ /public/i) { # public.
853 $floodwho = lc $chan;
854 } elsif ($msgType =~ /private/i) { # private.
857 &DEBUG("FIXME: floodwho = ???");
860 my ($count, $interval) = split(/:/, $param{'floodRepeat'} || "2:10");
862 # flood repeat protection.
864 my $time = $flood{$floodwho}{$message};
866 if (defined $time and (time - $time < $interval)) {
867 ### public != personal who so the below is kind of pointless.
869 foreach (keys %flood) {
870 next if (/^\Q$floodwho\E$/ or /^\Q$chan\E$/);
871 push(@who, grep /^\Q$message\E$/i, keys %{$flood{$_}});
874 &msg($who, "you already said what ".
875 join(' ', @who)." have said.");
877 &msg($who,"Someone already said that ". (time - $time) ." seconds ago" );
880 ### TODO: delete old floodwarn{} keys.
882 if (!exists $floodwarn{$floodwho}) {
885 $floodwarn++ if (time() - $floodwarn{$floodwho} > $interval);
889 &status("FLOOD repetition detected from $floodwho.");
890 $floodwarn{$floodwho} = time();
897 &status("$b_cyan$who$ob is short-addressing me");
899 &status("$b_cyan$who$ob is addressing me");
902 $flood{$floodwho}{$message} = time();
905 ($count, $interval) = split(/:/, $param{'floodMessages'} || "5:30");
906 # flood overflow protection.
908 foreach (keys %{$flood{$floodwho}}) {
909 next unless (time() - $flood{$floodwho}{$_} > $interval);
910 delete $flood{$floodwho}{$_};
913 my $i = scalar keys %{$flood{$floodwho}};
915 &msg($who,"overflow of messages ($i > $count)");
916 &status("FLOOD overflow detected from $floodwho; ignoring");
918 my $expire = $param{'ignoreAutoExpire'} || 5;
919 $ignoreList{"*!$uh"} = time() + ($expire * 60);
923 $flood{$floodwho}{$message} = time();
927 if ($msgType =~ /public/i) {
928 $talkchannel = $chan;
929 &status("<$orig{who}/$chan> $orig{message}");
933 if ($msgType =~ /private/i) {
934 &status("[$orig{who}] $orig{message}");
937 if ((!$skipmessage or &IsParam("seenStoreAll")) and
941 $seencache{$who}{'time'} = time();
942 $seencache{$who}{'nick'} = $orig{who};
943 $seencache{$who}{'host'} = $uh;
944 $seencache{$who}{'chan'} = $talkchannel;
945 $seencache{$who}{'msg'} = $orig{message};
946 $seencache{$who}{'msgcount'}++;
949 return if ($skipmessage);
950 return unless (&IsParam("minVolunteerLength") or $addressed);
953 foreach (keys %ignoreList) {
955 my @parts = split /\*/, "a${ignoreRE}a";
956 my $recast = join '\S*', map quotemeta($_), @parts;
957 $recast =~ s/^a(.*)a$/$1/;
958 if ($nuh =~ /^$recast$/) {
965 $userHandle = &verifyUser($who, $nuh);
967 &DEBUG("hookMsg: 'nuh' not defined?");
970 ### For extra debugging purposes...
971 if ($_ = &process()) {
972 # &DEBUG("IrcHooks: process returned '$_'.");