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') {
154 # incoming DCC SEND. we're receiving a file.
155 $self->new_get($event, \*FH);
156 } elsif ($type eq 'CHAT') {
157 $self->new_chat($event);
159 &status("${b_green}DCC $type$ob unknown ...");
164 my ($self, $event) = @_;
165 my $nick = $event->nick();
166 my $sock = ($event->to)[0];
168 # DCC CHAT close on fork exit workaround.
169 return if ($bot_pid != $$);
171 &DEBUG("dcc_close: nick => '$nick'.");
173 if (exists $dcc{'SEND'}{$nick} and -f "temp/$nick.txt") {
174 &status("${b_green}DCC SEND$ob close from $b_cyan$nick$ob");
176 &status("dcc_close: purging $nick.txt from Debian.pl");
177 unlink "temp/$nick.txt";
179 delete $dcc{'SEND'}{$nick};
180 } elsif (exists $dcc{'CHAT'}{$nick} and $dcc{'CHAT'}{$nick} eq $sock) {
181 &status("${b_green}DCC CHAT$ob close from $b_cyan$nick$ob");
182 delete $dcc{'CHAT'}{$nick};
184 &status("${b_green}DCC$ob UNKNOWN close from $b_cyan$nick$ob");
189 my ($self, $event) = @_;
190 my $type = uc( ($event->args)[0] );
191 my $nick = $event->nick();
192 my $sock = ($event->to)[0];
195 if ($type eq 'SEND') {
196 &status("${b_green}DCC lGET$ob established with $b_cyan$nick$ob");
197 } elsif ($type eq 'CHAT') {
198 &status("${b_green}DCC CHAT$ob established with $b_cyan$nick$ob ($nuh{$nick})");
199 my $userHandle = &verifyUser($nick, $nuh{lc $nick});
200 my $crypto = $userList{$userHandle}{'pass'};
201 if (defined $crypto) {
202 $self->privmsg($sock,"Enter Password, $userHandle.");
204 $self->privmsg($sock,"Welcome to blootbot DCC CHAT interface, $userHandle.");
207 &status("${b_green}DCC $type$ob unknown ...");
212 my ($self, $event) = @_;
213 my $from = $event->from();
214 my $what = ($event->args)[0];
216 &status("disconnect from $from ($what).");
217 $ircstats{'DisconnectTime'} = time();
218 $ircstats{'DisconnectReason'} = $what;
219 $ircstats{'DisconnectCount'}++;
221 # clear any variables on reconnection.
225 if (!$self->connect()) {
226 &WARN("not connected? help me. gonna call ircCheck() in 1800s");
227 $conn->schedule(1800, \&ircCheck(), "");
232 my ($self, $event) = @_;
233 my $chan = ($event->args)[1];
235 if (exists $jointime{$chan}) {
236 my $delta_time = sprintf("%.03f", &gettimeofday() - $jointime{$chan});
237 $delta_time = 0 if ($delta_time < 0);
239 &status("$b_blue$chan$ob: sync in ${delta_time}s.");
242 rawout("MODE $chan");
246 foreach ("o","v","") {
247 my $count = scalar(keys %{$channels{$chan}{$_}});
248 next unless ($count);
250 $txt = "total" if ($_ eq "");
251 $txt = "voice" if ($_ eq "v");
252 $txt = "ops" if ($_ eq "o");
254 push(@array, "$count $txt");
256 my $chanstats = join(' || ', @array);
257 &status("$b_blue$chan$ob: [$chanstats]");
259 if (scalar @joinchan) { # remaining channels to join.
262 ### chanserv support.
263 ### TODO: what if we rejoin a channel.. need to set a var that
264 ### we've done the request-for-ops-on-join.
265 return unless (&IsParam("chanServ_ops"));
266 return unless ($nickserv);
268 my @chans = split(/[\s\t]+/, $param{'chanServ_ops'});
270 ### TODO: since this function has a chan arg, why don't we use
271 ### that instead of doing the following?
272 foreach $chan (keys %channels) {
273 next unless (grep /^$chan$/i, @chans);
275 if (!exists $channels{$chan}{'o'}{$ident}) {
276 &status("ChanServ ==> Requesting ops for $chan.");
277 &rawout("PRIVMSG ChanServ :OP $chan $ident");
285 my ($self, $event) = @_;
286 my (@args) = ($event->args);
293 my ($self, $event) = @_;
294 my $chan = ($event->args)[0];
295 my $nick = $event->nick;
297 &DEBUG("on_invite: chan => '$chan', nick => '$nick'.");
299 # chan + possible_key.
300 ### do we need to know the key if we're invited???
301 ### grep the channel list?
302 foreach (split /[\s\t]+/, $param{'join_channels'}) {
303 next unless /^\Q$chan\E(,\S+)?$/i;
306 next if ($nick =~ /^\Q$ident\E$/);
307 if (&validChan($chan)) {
308 &msg($who, "i'm already in \002$chan\002.");
312 &status("invited to $b_blue$_$ob by $b_cyan$who$ob");
313 &joinchan($self, $_);
318 my ($self, $event) = @_;
319 my ($user,$host) = split(/\@/, $event->userhost);
320 $chan = lc( ($event->to)[0] ); # CASING!!!!
321 $who = $event->nick();
323 $chanstats{$chan}{'Join'}++;
324 $userstats{lc $who}{'Join'} = time() if (&IsParam("seenStats"));
328 if (exists $netsplit{lc $who}) {
329 delete $netsplit{lc $who};
333 # how to tell if there's a netjoin???
335 my $netsplitstr = "";
336 $netsplitstr = " $b_yellow\[${ob}NETSPLIT VICTIM$b_yellow]$ob" if ($netsplit);
337 &status(">>> join/$b_blue$chan$ob $b_cyan$who$ob $b_yellow($ob$user\@$host$b_yellow)$ob$netsplitstr");
339 $channels{$chan}{''}{$who}++;
340 $nuh{lc $who} = $who."!".$user."\@".$host unless (exists $nuh{lc $who});
343 &rootWarn($who,$user,$host,$chan)
344 if (&IsParam("rootWarn") &&
345 $user =~ /^r(oo|ew|00)t$/i &&
346 $channels{$chan}{'o'}{$ident});
348 # used to determine sync time.
349 if ($who =~ /^$ident$/i) {
350 if (defined( my $whojoin = $joinverb{$chan} )) {
351 &msg($chan, "Okay, I'm here. (courtesy of $whojoin)");
352 delete $joinverb{$chan};
355 ### TODO: move this to &joinchan()?
356 $jointime{$chan} = &gettimeofday();
359 ### TODO: this may go wild on a netjoin :)
366 my ($self, $event) = @_;
367 my ($chan,$reason) = $event->args;
368 my $kicker = $event->nick;
369 my $kickee = ($event->to)[0];
370 my $uh = $event->userhost();
372 &status(">>> kick/$b_blue$chan$ob [$b$kickee!$uh$ob] by $b_cyan$kicker$ob $b_yellow($ob$reason$b_yellow)$ob");
374 $chanstats{$chan}{'Kick'}++;
376 if ($kickee eq $ident) {
377 &clearChanVars($chan);
379 &status("SELF attempting to rejoin lost channel $chan");
382 &DeleteUserInfo($kickee,$chan);
387 my ($self, $event) = @_;
388 my ($user, $host) = split(/\@/, $event->userhost);
389 my @args = $event->args();
390 my $nick = $event->nick();
391 my $chan = ($event->to)[0];
395 if ($nick eq $chan) { # UMODE
396 &status(">>> mode $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
398 &status(">>> mode/$b_blue$chan$ob $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
399 &hookMode($chan, @args);
404 my ($self, $event) = @_;
405 my $nick = $event->nick();
406 my ($myself,$chan,@args) = $event->args();
408 &hookMode(lc $chan, @args); # CASING.
412 my ($self, $event) = @_;
413 my $nick = $event->nick;
414 my $chan = lc ( ($event->to)[0] ); # CASING.
415 my $msg = ($event->args)[0];
417 ($user,$host) = split(/\@/, $event->userhost);
418 $uh = $event->userhost();
419 $nuh = $nick."!".$uh;
421 &hookMsg('private', $chan, $nick, $msg);
425 my ($self, $event) = @_;
426 my @args = $event->args;
427 my $chan = lc $args[2]; # CASING, the last of them!
429 foreach (split / /, @args[3..$#args]) {
430 $channels{$chan}{'o'}{$_}++ if s/\@//;
431 $channels{$chan}{'v'}{$_}++ if s/\+//;
432 $channels{$chan}{''}{$_}++;
437 my ($self, $event) = @_;
438 my $nick = $event->nick();
439 my $newnick = ($event->args)[0];
441 if (exists $netsplit{lc $newnick}) {
442 &DEBUG("on_nick: $newnick/$nick came back from netsplit and changed to original nick! removing from hash.");
443 delete $netsplit{lc $newnick};
447 foreach $chan (keys %channels) {
448 foreach $mode (keys %{$channels{$chan}}) {
449 next unless (exists $channels{$chan}{$mode}{$nick});
451 $channels{$chan}{$mode}{$newnick} = $channels{$chan}{$mode}{$nick};
454 &DeleteUserInfo($nick,keys %channels);
455 $nuh{lc $newnick} = $nuh{lc $nick};
456 delete $nuh{lc $nick};
458 # successful self-nick change.
459 if ($nick eq $ident) {
460 &status(">>> I materialized into $b_green$newnick$ob from $nick");
463 &status(">>> $b_cyan$nick$ob materializes into $b_green$newnick$ob");
469 my $nick = $self->nick;
470 my $newnick = substr($nick,0,7)."-";
472 &status("nick taken; changing to temporary nick.");
478 my ($self, $event) = @_;
479 my $nick = $event->nick();
480 my $chan = ($event->to)[0];
481 my $args = ($event->args)[0];
483 if ($nick =~ /^NickServ$/i) { # nickserv.
484 &status("NickServ: <== '$args'");
486 if ($args =~ /^This nickname is registered/i) {
487 &status("nickserv told us to register; doing it.");
488 if (&IsParam("nickServ_pass")) {
489 &status("NickServ: ==> Identifying.");
490 &rawout("PRIVMSG NickServ :IDENTIFY $param{'nickServ_pass'}");
493 &status("We can't tell nickserv a passwd ;(");
498 if ($args =~ /^Password a/i) {
501 } elsif ($nick =~ /^ChanServ$/i) { # chanserv.
502 &status("ChanServ: <== '$args'.");
504 if ($chan =~ /^$mask{chan}$/) { # channel notice.
505 &status("-$nick/$chan- $args");
507 $server = $nick unless (defined $server);
508 &status("-$nick- $args"); # private or server notice.
514 my ($self, $event) = @_;
515 my $chan = ($event->to)[0];
516 my $nick = $event->nick;
518 &status("!!! other called.");
519 &status("!!! $event->args");
523 my ($self, $event) = @_;
524 my $chan = lc( ($event->to)[0] ); # CASING!!!
525 my $nick = $event->nick;
526 my $userhost = $event->userhost;
528 $chanstats{$chan}{'Part'}++;
529 &DeleteUserInfo($nick,$chan);
530 &clearChanVars($chan) if ($nick eq $ident);
531 if (!&IsNickInAnyChan($nick) and &IsParam("seenStats")) {
532 delete $userstats{lc $nick};
535 &status(">>> part/$b_blue$chan$ob $b_cyan$nick$ob $b_yellow($ob$userhost$b_yellow)$ob");
539 my ($self, $event) = @_;
540 my $nick = $event->nick;
542 $self->ctcp_reply($nick, join(' ', ($event->args)));
543 &status(">>> ${b_green}CTCP PING$ob request from $b_cyan$nick$ob received.");
547 my ($self, $event) = @_;
548 my $nick = $event->nick;
549 my $lag = time() - ($event->args)[1];
551 &status(">>> ${b_green}CTCP PING$ob reply from $b_cyan$nick$ob: $lag sec.");
555 my ($self, $event) = @_;
556 my $msg = ($event->args)[0];
557 my $chan = lc( ($event->to)[0] ); # CASING.
558 my $nick = $event->nick;
559 $uh = $event->userhost();
560 $nuh = $nick."!".$uh;
561 ($user,$host) = split(/\@/, $uh);
564 if ($statcount < 200) {
565 foreach $chan (grep /[A-Z]/, keys %channels) {
566 &DEBUG("leak: chan => '$chan'.");
568 foreach $i (keys %{$channels{$chan}}) {
569 foreach (keys %{$channels{$chan}{$i}}) {
570 &DEBUG("leak: \$channels{$chan}{$i}{$_} ...");
578 $lastWho{$chan} = $nick;
579 ### TODO: use $nick or lc $nick?
580 if (&IsParam("seenStats")) {
581 $userstats{lc $nick}{'Count'}++;
582 $userstats{lc $nick}{'Time'} = time();
585 # if (&IsParam("hehCounter")) {
589 &hookMsg('public', $chan, $nick, $msg);
590 $chanstats{$chan}{'PublicMsg'}++;
594 my ($self, $event) = @_;
595 my $nick = $event->nick();
596 my $reason = ($event->args)[0];
598 foreach (keys %channels) {
599 # fixes inconsistent chanstats bug #1.
600 next unless (&IsNickInChan($nick,$_));
601 $chanstats{$_}{'SignOff'}++;
603 &DeleteUserInfo($nick, keys %channels);
604 if (exists $nuh{lc $nick}) {
605 delete $nuh{lc $nick};
607 &DEBUG("on_quit: nuh{lc $nick} does not exist! FIXME");
609 delete $userstats{lc $nick} if (&IsParam("seenStats"));
611 # should fix chanstats inconsistencies bug #2.
612 if ($reason=~/^($mask{host})\s($mask{host})$/) { # netsplit.
613 $reason = "NETSPLIT: $1 <=> $2";
615 $netsplit{lc $nick} = time();
616 if (!exists $netsplitservers{$1}{$2}) {
617 &status("netsplit detected between $1 and $2.");
618 $netsplitservers{$1}{$2} = time();
622 &status(">>> $b_cyan$nick$ob has signed off IRC $b_red($ob$reason$b_red)$ob");
623 if ($nick =~ /^\Q$ident\E$/) {
624 &DEBUG("!!! THIS SHOULD NEVER HAPPEN. FIXME HOPEFULLY");
626 if ($nick !~ /^\Q$ident\E$/ and $nick =~ /^\Q$param{'ircNick'}\E$/i) {
627 &status("own nickname became free; changing.");
628 &nick($param{'ircNick'});
632 sub on_targettoofast {
633 my ($self, $event) = @_;
634 my $nick = $event->nick();
635 my $chan = ($event->to)[0];
637 &DEBUG("on_targettoofast: nick => '$nick'.");
638 &DEBUG("on_targettoofast: chan => '$chan'.");
640 foreach ($event->args) {
641 &DEBUG("on_targettoofast: args => '$_'.");
644 ### .* wait (\d+) second/) {
648 &status("going to sleep for $sleep...");
655 my ($self, $event) = @_;
657 if (scalar($event->args) == 1) { # change.
658 my $topic = ($event->args)[0];
659 my $chan = ($event->to)[0];
660 my $nick = $event->nick();
664 # race condition here. To fix, change '1' to '0'.
665 # This will keep track of topics set by bot only.
668 # this may be fixed at a later date with topic queueing.
671 $topic{$chan}{'Current'} = $topic if (1 and &IsParam("topic") == 1);
672 $chanstats{$chan}{'Topic'}++;
674 &status(">>> topic/$b_blue$chan$ob by $b_cyan$nick$ob -> $topic");
676 my ($nick, $chan, $topic) = $event->args;
677 if (&IsParam("topic")) {
678 $topic{$chan}{'Current'} = $topic;
679 &topicAddHistory($chan,$topic);
682 $topic = &fixString($topic, 1);
683 &status(">>> topic/$b_blue$chan$ob is $topic");
688 my ($self, $event) = @_;
689 my ($myself,$chan,$setby,$time) = $event->args();
692 if (time() - $time > 60*60*24) {
693 $timestr = "at ". localtime $time;
695 $timestr = &Time2String(time() - $time) ." ago";
698 &status(">>> set by $b_cyan$setby$ob $timestr");
702 my ($self, $event) = @_;
703 my $nick = $event->nick;
705 &status(">>> ${b_green}CTCP VERSION$ob request from $b_cyan$nick$ob");
706 $self->ctcp_reply($nick, "VERSION $bot_version");
710 my ($self, $event) = @_;
711 my @args = $event->args;
713 $nuh{lc $args[5]} = $args[5]."!".$args[2]."\@".$args[3];
717 my ($self, $event) = @_;
718 my @args = $event->args;
720 $nuh{lc $args[1]} = $args[1]."!".$args[2]."\@".$args[3];
723 #######################################################################
724 ####### IRC HOOK HELPERS IRC HOOK HELPERS IRC HOOK HELPERS ########
725 #######################################################################
728 # Usage: &hookMode($chan, $modes, @targets);
730 my ($chan, $modes, @targets) = @_;
733 $chan = lc $chan; # !!!.
736 foreach $mode (split(//, $modes)) {
738 if ($mode =~ /[-+]/) {
739 $parity = 1 if ($mode eq "+");
740 $parity = 0 if ($mode eq "-");
745 if ($mode =~ /[bklov]/) {
746 my $target = shift @targets;
749 $chanstats{$chan}{'Op'}++ if ($mode eq "o");
750 $chanstats{$chan}{'Ban'}++ if ($mode eq "b");
752 $chanstats{$chan}{'Deop'}++ if ($mode eq "o");
753 $chanstats{$chan}{'Unban'}++ if ($mode eq "b");
756 # modes w/ target affecting nick => cache it.
757 if ($mode =~ /[ov]/) {
758 $channels{$chan}{$mode}{$target}++ if $parity;
759 delete $channels{$chan}{$mode}{$target} if !$parity;
762 if ($mode =~ /[l]/) {
763 $channels{$chan}{$mode} = $target if $parity;
764 delete $channels{$chan}{$mode} if !$parity;
768 # important channel modes, targetless.
769 if ($mode =~ /[mt]/) {
770 $channels{$chan}{$mode}++ if $parity;
771 delete $channels{$chan}{$mode} if !$parity;
777 ($msgType, $chan, $who, $message) = @_;
781 $orig{message} = $message;
785 $message =~ s/[\cA-\c_]//ig; # strip control characters
786 $message =~ s/^\s+//; # initial whitespaces.
787 $who =~ tr/A-Z/a-z/; # lowercase.
792 if ($msgType =~ /private/) {
797 # addressing revamped by the xk.
798 ### below needs to be fixed...
799 if (&IsParam("addressCharacter")) {
800 if ($message =~ s/^$param{'addressCharacter'}//) {
806 if ($message =~ /^($mask{nick})([\;\:\>\, ]+) */) {
808 if ($1 =~ /^\Q$ident\E$/i) {
809 $message = $newmessage;
812 # ignore messages addressed to other people or unaddressed.
813 $skipmessage++ if ($2 ne "" and $2 !~ /^ /);
818 # Determine floodwho.
819 if ($msgType =~ /public/i) { # public.
820 $floodwho = lc $chan;
821 } elsif ($msgType =~ /private/i) { # private.
824 &DEBUG("FIXME: floodwho = ???");
827 my ($count, $interval) = split(/:/, $param{'floodRepeat'} || "2:10");
829 # flood repeat protection.
831 my $time = $flood{$floodwho}{$message};
833 if (defined $time and (time - $time < $interval)) {
834 ### public != personal who so the below is kind of pointless.
836 foreach (keys %flood) {
837 next if (/^\Q$floodwho\E$/ or /^\Q$chan\E$/);
838 push(@who, grep /^\Q$message\E$/i, keys %{$flood{$_}});
841 &msg($who, "you already said what ".join(@who)." have said.");
843 &msg($who,"Someone already said that ". (time - $time) ." seconds ago" );
846 ### TODO: delete old floodwarn{} keys.
848 if (!exists $floodwarn{$floodwho}) {
851 $floodwarn++ if (time() - $floodwarn{$floodwho} > $interval);
855 &status("FLOOD repetition detected from $floodwho.");
856 $floodwarn{$floodwho} = time();
863 &status("$b_cyan$who$ob is short-addressing me");
865 &status("$b_cyan$who$ob is addressing me");
868 $flood{$floodwho}{$message} = time();
871 ($count, $interval) = split(/:/, $param{'floodMessages'} || "5:30");
872 # flood overflow protection.
874 foreach (keys %{$flood{$floodwho}}) {
875 next unless (time() - $flood{$floodwho}{$_} > $interval);
876 delete $flood{$floodwho}{$_};
879 my $i = scalar keys %{$flood{$floodwho}};
881 &msg($who,"overflow of messages ($i > $count)");
882 &status("FLOOD overflow detected from $floodwho; ignoring");
884 my $expire = $param{'ignoreAutoExpire'} || 5;
885 $ignoreList{"*!$uh"} = time() + ($expire * 60);
889 $flood{$floodwho}{$message} = time();
893 if ($msgType =~ /public/i) {
894 $talkchannel = $chan;
895 &status("<$orig{who}/$chan> $orig{message}");
899 if ($msgType =~ /private/i) {
900 &status("[$orig{who}] $orig{message}");
903 if ((!$skipmessage or &IsParam("seenStoreAll")) and
907 $seencache{$who}{'time'} = time();
908 $seencache{$who}{'nick'} = $orig{who};
909 $seencache{$who}{'host'} = $uh;
910 $seencache{$who}{'chan'} = $talkchannel;
911 $seencache{$who}{'msg'} = $orig{message};
912 $seencache{$who}{'msgcount'}++;
915 return if ($skipmessage);
916 return unless (&IsParam("minVolunteerLength") or $addressed);
919 foreach (keys %ignoreList) {
921 my @parts = split /\*/, "a${ignoreRE}a";
922 my $recast = join '\S*', map quotemeta($_), @parts;
923 $recast =~ s/^a(.*)a$/$1/;
924 if ($nuh =~ /^$recast$/) {
931 $userHandle = &verifyUser($who, $nuh);
933 &DEBUG("hookMsg: 'nuh' not defined?");
936 ### For extra debugging purposes...
937 if ($_ = &process()) {
938 # &DEBUG("IrcHooks: process returned '$_'.");