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{'CHATvrfy'}{$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 delete $dcc{'CHAT'}{$nick};
82 &DEBUG("chat: after closing sock. FIXME");
83 ### BUG: close seizes bot. why?
87 &status("DCC CHAT: user $nick is here!");
88 &DCCBroadcast("$nick ($uh) has joined the chat arena.");
89 $dcc{'CHATvrfy'}{$nick} = 1;
90 if ($userHandle ne "default") {
91 &dccsay($nick,"Flags: $userList{$userHandle}{'flags'}");
98 $userHandle = &verifyUser($who, $nuh);
99 &status("$b_red=$b_cyan$who$b_red=$ob $message");
100 if ($message =~ s/^\.//) { # dcc chat commands.
101 ### TODO: make use of &Forker(); here?
102 &loadMyModule($myModules{'ircdcc'});
103 return '$noreply from userD' if (&userDCC() eq $noreply);
104 $conn->privmsg($dcc{'CHAT'}{$who}, "Invalid command.");
106 } else { # dcc chat arena.
107 foreach (keys %{$dcc{'CHAT'}}) {
108 $conn->privmsg($dcc{'CHAT'}{$_}, "<$who> $orig{message}");
112 return 'DCC CHAT MESSAGE';
118 # what's the following for?
119 $ident = $param{'ircNick'};
121 $ircstats{'ConnectTime'} = time();
122 $ircstats{'ConnectCount'}++;
124 if (&IsParam("wingate")) {
125 my $file = "$bot_base_dir/$param{'ircUser'}.wingate";
129 next unless (/^(\S+)\*$/);
130 push(@wingateBad, $_);
136 $conn->schedule(60, \&setupSchedulers, "");
140 if (&IsParam("ircUMode")) {
141 &status("Attempting change of user modes to $param{'ircUMode'}.");
142 &rawout("MODE $ident $param{'ircUMode'}");
145 &status("End of motd. Now lets join some channels...");
146 if (!scalar @joinchan) {
147 &WARN("joinchan array is empty!!!");
148 @joinchan = split /[\t\s]+/, $param{'join_channels'};
155 my ($self, $event) = @_;
156 my $type = uc( ($event->args)[1] );
157 my $nick = $event->nick();
159 # pity Net::IRC doesn't store nuh. Here's a hack :)
163 if ($type eq 'SEND') { # GET for us.
164 # incoming DCC SEND. we're receiving a file.
165 my $get = ($event->args)[2];
166 open(DCCGET,">$get");
168 $self->new_get($nick,
175 } elsif ($type eq 'GET') { # SEND for us?
176 &DEBUG("starting get.");
177 $self->new_send($event->args);
178 } elsif ($type eq 'CHAT') {
179 &DEBUG("starting chat.");
180 $self->new_chat($event);
182 &WARN("${b_green}DCC $type$ob (1)");
187 my ($self, $event) = @_;
188 my $nick = $event->nick();
189 my $sock = ($event->to)[0];
191 # DCC CHAT close on fork exit workaround.
192 return if ($bot_pid != $$);
194 &DEBUG("dcc_close: nick => '$nick'.");
196 if (exists $dcc{'SEND'}{$nick} and -f "$param{tempDir}/$nick.txt") {
197 &status("${b_green}DCC SEND$ob close from $b_cyan$nick$ob");
199 &status("dcc_close: purging $nick.txt from Debian.pl");
200 unlink "$param{tempDir}/$nick.txt";
202 delete $dcc{'SEND'}{$nick};
203 } elsif (exists $dcc{'CHAT'}{$nick} and $dcc{'CHAT'}{$nick} eq $sock) {
204 &status("${b_green}DCC CHAT$ob close from $b_cyan$nick$ob");
205 delete $dcc{'CHAT'}{$nick};
207 &status("${b_green}DCC$ob UNKNOWN close from $b_cyan$nick$ob (2)");
212 my ($self, $event) = @_;
213 my $type = uc( ($event->args)[0] );
214 my $nick = $event->nick();
215 my $sock = ($event->to)[0];
220 if ($type eq 'SEND') {
221 &status("${b_green}DCC lGET$ob established with $b_cyan$nick$ob");
222 } elsif ($type eq 'CHAT') {
223 &status("${b_green}DCC CHAT$ob established with $b_cyan$nick$ob $b_yellow($ob$nuh{$nick}$b_yellow)$ob");
224 $userHandle = &verifyUser($nick, $nuh{lc $nick});
225 my $crypto = $userList{$userHandle}{'pass'};
226 $dcc{'CHAT'}{$nick} = $sock;
228 if (defined $crypto) {
229 &dccsay($nick,"Enter Password, $userHandle.");
231 &dccsay($nick,"Welcome to blootbot DCC CHAT interface, $userHandle.");
233 } elsif ($type eq 'SEND') {
234 &DEBUG("Starting DCC receive.");
235 foreach ($event->args) {
239 &WARN("${b_green}DCC $type$ob (3)");
244 my ($self, $event) = @_;
245 my $from = $event->from();
246 my $what = ($event->args)[0];
248 &status("disconnect from $from ($what).");
249 $ircstats{'DisconnectTime'} = time();
250 $ircstats{'DisconnectReason'} = $what;
251 $ircstats{'DisconnectCount'}++;
253 # clear any variables on reconnection.
257 if (!$self->connect()) {
258 &WARN("not connected? help me. gonna call ircCheck() in 1800s");
259 $conn->schedule(1800, \&ircCheck(), "");
264 my ($self, $event) = @_;
265 my $chan = ($event->args)[1];
267 if (exists $jointime{$chan}) {
268 my $delta_time = sprintf("%.03f", &gettimeofday() - $jointime{$chan});
269 $delta_time = 0 if ($delta_time < 0);
271 &status("$b_blue$chan$ob: sync in ${delta_time}s.");
274 rawout("MODE $chan");
278 foreach ("o","v","") {
279 my $count = scalar(keys %{$channels{$chan}{$_}});
280 next unless ($count);
282 $txt = "total" if ($_ eq "");
283 $txt = "voice" if ($_ eq "v");
284 $txt = "ops" if ($_ eq "o");
286 push(@array, "$count $txt");
288 my $chanstats = join(' || ', @array);
289 &status("$b_blue$chan$ob: [$chanstats]");
291 if (scalar @joinchan) { # remaining channels to join.
294 ### chanserv support.
295 ### TODO: what if we rejoin a channel.. need to set a var that
296 ### we've done the request-for-ops-on-join.
297 return unless (&IsParam("chanServ_ops"));
298 return unless ($nickserv);
300 my @chans = split(/[\s\t]+/, $param{'chanServ_ops'});
302 ### TODO: since this function has a chan arg, why don't we use
303 ### that instead of doing the following?
304 foreach $chan (keys %channels) {
305 next unless (grep /^$chan$/i, @chans);
307 if (!exists $channels{$chan}{'o'}{$ident}) {
308 &status("ChanServ ==> Requesting ops for $chan.");
309 &rawout("PRIVMSG ChanServ :OP $chan $ident");
317 my ($self, $event) = @_;
318 my (@args) = ($event->args);
325 my ($self, $event) = @_;
326 my $chan = ($event->args)[0];
327 my $nick = $event->nick;
329 &DEBUG("on_invite: chan => '$chan', nick => '$nick'.");
331 # chan + possible_key.
332 ### do we need to know the key if we're invited???
333 ### grep the channel list?
334 foreach (split /[\s\t]+/, $param{'join_channels'}) {
335 next unless /^\Q$chan\E(,\S+)?$/i;
338 next if ($nick =~ /^\Q$ident\E$/);
339 if (&validChan($chan)) {
340 &msg($who, "i'm already in \002$chan\002.");
344 &status("invited to $b_blue$_$ob by $b_cyan$who$ob");
345 &joinchan($self, $_);
350 my ($self, $event) = @_;
351 my ($user,$host) = split(/\@/, $event->userhost);
352 $chan = lc( ($event->to)[0] ); # CASING!!!!
353 $who = $event->nick();
355 $chanstats{$chan}{'Join'}++;
356 $userstats{lc $who}{'Join'} = time() if (&IsParam("seenStats"));
358 &joinfloodCheck($who, $chan, $event->userhost);
362 if (exists $netsplit{lc $who}) {
363 delete $netsplit{lc $who};
367 if ($netsplit and !$netsplittime) {
368 &status("ok.... re-running chanlimitCheck in 60.");
369 $conn->schedule(60, sub {
371 $netsplittime = undef;
374 $netsplittime = time();
377 # how to tell if there's a netjoin???
379 my $netsplitstr = "";
380 $netsplitstr = " $b_yellow\[${ob}NETSPLIT VICTIM$b_yellow]$ob" if ($netsplit);
381 &status(">>> join/$b_blue$chan$ob $b_cyan$who$ob $b_yellow($ob$user\@$host$b_yellow)$ob$netsplitstr");
383 $channels{$chan}{''}{$who}++;
384 $nuh{lc $who} = $who."!".$user."\@".$host unless (exists $nuh{lc $who});
387 &rootWarn($who,$user,$host,$chan)
388 if (&IsParam("rootWarn") &&
389 $user =~ /^r(oo|ew|00)t$/i &&
390 $channels{$chan}{'o'}{$ident});
392 # used to determine sync time.
393 if ($who =~ /^$ident$/i) {
394 if (defined( my $whojoin = $joinverb{$chan} )) {
395 &msg($chan, "Okay, I'm here. (courtesy of $whojoin)");
396 delete $joinverb{$chan};
399 ### TODO: move this to &joinchan()?
400 $jointime{$chan} = &gettimeofday();
403 ### TODO: this may go wild on a netjoin :)
410 my ($self, $event) = @_;
411 my ($chan,$reason) = $event->args;
412 my $kicker = $event->nick;
413 my $kickee = ($event->to)[0];
414 my $uh = $event->userhost();
416 &status(">>> kick/$b_blue$chan$ob [$b$kickee!$uh$ob] by $b_cyan$kicker$ob $b_yellow($ob$reason$b_yellow)$ob");
418 $chan = lc $chan; # forgot about this, found by xsdg, 20001229.
419 $chanstats{$chan}{'Kick'}++;
421 if ($kickee eq $ident) {
422 &clearChanVars($chan);
424 &status("SELF attempting to rejoin lost channel $chan");
427 &DeleteUserInfo($kickee,$chan);
432 my ($self, $event) = @_;
433 my ($user, $host) = split(/\@/, $event->userhost);
434 my @args = $event->args();
435 my $nick = $event->nick();
436 my $chan = ($event->to)[0];
440 if ($nick eq $chan) { # UMODE
441 &status(">>> mode $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
443 &status(">>> mode/$b_blue$chan$ob $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
444 &hookMode($chan, @args);
449 my ($self, $event) = @_;
450 my $nick = $event->nick();
451 my ($myself,$chan,@args) = $event->args();
453 &hookMode(lc $chan, @args); # CASING.
457 my ($self, $event) = @_;
458 my $nick = $event->nick;
459 my $chan = lc ( ($event->to)[0] ); # CASING.
460 my $msg = ($event->args)[0];
462 ($user,$host) = split(/\@/, $event->userhost);
463 $uh = $event->userhost();
464 $nuh = $nick."!".$uh;
466 &hookMsg('private', $chan, $nick, $msg);
470 my ($self, $event) = @_;
471 my @args = $event->args;
472 my $chan = lc $args[2]; # CASING, the last of them!
474 foreach (split / /, @args[3..$#args]) {
475 $channels{$chan}{'o'}{$_}++ if s/\@//;
476 $channels{$chan}{'v'}{$_}++ if s/\+//;
477 $channels{$chan}{''}{$_}++;
482 my ($self, $event) = @_;
483 my $nick = $event->nick();
484 my $newnick = ($event->args)[0];
486 if (exists $netsplit{lc $newnick}) {
487 &status("Netsplit: $newnick/$nick came back from netsplit and changed to original nick! removing from hash.");
488 delete $netsplit{lc $newnick};
492 foreach $chan (keys %channels) {
493 foreach $mode (keys %{$channels{$chan}}) {
494 next unless (exists $channels{$chan}{$mode}{$nick});
496 $channels{$chan}{$mode}{$newnick} = $channels{$chan}{$mode}{$nick};
499 &DeleteUserInfo($nick,keys %channels);
500 $nuh{lc $newnick} = $nuh{lc $nick};
501 delete $nuh{lc $nick};
503 # successful self-nick change.
504 if ($nick eq $ident) {
505 &status(">>> I materialized into $b_green$newnick$ob from $nick");
508 &status(">>> $b_cyan$nick$ob materializes into $b_green$newnick$ob");
514 my $nick = $self->nick;
515 my $newnick = substr($nick,0,7)."-";
517 &status("nick taken; changing to temporary nick.");
523 my ($self, $event) = @_;
524 my $nick = $event->nick();
525 my $chan = ($event->to)[0];
526 my $args = ($event->args)[0];
528 if ($nick =~ /^NickServ$/i) { # nickserv.
529 &status("NickServ: <== '$args'");
531 if ($args =~ /^This nickname is registered/i) {
532 &status("nickserv told us to register; doing it.");
533 if (&IsParam("nickServ_pass")) {
534 &status("NickServ: ==> Identifying.");
535 &rawout("PRIVMSG NickServ :IDENTIFY $param{'nickServ_pass'}");
538 &status("We can't tell nickserv a passwd ;(");
543 if ($args =~ /^Password a/i) {
546 } elsif ($nick =~ /^ChanServ$/i) { # chanserv.
547 &status("ChanServ: <== '$args'.");
549 if ($chan =~ /^$mask{chan}$/) { # channel notice.
550 &status("-$nick/$chan- $args");
552 $server = $nick unless (defined $server);
553 &status("-$nick- $args"); # private or server notice.
559 my ($self, $event) = @_;
560 my $chan = ($event->to)[0];
561 my $nick = $event->nick;
563 &status("!!! other called.");
564 &status("!!! $event->args");
568 my ($self, $event) = @_;
569 my $chan = lc( ($event->to)[0] ); # CASING!!!
570 my $nick = $event->nick;
571 my $userhost = $event->userhost;
573 if (!exists $floodjoin{$chan}{$nick}{Time}) {
574 &WARN("on_part: $nick/$chan not in floodjoin hash?");
576 delete $floodjoin{$chan}{$nick};
579 $chanstats{$chan}{'Part'}++;
580 &DeleteUserInfo($nick,$chan);
581 &clearChanVars($chan) if ($nick eq $ident);
582 if (!&IsNickInAnyChan($nick) and &IsParam("seenStats")) {
583 delete $userstats{lc $nick};
586 &status(">>> part/$b_blue$chan$ob $b_cyan$nick$ob $b_yellow($ob$userhost$b_yellow)$ob");
590 my ($self, $event) = @_;
591 my $nick = $event->nick;
593 $self->ctcp_reply($nick, join(' ', ($event->args)));
594 &status(">>> ${b_green}CTCP PING$ob request from $b_cyan$nick$ob received.");
598 my ($self, $event) = @_;
599 my $nick = $event->nick;
600 my $lag = time() - ($event->args)[1];
602 &status(">>> ${b_green}CTCP PING$ob reply from $b_cyan$nick$ob: $lag sec.");
606 my ($self, $event) = @_;
607 my $msg = ($event->args)[0];
608 my $chan = lc( ($event->to)[0] ); # CASING.
609 my $nick = $event->nick;
610 $uh = $event->userhost();
611 $nuh = $nick."!".$uh;
612 ($user,$host) = split(/\@/, $uh);
614 if ($$ != $bot_pid) {
615 &ERROR("SHOULD NEVER HAPPEN.");
620 if ($statcount < 200) {
621 foreach $chan (grep /[A-Z]/, keys %channels) {
622 &DEBUG("leak: chan => '$chan'.");
624 foreach $i (keys %{$channels{$chan}}) {
625 foreach (keys %{$channels{$chan}{$i}}) {
626 &DEBUG("leak: \$channels{$chan}{$i}{$_} ...");
634 $lastWho{$chan} = $nick;
635 ### TODO: use $nick or lc $nick?
636 if (&IsParam("seenStats")) {
637 $userstats{lc $nick}{'Count'}++;
638 $userstats{lc $nick}{'Time'} = time();
641 # if (&IsParam("hehCounter")) {
645 &hookMsg('public', $chan, $nick, $msg);
646 $chanstats{$chan}{'PublicMsg'}++;
650 my ($self, $event) = @_;
651 my $nick = $event->nick();
652 my $reason = ($event->args)[0];
654 foreach (keys %channels) {
655 # fixes inconsistent chanstats bug #1.
656 next unless (&IsNickInChan($nick,$_));
657 $chanstats{$_}{'SignOff'}++;
659 &DeleteUserInfo($nick, keys %channels);
660 if (exists $nuh{lc $nick}) {
661 delete $nuh{lc $nick};
663 &DEBUG("on_quit: nuh{lc $nick} does not exist! FIXME");
665 delete $userstats{lc $nick} if (&IsParam("seenStats"));
667 # should fix chanstats inconsistencies bug #2.
668 if ($reason=~/^($mask{host})\s($mask{host})$/) { # netsplit.
669 $reason = "NETSPLIT: $1 <=> $2";
671 $netsplit{lc $nick} = time();
672 if (!exists $netsplitservers{$1}{$2}) {
673 &status("netsplit detected between $1 and $2.");
674 $netsplitservers{$1}{$2} = time();
678 &status(">>> $b_cyan$nick$ob has signed off IRC $b_red($ob$reason$b_red)$ob");
679 if ($nick =~ /^\Q$ident\E$/) {
680 &DEBUG("!!! THIS SHOULD NEVER HAPPEN. FIXME HOPEFULLY");
682 if ($nick !~ /^\Q$ident\E$/ and $nick =~ /^\Q$param{'ircNick'}\E$/i) {
683 &status("own nickname became free; changing.");
684 &nick($param{'ircNick'});
688 sub on_targettoofast {
689 my ($self, $event) = @_;
690 my $nick = $event->nick();
691 my $chan = ($event->to)[0];
693 &DEBUG("on_targettoofast: nick => '$nick'.");
694 &DEBUG("on_targettoofast: chan => '$chan'.");
696 foreach ($event->args) {
697 &DEBUG("on_targettoofast: args => '$_'.");
700 ### .* wait (\d+) second/) {
704 &status("going to sleep for $sleep...");
711 my ($self, $event) = @_;
713 if (scalar($event->args) == 1) { # change.
714 my $topic = ($event->args)[0];
715 my $chan = ($event->to)[0];
716 my $nick = $event->nick();
720 # race condition here. To fix, change '1' to '0'.
721 # This will keep track of topics set by bot only.
724 # this may be fixed at a later date with topic queueing.
727 $topic{$chan}{'Current'} = $topic if (1 and &IsParam("topic") == 1);
728 $chanstats{$chan}{'Topic'}++;
730 &status(">>> topic/$b_blue$chan$ob by $b_cyan$nick$ob -> $topic");
732 my ($nick, $chan, $topic) = $event->args;
733 if (&IsParam("topic")) {
734 $topic{$chan}{'Current'} = $topic;
735 &topicAddHistory($chan,$topic);
738 $topic = &fixString($topic, 1);
739 &status(">>> topic/$b_blue$chan$ob is $topic");
744 my ($self, $event) = @_;
745 my ($myself,$chan,$setby,$time) = $event->args();
748 if (time() - $time > 60*60*24) {
749 $timestr = "at ". localtime $time;
751 $timestr = &Time2String(time() - $time) ." ago";
754 &status(">>> set by $b_cyan$setby$ob $timestr");
758 my ($self, $event) = @_;
759 my $nick = $event->nick;
761 &status(">>> ${b_green}CTCP VERSION$ob request from $b_cyan$nick$ob");
762 $self->ctcp_reply($nick, "VERSION $bot_version");
766 my ($self, $event) = @_;
767 my @args = $event->args;
769 $nuh{lc $args[5]} = $args[5]."!".$args[2]."\@".$args[3];
773 my ($self, $event) = @_;
774 my @args = $event->args;
776 $nuh{lc $args[1]} = $args[1]."!".$args[2]."\@".$args[3];
779 #######################################################################
780 ####### IRC HOOK HELPERS IRC HOOK HELPERS IRC HOOK HELPERS ########
781 #######################################################################
784 # Usage: &hookMode($chan, $modes, @targets);
786 my ($chan, $modes, @targets) = @_;
789 $chan = lc $chan; # !!!.
792 foreach $mode (split(//, $modes)) {
794 if ($mode =~ /[-+]/) {
795 $parity = 1 if ($mode eq "+");
796 $parity = 0 if ($mode eq "-");
801 if ($mode =~ /[bklov]/) {
802 my $target = shift @targets;
805 $chanstats{$chan}{'Op'}++ if ($mode eq "o");
806 $chanstats{$chan}{'Ban'}++ if ($mode eq "b");
808 $chanstats{$chan}{'Deop'}++ if ($mode eq "o");
809 $chanstats{$chan}{'Unban'}++ if ($mode eq "b");
812 # modes w/ target affecting nick => cache it.
813 if ($mode =~ /[ov]/) {
814 $channels{$chan}{$mode}{$target}++ if $parity;
815 delete $channels{$chan}{$mode}{$target} if !$parity;
818 if ($mode =~ /[l]/) {
819 $channels{$chan}{$mode} = $target if $parity;
820 delete $channels{$chan}{$mode} if !$parity;
824 # important channel modes, targetless.
825 if ($mode =~ /[mt]/) {
826 $channels{$chan}{$mode}++ if $parity;
827 delete $channels{$chan}{$mode} if !$parity;
833 ($msgType, $chan, $who, $message) = @_;
837 $orig{message} = $message;
841 $message =~ s/[\cA-\c_]//ig; # strip control characters
842 $message =~ s/^\s+//; # initial whitespaces.
843 $who =~ tr/A-Z/a-z/; # lowercase.
848 if ($msgType =~ /private/) {
853 # addressing revamped by the xk.
854 ### below needs to be fixed...
855 if (&IsParam("addressCharacter")) {
856 if ($message =~ s/^$param{'addressCharacter'}//) {
862 if ($message =~ /^($mask{nick})([\;\:\>\, ]+) */) {
864 if ($1 =~ /^\Q$ident\E$/i) {
865 $message = $newmessage;
868 # ignore messages addressed to other people or unaddressed.
869 $skipmessage++ if ($2 ne "" and $2 !~ /^ /);
874 # Determine floodwho.
875 if ($msgType =~ /public/i) { # public.
876 $floodwho = lc $chan;
877 } elsif ($msgType =~ /private/i) { # private.
880 &DEBUG("FIXME: floodwho = ???");
883 my ($count, $interval) = split(/:/, $param{'floodRepeat'} || "2:10");
885 # flood repeat protection.
887 my $time = $flood{$floodwho}{$message};
889 if (defined $time and (time - $time < $interval)) {
890 ### public != personal who so the below is kind of pointless.
892 foreach (keys %flood) {
893 next if (/^\Q$floodwho\E$/ or /^\Q$chan\E$/);
894 push(@who, grep /^\Q$message\E$/i, keys %{$flood{$_}});
897 &msg($who, "you already said what ".
898 join(' ', @who)." have said.");
900 &msg($who,"Someone already said that ". (time - $time) ." seconds ago" );
903 ### TODO: delete old floodwarn{} keys.
905 if (!exists $floodwarn{$floodwho}) {
908 $floodwarn++ if (time() - $floodwarn{$floodwho} > $interval);
912 &status("FLOOD repetition detected from $floodwho.");
913 $floodwarn{$floodwho} = time();
920 &status("$b_cyan$who$ob is short-addressing me");
922 &status("$b_cyan$who$ob is addressing me");
925 $flood{$floodwho}{$message} = time();
928 ($count, $interval) = split(/:/, $param{'floodMessages'} || "5:30");
929 # flood overflow protection.
931 foreach (keys %{$flood{$floodwho}}) {
932 next unless (time() - $flood{$floodwho}{$_} > $interval);
933 delete $flood{$floodwho}{$_};
936 my $i = scalar keys %{$flood{$floodwho}};
938 &msg($who,"overflow of messages ($i > $count)");
939 &status("FLOOD overflow detected from $floodwho; ignoring");
941 my $expire = $param{'ignoreAutoExpire'} || 5;
942 $ignoreList{"*!$uh"} = time() + ($expire * 60);
946 $flood{$floodwho}{$message} = time();
950 if ($msgType =~ /public/i) {
951 $talkchannel = $chan;
952 &status("<$orig{who}/$chan> $orig{message}");
956 if ($msgType =~ /private/i) {
957 &status("[$orig{who}] $orig{message}");
960 if ((!$skipmessage or &IsParam("seenStoreAll")) and
964 $seencache{$who}{'time'} = time();
965 $seencache{$who}{'nick'} = $orig{who};
966 $seencache{$who}{'host'} = $uh;
967 $seencache{$who}{'chan'} = $talkchannel;
968 $seencache{$who}{'msg'} = $orig{message};
969 $seencache{$who}{'msgcount'}++;
972 return if ($skipmessage);
973 return unless (&IsParam("minVolunteerLength") or $addressed);
976 foreach (keys %ignoreList) {
978 my @parts = split /\*/, "a${ignoreRE}a";
979 my $recast = join '\S*', map quotemeta($_), @parts;
980 $recast =~ s/^a(.*)a$/$1/;
981 if ($nuh =~ /^$recast$/) {
988 $userHandle = &verifyUser($who, $nuh);
990 &DEBUG("hookMsg: 'nuh' not defined?");
993 ### For extra debugging purposes...
994 if ($_ = &process()) {
995 # &DEBUG("IrcHooks: process returned '$_'.");