diff options
| author | 2007-11-25 21:33:40 +0000 | |
|---|---|---|
| committer | 2007-11-25 21:33:40 +0000 | |
| commit | 0293b9d684ce2f89a1850b7a0d4819bdd1c947ef (patch) | |
| tree | c7ea8fc9bd40b46797ba690ebe7b4066c178518d /modules/classes.pl | |
| parent | 917638dfdf31e26ae9115dabb5c2fe528866c549 (diff) | |
better logging, better flood detection, command ignoring
Diffstat (limited to 'modules/classes.pl')
| -rw-r--r-- | modules/classes.pl | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/classes.pl b/modules/classes.pl index 36a8031..775eae6 100644 --- a/modules/classes.pl +++ b/modules/classes.pl @@ -17,6 +17,7 @@ sub new "floodqueue" => \&floodqueue, "nickspam" => \&nickspam, "splitflood" => \&splitflood, + "advsplitflood" => \&advsplitflood, "re" => \&re, "nick" => \&nick, "ident" => \&ident, @@ -151,6 +152,37 @@ sub splitflood { return 0; } +sub advsplitflood { + my ($chk, $id, $event, $chan) = @_; + my $text; + my @cut = split(/:/, $chk->{content}); + $cf{$id}{timeout}=int($cut[1]); + if ($event->{type} =~ /^(public|notice|part|caction)$/) { + $text=$event->{args}->[0]; + } + return unless defined($text); + $text=~s/^\d+(.*)\d+$/$1/; + return unless length($text) >= 10; + if (defined($bs{$id}{$text}) && (time <= $bs{$id}{$text} + 600)) { + return 1; + } + push( @{$cf{$id}{$chan}{$text}}, time ); + while ( time >= $cf{$id}{$chan}{$text}[0] + $cf{$id}{'timeout'} ) { + last if ( $#{$cf{$id}{$chan}{$text}} == 0 ); + shift ( @{$cf{$id}{$chan}{$text}} ); + } + $cfc = $cfc + 1; + if ( $cfc >= 100 ) { + $cfc = 0; + process_cf(); + } + if ( $#{@{$cf{$id}{$chan}{$text}}}+1 == int($cut[0]) ) { + $bs{$id}{$text} = time; + return 1; + } + return 0; +} + sub re { my ($chk, $id, $event, $chan) = @_; my $match = $event->{args}->[0]; |
