Allow quoting/escaping spaces in grab arguments

This commit is contained in:
Pragmatic Software 2014-05-22 01:24:14 +00:00
parent 35e150d2b6
commit 5904a3f1f4
3 changed files with 9 additions and 3 deletions

View File

@ -14,6 +14,7 @@ use strict;
use base 'PBot::Registerable'; use base 'PBot::Registerable';
use Carp (); use Carp ();
use Text::ParseWords qw(shellwords);
sub new { sub new {
if(ref($_[1]) eq 'HASH') { if(ref($_[1]) eq 'HASH') {
@ -101,4 +102,9 @@ sub interpreter {
return undef; return undef;
} }
sub parse_arguments {
my ($self, $arguments) = @_;
return shellwords($arguments);
}
1; 1;

View File

@ -171,7 +171,7 @@ sub grab_quotegrab {
my ($grab_nick, $grab_history, $channel, $grab_nicks, $grab_text); my ($grab_nick, $grab_history, $channel, $grab_nicks, $grab_text);
foreach my $grab (@grabs) { foreach my $grab (@grabs) {
($grab_nick, $grab_history, $channel) = split(/\s+/, $grab, 3); ($grab_nick, $grab_history, $channel) = $self->{pbot}->{commands}->parse_arguments($grab);
$grab_history = $nick eq $grab_nick ? 2 : 1 if not defined $grab_history; # skip grab command if grabbing self without arguments $grab_history = $nick eq $grab_nick ? 2 : 1 if not defined $grab_history; # skip grab command if grabbing self without arguments
$channel = $from if not defined $channel; $channel = $from if not defined $channel;

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 => 598, BUILD_REVISION => 599,
BUILD_DATE => "2014-05-20", BUILD_DATE => "2014-05-21",
}; };
1; 1;