aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-10-12 15:04:30 +1300
committerDavid Phillips <david@sighup.nz>2017-10-12 15:04:30 +1300
commit40c13a54e442173b160e66288c97808d04f232d7 (patch)
tree1000a9ae532fc541b5855dfb731cf827fc5a8ee8
parent8714b27669ec7032a31ef88a8c8c451bcee56552 (diff)
downloadidalius-40c13a54e442173b160e66288c97808d04f232d7.tar.xz
Keep latest message buffer rolling
-rw-r--r--plugin/antiflood.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugin/antiflood.pm b/plugin/antiflood.pm
index d9326ba..a4fe09c 100644
--- a/plugin/antiflood.pm
+++ b/plugin/antiflood.pm
@@ -27,8 +27,8 @@ sub message {
my $now = time();
push @{$lastmsg{$nick}}, $now;
- # FIXME limit buffer size to 5
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");