2 # Irc.pl: IRC core stuff.
5 # NOTE: Based on code by Kevin Lenzo & Patrick Cole (c) 1997
11 no strict 'subs'; # IN/STDIN
13 use vars qw(%floodjoin %nuh %dcc %cache %conns %channels %param %mask
14 %chanconf %orig %ircPort %ircstats %last %netsplit);
15 use vars qw($irc $nickserv $conn $msgType $who $talkchannel
16 $addressed $postprocess);
17 use vars qw($notcount $nottime $notsize $msgcount $msgtime $msgsize
18 $pubcount $pubtime $pubsize);
19 use vars qw($b_blue $ob);
20 use vars qw(@ircServers);
24 # It's probably closer to 510, but let's be cautious until we calculate it extensively.
27 # Keep track of last time we displayed Chans: to avoid spam in logs
28 my $lastChansTime = 0;
35 while ( my $host = shift @ircServers ) {
37 # JUST IN CASE. irq was complaining about this.
38 if ( $lastrun == time() ) {
39 &DEBUG('ircloop: hrm... lastrun == time()');
45 if ( !defined $host ) {
46 &DEBUG('ircloop: ircServers[x] = NULL.');
50 next unless ( exists $ircPort{$host} );
52 my $retval = &irc( $host, $ircPort{$host} );
53 next unless ( defined $retval and $retval == 0 );
56 if ( $error % 3 == 0 and $error != 0 ) {
57 &status('IRC: Could not connect.');
62 if ( $error >= 3 * 2 ) {
63 &status('IRC: cannot connect to any IRC servers; stopping.');
69 &status('IRC: ok, done one cycle of IRC servers; trying again.');
76 my ( $server, $port ) = @_;
80 # TODO: move all this to an sql table
81 my $iaddr = inet_aton($server);
82 my $paddr = sockaddr_in( $port, $iaddr );
83 my $proto = getprotobyname('tcp');
90 if ( $server =~ /\D$/ ) {
91 my $packed = scalar( gethostbyname($server) );
93 if ( !defined $packed ) {
94 &status(" cannot resolve $server.");
98 $resolve = inet_ntoa($packed);
99 ### warning in Sys/Hostname line 78???
100 ### caused inside Net::IRC?
104 Nick => $param{'ircNick'},
107 Ircname => $param{'ircName'},
109 $args{'LocalAddr'} = $param{'ircHost'} if ( $param{'ircHost'} );
110 $args{'Password'} = $param{'ircPasswd'} if ( $param{'ircPasswd'} );
111 $args{'SSL'} = $param{'ircSSL'} if ( $param{'ircSSL'} );
113 foreach my $mynick ( sort split ',', $param{'ircNick'} ) {
114 if (!defined $conns{$mynick}) {
115 &status("Connecting to port $port of server $server ($resolve) as $mynick ...");
116 $args{'Nick'} = $mynick;
117 $args{'Username'} = $mynick;
118 $conns{$mynick} = $irc->newconn(%args);
119 # FIXME: connections should happen in the background and get retried per nick
121 if ( !defined $param{'ircHost'} and !defined $conns{$mynick} ) {
122 &ERROR("IRC: $mynick @ $server connection failed.");
123 &ERROR("add \"set ircHost 0.0.0.0\" to your config. If that does not work");
124 &ERROR('Please check /etc/hosts to see if you have a localhost line like:');
125 &ERROR('127.0.0.1 localhost localhost');
126 &ERROR('If this is still a problem, please contact the maintainer.');
128 if (defined $conns{$mynick}) {
129 # explicit binmode for socket as "use open" does not seem to work here
130 #binmode $conns{$mynick}->{_socket}, ":utf8";
131 #binmode $conns{$mynick}->{_socket}, ":encoding(UTF-8)";
132 # TODO: need to input bytes, but output utf8
133 binmode $conns{$mynick}->{_socket}, ":bytes";
134 binmode $conns{$mynick}->socket, ":bytes";
136 $conns{$mynick}->maxlinelen($maxlinelen);
139 $conns{$mynick}->add_global_handler( 'caction', \&on_action );
140 $conns{$mynick}->add_global_handler( 'cdcc', \&on_dcc );
141 $conns{$mynick}->add_global_handler( 'cping', \&on_ping );
142 $conns{$mynick}->add_global_handler( 'crping', \&on_ping_reply );
143 $conns{$mynick}->add_global_handler( 'cversion', \&on_version );
144 $conns{$mynick}->add_global_handler( 'crversion', \&on_crversion );
145 $conns{$mynick}->add_global_handler( 'dcc_open', \&on_dcc_open );
146 $conns{$mynick}->add_global_handler( 'dcc_close', \&on_dcc_close );
147 $conns{$mynick}->add_global_handler( 'chat', \&on_chat );
148 $conns{$mynick}->add_global_handler( 'msg', \&on_msg );
149 $conns{$mynick}->add_global_handler( 'public', \&on_public );
150 $conns{$mynick}->add_global_handler( 'join', \&on_join );
151 $conns{$mynick}->add_global_handler( 'part', \&on_part );
152 $conns{$mynick}->add_global_handler( 'topic', \&on_topic );
153 $conns{$mynick}->add_global_handler( 'invite', \&on_invite );
154 $conns{$mynick}->add_global_handler( 'kick', \&on_kick );
155 $conns{$mynick}->add_global_handler( 'mode', \&on_mode );
156 $conns{$mynick}->add_global_handler( 'nick', \&on_nick );
157 $conns{$mynick}->add_global_handler( 'quit', \&on_quit );
158 $conns{$mynick}->add_global_handler( 'notice', \&on_notice );
159 $conns{$mynick}->add_global_handler( 'whoischannels', \&on_whoischannels );
160 $conns{$mynick}->add_global_handler( 'useronchannel', \&on_useronchannel );
161 $conns{$mynick}->add_global_handler( 'whois', \&on_whois );
162 $conns{$mynick}->add_global_handler( 'other', \&on_other );
163 $conns{$mynick}->add_global_handler( 'disconnect', \&on_disconnect );
164 $conns{$mynick}->add_global_handler( [ 251, 252, 253, 254, 255 ], \&on_init );
166 # $conns{$mynick}->add_global_handler(302, \&on_init); # userhost
167 $conns{$mynick}->add_global_handler( 303, \&on_ison ); # notify.
168 $conns{$mynick}->add_global_handler( 315, \&on_endofwho );
169 $conns{$mynick}->add_global_handler( 422, \&on_endofwho ); # nomotd.
170 $conns{$mynick}->add_global_handler( 324, \&on_modeis );
171 $conns{$mynick}->add_global_handler( 333, \&on_topicinfo );
172 $conns{$mynick}->add_global_handler( 352, \&on_who );
173 $conns{$mynick}->add_global_handler( 353, \&on_names );
174 $conns{$mynick}->add_global_handler( 366, \&on_endofnames );
175 $conns{$mynick}->add_global_handler( "001", \&on_connected )
177 $conns{$mynick}->add_global_handler( 433, \&on_nick_taken );
178 $conns{$mynick}->add_global_handler( 439, \&on_targettoofast );
180 # for proper joinnextChan behaviour
181 $conns{$mynick}->add_global_handler( 471, \&on_chanfull );
182 $conns{$mynick}->add_global_handler( 473, \&on_inviteonly );
183 $conns{$mynick}->add_global_handler( 474, \&on_banned );
184 $conns{$mynick}->add_global_handler( 475, \&on_badchankey );
185 $conns{$mynick}->add_global_handler( 443, \&on_useronchan );
187 # end of handler stuff.
194 # change internal timeout value for scheduler.
195 $irc->{_timeout} = 10; # how about 60?
196 # Net::IRC debugging.
199 $ircstats{'Server'} = "$server:$port";
201 # works? needs to actually do something
202 # should likely listen on a tcp port instead
203 #$irc->addfh(STDIN, \&on_stdin, 'r');
205 &status('starting main loop');
210 ######################################################################
211 ######## IRC ALIASES IRC ALIASES IRC ALIASES IRC ALIASES #######
212 ######################################################################
218 # slow down a bit if traffic is 'high'.
219 # need to take into account time of last message sent.
220 if ( $last{buflen} > 256 and length($buf) > 256 ) {
224 $conn->sl($buf) if ( &whatInterface() =~ /IRC/ );
226 $last{buflen} = length($buf);
231 my $mynick = $conn->nick();
232 if ( !defined $msg ) {
234 &WARN("say: msg == $msg.");
238 if ( &getChanConf( 'silent', $talkchannel )
239 and not( &IsFlag('s') and &verifyUser( $who, $nuh{ lc $who } ) ) )
241 &DEBUG("say: silent in $talkchannel, not saying $msg");
248 elsif ( $postprocess = &getChanConf( 'postprocess', $talkchannel ) ) {
249 &DEBUG("say: $postprocess $msg");
250 &parseCmdHook( $postprocess . ' ' . $msg );
255 &status("<$mynick/$talkchannel> $msg");
257 return unless ( &whatInterface() =~ /IRC/ );
259 $msg = 'zero' if ( $msg =~ /^0+$/ );
263 if ( $t == $pubtime ) {
265 $pubsize += length $msg;
267 my $i = &getChanConfDefault( 'sendPublicLimitLines', 3, $chan );
268 my $j = &getChanConfDefault( 'sendPublicLimitBytes', 1000, $chan );
270 if ( ( $pubcount % $i ) == 0 and $pubcount ) {
273 elsif ( $pubsize > $j ) {
282 $pubsize = length $msg;
285 $conn->privmsg( $talkchannel, $msg );
289 my ( $nick, $msg ) = @_;
290 if ( !defined $nick ) {
291 &ERROR('msg: nick == NULL.');
295 if ( !defined $msg ) {
297 &WARN("msg: msg == $msg.");
301 # some say() end up here (eg +help)
302 if ( &getChanConf( 'silent', $nick )
303 and not( &IsFlag('s') and &verifyUser( $who, $nuh{ lc $who } ) ) )
305 &DEBUG("msg: silent in $nick, not saying $msg");
309 &status(">$nick< $msg");
311 return unless ( &whatInterface() =~ /IRC/ );
314 if ( $t == $msgtime ) {
316 $msgsize += length $msg;
318 my $i = &getChanConfDefault( 'sendPrivateLimitLines', 3, $chan );
319 my $j = &getChanConfDefault( 'sendPrivateLimitBytes', 1000, $chan );
320 if ( ( $msgcount % $i ) == 0 and $msgcount ) {
323 elsif ( $msgsize > $j ) {
332 $msgsize = length $msg;
335 $conn->privmsg( $nick, $msg );
338 # Usage: &action(nick || chan, txt);
340 my $mynick = $conn->nick();
341 my ( $target, $txt ) = @_;
342 if ( !defined $txt ) {
343 &WARN('action: txt == NULL.');
347 if ( &getChanConf( 'silent', $target )
348 and not( &IsFlag('s') and &verifyUser( $who, $nuh{ lc $who } ) ) )
350 &DEBUG("action: silent in $target, not doing $txt");
354 if ( length $txt > 480 ) {
355 &status('action: txt too long; truncating.');
356 chop($txt) while ( length $txt > 480 );
359 &status("* $mynick/$target $txt");
360 $conn->me( $target, $txt );
363 # Usage: ¬ice(nick || chan, txt);
365 my ( $target, $txt ) = @_;
366 if ( !defined $txt ) {
367 &WARN('notice: txt == NULL.');
371 &status("-$target- $txt");
375 if ( $t == $nottime ) {
377 $notsize += length $txt;
379 my $i = &getChanConfDefault( 'sendNoticeLimitLines', 3, $chan );
380 my $j = &getChanConfDefault( 'sendNoticeLimitBytes', 1000, $chan );
382 if ( ( $notcount % $i ) == 0 and $notcount ) {
385 elsif ( $notsize > $j ) {
394 $notsize = length $txt;
397 $conn->notice( $target, $txt );
401 my ( $txt, $flag ) = @_;
403 ### FIXME: flag not supported yet.
405 foreach ( keys %{ $dcc{'CHAT'} } ) {
406 $conn->privmsg( $dcc{'CHAT'}{$_}, $txt );
411 ### perform commands.
414 # Usage: &performReply($reply);
418 if ( !defined $reply or $reply =~ /^\s*$/ ) {
419 &DEBUG('performReply: reply == NULL.');
423 $reply =~ /([\.\?\s]+)$/;
425 # FIXME need real throttling....
426 if ( length($reply) > $maxlinelen - 30 ) {
427 $reply = substr( $reply, 0, $maxlinelen - 33 );
428 $reply =~ s/ [^ ]*?$/ .../;
430 &checkMsgType($reply);
432 if ( $msgType eq 'public' ) {
433 if ( rand() < 0.5 or $reply =~ /[\.\?]$/ ) {
434 $reply = "$orig{who}: " . $reply;
437 $reply = "$reply, " . $orig{who};
442 elsif ( $msgType eq 'private' ) {
443 if ( rand() > 0.5 ) {
444 $reply = "$reply, " . $orig{who};
446 &msg( $who, $reply );
449 elsif ( $msgType eq 'chat' ) {
450 if ( !exists $dcc{'CHAT'}{$who} ) {
451 &VERB( "pSR: dcc{'CHAT'}{$who} does not exist.", 2 );
454 $conn->privmsg( $dcc{'CHAT'}{$who}, $reply );
458 &ERROR("PR: msgType invalid? ($msgType).");
463 sub performAddressedReply {
464 return unless ($addressed);
468 # Usage: &performStrictReply($reply);
469 sub performStrictReply {
472 # FIXME need real throttling....
473 if ( length($reply) > $maxlinelen - 30 ) {
474 $reply = substr( $reply, 0, $maxlinelen - 33 );
475 $reply =~ s/ [^ ]*?$/ .../;
477 &checkMsgType($reply);
479 if ( $msgType eq 'private' ) {
480 &msg( $who, $reply );
482 elsif ( $msgType eq 'public' ) {
485 elsif ( $msgType eq 'chat' ) {
486 &dccsay( lc $who, $reply );
489 &ERROR("pSR: msgType invalid? ($msgType).");
494 my ( $who, $reply ) = @_;
496 if ( !defined $reply or $reply =~ /^\s*$/ ) {
497 &WARN('dccsay: reply == NULL.');
501 if ( !exists $dcc{'CHAT'}{$who} ) {
502 &VERB( "pSR: dcc{'CHAT'}{$who} does not exist. (2)", 2 );
506 &status("=>$who<= $reply"); # dcc chat.
507 $conn->privmsg( $dcc{'CHAT'}{$who}, $reply );
514 foreach $type ( keys %dcc ) {
515 &FIXME("dcc_close: $who");
516 my @who = grep /^\Q$who\E$/i, keys %{ $dcc{$type} };
517 next unless ( scalar @who );
519 &DEBUG("dcc_close... close $who!");
524 my ( $chan, $key ) = @_;
525 $key ||= &getChanConf( 'chankey', $chan );
527 my $mynick = $conn->nick();
529 # forgot for about 2 years to implement channel keys when moving
530 # over to Net::IRC...
532 # hopefully validChan is right.
533 if ( &validChan($chan) ) {
534 &status("join: already on $chan?");
538 &status("$mynick joining $b_blue$chan $key$ob");
540 return if ( $conn->join( $chan, $key ) );
541 return if ( &validChan($chan) );
543 &DEBUG('joinchan: join failed. trying connect!');
554 next if ( $chan eq '' );
555 $chan =~ tr/A-Z/a-z/; # lowercase.
557 if ( $chan !~ /^$mask{chan}$/ ) {
558 &WARN("part: chan is invalid ($chan)");
562 &status("parting $chan");
563 if ( !&validChan($chan) ) {
564 &WARN("part: not on $chan; doing anyway");
571 # deletion of $channels{chan} is done in &entryEvt().
576 my ( $chan, @modes ) = @_;
577 my $modes = join( ' ', @modes );
579 if ( &validChan($chan) == 0 ) {
580 &ERROR("mode: invalid chan => '$chan'.");
584 &DEBUG("mode: MODE $chan $modes");
586 # should move to use Net::IRC's $conn->mode()... but too lazy.
587 rawout("MODE $chan $modes");
591 my ( $chan, @who ) = @_;
592 my $os = 'o' x scalar(@who);
594 &mode( $chan, "+$os @who" );
598 my ( $chan, @who ) = @_;
599 my $os = 'o' x scalar(@who);
601 &mode( $chan, "-$os " . @who );
605 my ( $nick, $chan, $msg ) = @_;
606 my (@chans) = ( $chan eq '' ) ? ( keys %channels ) : lc($chan);
607 my $mynick = $conn->nick();
609 if ( $chan ne '' and &validChan($chan) == 0 ) {
610 &ERROR("kick: invalid channel $chan.");
614 $nick =~ tr/A-Z/a-z/;
616 foreach $chan (@chans) {
617 if ( !&IsNickInChan( $nick, $chan ) ) {
618 &status("kick: $nick is not on $chan.") if ( scalar @chans == 1 );
622 if ( !exists $channels{$chan}{o}{$mynick} ) {
623 &status("kick: do not have ops on $chan :(");
627 &status("Kicking $nick from $chan.");
628 $conn->kick( $chan, $nick, $msg );
633 my ( $mask, $chan ) = @_;
634 my (@chans) = ( $chan =~ /^\*?$/ ) ? ( keys %channels ) : lc($chan);
635 my $mynick = $conn->nick();
638 if ( $chan !~ /^\*?$/ and &validChan($chan) == 0 ) {
639 &ERROR("ban: invalid channel $chan.");
643 foreach $chan (@chans) {
644 if ( !exists $channels{$chan}{o}{$mynick} ) {
645 &status("ban: do not have ops on $chan :(");
649 &status("Banning $mask from $chan.");
650 &rawout("MODE $chan +b $mask");
658 my ( $mask, $chan ) = @_;
659 my (@chans) = ( $chan =~ /^\*?$/ ) ? ( keys %channels ) : lc($chan);
660 my $mynick = $conn->nick();
663 &DEBUG("unban: mask = $mask, chan = @chans");
665 foreach $chan (@chans) {
666 if ( !exists $channels{$chan}{o}{$mynick} ) {
667 &status("unBan: do not have ops on $chan :(");
671 &status("Removed ban $mask from $chan.");
672 &rawout("MODE $chan -b $mask");
681 if ( defined $conn ) {
682 &status( 'QUIT ' . $conn->nick() . " has quit IRC ($quitmsg)" );
683 $conn->quit($quitmsg);
686 &WARN('quit: could not quit!');
692 my $mynick = $conn->nick();
694 if ( !defined $newnick ) {
695 &ERROR('nick: nick == NULL.');
699 if ( !defined $mynick ) {
700 &WARN('nick: mynick == NULL.');
705 $bad++ if ( exists $nuh{$newnick} );
706 $bad++ if ( &IsNickInAnyChan($newnick) );
709 &WARN( "Nick: not going to try to change from $mynick to $newnick. ["
713 # hrm... over time we lose track of our own nick.
717 if ( $newnick =~ /^$mask{nick}$/ ) {
718 &status("nick: Changing nick from $mynick to $newnick");
720 # ->nick() will NOT change cause we are using rawout?
721 &rawout("NICK $newnick");
724 &DEBUG("nick: failed... why oh why (mynick=$mynick, newnick=$newnick)");
729 my ( $who, $chan ) = @_;
731 # TODO: check if $who or $chan are invalid.
733 $conn->invite( $who, $chan );
737 # Channel related functions...
740 # Usage: &joinNextChan();
744 my $mynick = $conn->nick();
745 my @join = getJoinChans(1);
747 if ( scalar @join ) {
748 my $chan = shift @join;
751 if ( my $i = scalar @join ) {
752 &status("joinNextChan: $mynick $i chans to join.");
759 if ( exists $cache{joinTime} ) {
760 my $delta = time() - $cache{joinTime} - 5;
761 my $timestr = &Time2String($delta);
763 # FIXME: @join should be @in instead (hacked to 10)
764 #my $rate = sprintf('%.1f', $delta / @in);
765 my $rate = sprintf( '%.1f', $delta / 10 );
766 delete $cache{joinTime};
768 &status("time taken to join all chans: $timestr; rate: $rate sec/join");
771 # chanserv check: global channels, in case we missed one.
772 foreach ( &ChanConfList('chanServ_ops') ) {
777 # Usage: &getNickInChans($nick);
782 foreach ( keys %channels ) {
783 next unless ( grep /^\Q$nick\E$/i, keys %{ $channels{$_}{''} } );
790 # Usage: &getNicksInChan($chan);
795 return keys %{ $channels{$chan}{''} };
799 my ( $nick, $chan ) = @_;
801 $chan =~ tr/A-Z/a-z/; # not lowercase unfortunately.
803 if ( $chan =~ /^$/ ) {
804 &DEBUG('INIC: chan == NULL.');
808 if ( &validChan($chan) == 0 ) {
809 &ERROR("INIC: invalid channel $chan.");
813 if ( grep /^\Q$nick\E$/i, keys %{ $channels{$chan}{''} } ) {
817 foreach ( keys %channels ) {
818 next unless (/[A-Z]/);
819 &DEBUG('iNIC: hash channels contains mixed cased chan!!!');
825 sub IsNickInAnyChan {
829 foreach $chan ( keys %channels ) {
830 next unless ( grep /^\Q$nick\E$/i, keys %{ $channels{$chan}{''} } );
836 # Usage: &validChan($chan);
839 # TODO: use $c instead?
842 if ( !defined $chan or $chan =~ /^\s*$/ ) {
846 if ( lc $chan ne $chan ) {
847 &WARN("validChan: lc chan != chan. ($chan); fixing.");
848 $chan =~ tr/A-Z/a-z/;
851 # it's possible that this check creates the hash if empty.
852 if ( defined $channels{$chan} or exists $channels{$chan} ) {
853 if ( $chan =~ /^_?default$/ ) {
855 # &WARN('validC: chan cannot be _default! returning 0!');
867 # Usage: &delUserInfo($nick,@chans);
869 my ( $nick, @chans ) = @_;
872 foreach $chan (@chans) {
873 foreach $mode ( keys %{ $channels{$chan} } ) {
876 next unless ( exists $channels{$chan}{$mode}{$nick} );
878 delete $channels{$chan}{$mode}{$nick};
886 delete $channels{$chan};
893 $cache{joinTime} = time();
898 # $show should contain the min number of seconds between display
899 # of the Chans: status line. Use 0 to disable
906 # Display 'Chans:' only if more than $show seconds since last display
907 if ( time() - $lastChansTime > $show ) {
908 $lastChansTime = time();
910 # Don't display since < 15min since last
914 # can't join any if not connected
915 return @join if ( !$conn );
917 my $nick = $conn->nick();
919 foreach ( keys %chanconf ) {
920 next if ( $_ eq '_default' );
923 my $val = $chanconf{$_}{autojoin};
925 if ( defined $val ) {
926 $skip++ if ( $val eq '0' );
929 # convert old +autojoin to autojoin <nick>
931 $chanconf{$_}{autojoin} = $val;
933 $skip++ if ( lc $val ne lc $nick );
941 if ( defined $channels{$_} or exists $channels{$_} ) {
950 $str .= ' join:' . join( ',', sort @join ) if scalar @join;
951 $str .= ' in:' . join( ',', sort @in ) if scalar @in;
952 $str .= ' skip:' . scalar @skip if scalar @skip;
954 &status("Chans: ($nick)$str") if ($show);
961 # &DEBUG('closeDCC called.');
964 foreach $type ( keys %dcc ) {
965 next if ( $type ne uc($type) );
968 foreach $nick ( keys %{ $dcc{$type} } ) {
969 next unless ( defined $nick );
970 &status("DCC CHAT: closing DCC $type to $nick.");
971 next unless ( defined $dcc{$type}{$nick} );
973 my $ref = $dcc{$type}{$nick};
974 &dccsay( $nick, "bye bye, $nick" ) if ( $type =~ /^chat$/i );
975 $dcc{$type}{$nick}->close();
976 delete $dcc{$type}{$nick};
977 &DEBUG("after close for $nick");
984 my ( $who, $chan, $userhost ) = @_;
986 return unless ( &IsChanConf('joinfloodCheck') > 0 );
988 if ( exists $netsplit{ lc $who } ) { # netsplit join.
989 &DEBUG("joinfloodCheck: $who was in netsplit; not checking.");
992 if ( exists $floodjoin{$chan}{$who}{Time} ) {
993 &WARN("floodjoin{$chan}{$who} already exists?");
996 $floodjoin{$chan}{$who}{Time} = time();
997 $floodjoin{$chan}{$who}{Host} = $userhost;
1000 foreach ( keys %floodjoin ) {
1002 my $count = scalar keys %{ $floodjoin{$c} };
1003 next unless ( $count > 5 );
1004 &DEBUG("joinflood: count => $count");
1007 foreach ( keys %{ $floodjoin{$c} } ) {
1008 my $t = $floodjoin{$c}{$_}{Time};
1009 next unless ( defined $t );
1013 &DEBUG("joinflood: time => $time");
1016 &DEBUG("joinflood: new time => $time");
1022 foreach $chan ( keys %floodjoin ) {
1023 foreach $who ( keys %{ $floodjoin{$chan} } ) {
1024 my $t = $floodjoin{$chan}{$who}{Time};
1025 next unless ( defined $t );
1027 my $delta = $time - $t;
1028 next unless ( $delta > 10 );
1030 delete $floodjoin{$chan}{$who};
1035 &DEBUG("joinfloodCheck: $delete deleted.") if ($delete);
1041 if ( exists $nuh{$n} ) {
1042 return &makeHostMask( $nuh{$n} );
1045 $cache{on_who_Hack} = 1;
1052 # vim:ts=4:sw=4:expandtab:tw=80