From 7cc8b9c34dc99ca3591eed08b869b2eec8d89fea Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 8 Jul 2015 14:05:55 -0700 Subject: [PATCH] Allow chat-flood antiflood settings to be overridable on a per-channel basis --- PBot/Interpreter.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index 0d1f73e9..73da7a38 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -65,9 +65,14 @@ sub process_line { my $message_account = $pbot->{messagehistory}->get_message_account($nick, $user, $host); $pbot->{messagehistory}->add_message($message_account, "$nick!$user\@$host", $from, $text, $pbot->{messagehistory}->{MSG_CHAT}); + my $flood_threshold = $pbot->{registry}->get_value($from, 'chat_flood_threshold'); + my $flood_time_threshold = $pbot->{registry}->get_value($from, 'chat_flood_time_threshold'); + + $flood_threshold = $pbot->{registry}->get_value('antiflood', 'chat_flood_threshold') if not defined $flood_threshold; + $flood_time_threshold = $pbot->{registry}->get_value('antiflood', 'chat_flood_time_threshold') if not defined $flood_time_threshold; + $pbot->{antiflood}->check_flood($from, $nick, $user, $host, $text, - $pbot->{registry}->get_value('antiflood', 'chat_flood_threshold'), - $pbot->{registry}->get_value('antiflood', 'chat_flood_time_threshold'), + $flood_threshold, $flood_time_threshold, $pbot->{messagehistory}->{MSG_CHAT}) if defined $from; $text =~ s/^\s+//;