From 6b35dc210c4a31386be41a35581be9d6b496e172 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sun, 12 Aug 2012 16:41:38 +0000 Subject: [PATCH] Skip message containing grab command when grabbing own nick; match brackets for compiler-block; etc --- PBot/AntiFlood.pm | 4 +++- PBot/Interpreter.pm | 2 +- PBot/Quotegrabs.pm | 1 + PBot/VERSION.pm | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/PBot/AntiFlood.pm b/PBot/AntiFlood.pm index 5e7c01ec..4ab1e3d4 100644 --- a/PBot/AntiFlood.pm +++ b/PBot/AntiFlood.pm @@ -379,8 +379,10 @@ sub prune_message_history { foreach my $mask (keys %{ $self->{message_history} }) { foreach my $channel (keys %{ $self->{message_history}->{$mask}->{channels} }) { - #$self->{pbot}->logger->log("Checking [$mask][$channel]\n"); + $self->{pbot}->logger->log("Checking [$mask][$channel]\n"); my $length = $#{ $self->{message_history}->{$mask}->{channels}->{$channel}{messages} } + 1; + $self->{pbot}->logger->log("length: $length\n"); + next unless $length > 0; my %last = %{ @{ $self->{message_history}->{$mask}->{channels}->{$channel}{messages} }[$length - 1] }; # delete channel key if no activity within 3 days diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index cbedd2e5..a1c7d30e 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -135,7 +135,7 @@ sub process_line { if(defined $has_url) { $result = $self->{pbot}->factoids->{factoidmodulelauncher}->execute_module($from, undef, $nick, $user, $host, "title", "$nick http://$has_url"); } elsif(defined $has_code) { - $result = $self->{pbot}->factoids->{factoidmodulelauncher}->execute_module($from, undef, $nick, $user, $host, "compiler_block", (defined $nick_override ? $nick_override : $nick) . " $has_code"); + $result = $self->{pbot}->factoids->{factoidmodulelauncher}->execute_module($from, undef, $nick, $user, $host, "compiler_block", (defined $nick_override ? $nick_override : $nick) . " $has_code }"); } else { $result = $self->interpret($from, $nick, $user, $host, 1, $command); } diff --git a/PBot/Quotegrabs.pm b/PBot/Quotegrabs.pm index 51d9464f..0c840cbb 100644 --- a/PBot/Quotegrabs.pm +++ b/PBot/Quotegrabs.pm @@ -212,6 +212,7 @@ sub grab_quotegrab { # regex history my $ret = eval { my $i = $#messages; + $i-- if($nick =~ /^\Q$grab_nick\E$/i); # skip 'grab' command if grabbing own nick my $found = 0; while($i >= 0) { if($messages[$i]->{msg} =~ m/$grab_history/i) { diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 82734da2..a398c65c 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 372, - BUILD_DATE => "2012-08-01", + BUILD_REVISION => 376, + BUILD_DATE => "2012-08-12", }; 1;