From 553eceeb77fd2cc9f2f447a21c1d2cef1962bd84 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 24 Jul 2013 12:33:19 +0000 Subject: [PATCH] Fix interpretation of /me commands --- PBot/Interpreter.pm | 20 +++++++++++--------- PBot/VERSION.pm | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index f4a83b70..eb0a6099 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -95,28 +95,30 @@ sub process_line { $from = lc $from if defined $from; - $text =~ s/^\s+//; - $text =~ s/\s+$//; - my $pbot = $self->pbot; $pbot->antiflood->check_flood($from, $nick, $user, $host, $text, $pbot->{MAX_FLOOD_MESSAGES}, 10, $pbot->antiflood->{FLOOD_CHAT}) if defined $from; + $text =~ s/^\s+//; + $text =~ s/\s+$//; my $preserve_whitespace = 0; - if($text =~ /^\Q$pbot->{trigger}\E(.*)$/) { + my $cmd_text = $text; + $cmd_text =~ s/^\/me\s+//; + + if($cmd_text =~ /^\Q$pbot->{trigger}\E(.*)$/) { $command = $1; - } elsif($text =~ /^.?$mynick.?\s+(.*?)$/i) { + } elsif($cmd_text =~ /^.?$mynick.?\s+(.*?)$/i) { $command = $1; - } elsif($text =~ /^(.*?),?\s+$mynick[?!.]*$/i) { + } elsif($cmd_text =~ /^(.*?),?\s+$mynick[?!.]*$/i) { $command = $1; - } elsif($text =~ /https?:\/\/([^\s]+)/i) { + } elsif($cmd_text =~ /https?:\/\/([^\s]+)/i) { $has_url = $1; - } elsif($text =~ /^\s*([^,:\(\)\+\*\/ ]+)[,:]*\s*{\s*(.*)\s*}\s*$/) { + } elsif($cmd_text =~ /^\s*([^,:\(\)\+\*\/ ]+)[,:]*\s*{\s*(.*)\s*}\s*$/) { $nick_override = $1; $has_code = $2 if length $2 and $nick_override ne 'enum' and $nick_override ne 'struct'; $preserve_whitespace = 1; - } elsif($text =~ /^\s*{\s*(.*)\s*}\s*$/) { + } elsif($cmd_text =~ /^\s*{\s*(.*)\s*}\s*$/) { $has_code = $1 if length $1; $preserve_whitespace = 1; } diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 08c4e858..204f0a2b 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 => 409, - BUILD_DATE => "2013-06-17", + BUILD_REVISION => 410, + BUILD_DATE => "2013-07-24", }; 1;