diff options
author | David Phillips <david@sighup.nz> | 2018-04-10 15:20:24 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2018-04-10 15:20:24 +1200 |
commit | cd1fc57841deab0e9b8bcfad49d527c6b263534c (patch) | |
tree | 83bc8874a4b6970e0850f9aaca3a8c801bce293c /plugin/antiflood.pm | |
parent | bb1808b1ef92af9a14a073f2e14973ac132b7e7e (diff) | |
download | idalius-cd1fc57841deab0e9b8bcfad49d527c6b263534c.tar.xz |
Correct capitalisation on module names
Diffstat (limited to 'plugin/antiflood.pm')
-rw-r--r-- | plugin/antiflood.pm | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/plugin/antiflood.pm b/plugin/antiflood.pm deleted file mode 100644 index a44c07c..0000000 --- a/plugin/antiflood.pm +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env perl - -package plugin::antiflood; - -use strict; -use warnings; - -my $message_count = 5; -my $message_period = 11; - - -my %config; -my %lastmsg = (); - -sub configure { - my $self = $_[0]; - my $cmdref = $_[1]; - my $cref = $_[2]; - %config = %$cref; - return $self; -} - -sub message { - my ($self, $logger, $me, $who, $where, $raw_what, $what, $irc) = @_; - my $channel = $where->[0]; - my $nick = (split /!/, $who)[0]; - - return if ($config{antiflood_on} == 0); - - my $now = time(); - push @{$lastmsg{$nick}}, $now; - - if (@{$lastmsg{$nick}} >= $message_count) { - @{$lastmsg{$nick}} = splice @{$lastmsg{$nick}}, 1, $message_count - 1; - my $first = @{$lastmsg{$nick}}[0]; - if ($now - $first <= $message_period) { - $irc->yield(kick => $channel => $nick => "Flood"); - } - } - return; -} -1; |