Skip message containing grab command when grabbing own nick; match brackets for compiler-block; etc

This commit is contained in:
Pragmatic Software 2012-08-12 16:41:38 +00:00
parent b88c02c3c3
commit 6b35dc210c
4 changed files with 7 additions and 4 deletions

View File

@ -379,8 +379,10 @@ sub prune_message_history {
foreach my $mask (keys %{ $self->{message_history} }) { foreach my $mask (keys %{ $self->{message_history} }) {
foreach my $channel (keys %{ $self->{message_history}->{$mask}->{channels} }) { 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; 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] }; my %last = %{ @{ $self->{message_history}->{$mask}->{channels}->{$channel}{messages} }[$length - 1] };
# delete channel key if no activity within 3 days # delete channel key if no activity within 3 days

View File

@ -135,7 +135,7 @@ sub process_line {
if(defined $has_url) { if(defined $has_url) {
$result = $self->{pbot}->factoids->{factoidmodulelauncher}->execute_module($from, undef, $nick, $user, $host, "title", "$nick http://$has_url"); $result = $self->{pbot}->factoids->{factoidmodulelauncher}->execute_module($from, undef, $nick, $user, $host, "title", "$nick http://$has_url");
} elsif(defined $has_code) { } 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 { } else {
$result = $self->interpret($from, $nick, $user, $host, 1, $command); $result = $self->interpret($from, $nick, $user, $host, 1, $command);
} }

View File

@ -212,6 +212,7 @@ sub grab_quotegrab {
# regex history # regex history
my $ret = eval { my $ret = eval {
my $i = $#messages; my $i = $#messages;
$i-- if($nick =~ /^\Q$grab_nick\E$/i); # skip 'grab' command if grabbing own nick
my $found = 0; my $found = 0;
while($i >= 0) { while($i >= 0) {
if($messages[$i]->{msg} =~ m/$grab_history/i) { if($messages[$i]->{msg} =~ m/$grab_history/i) {

View File

@ -13,8 +13,8 @@ use warnings;
# These are set automatically by the build/commit script # These are set automatically by the build/commit script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 372, BUILD_REVISION => 376,
BUILD_DATE => "2012-08-01", BUILD_DATE => "2012-08-12",
}; };
1; 1;