From 5904a3f1f4c931efbefd408c1f1363c03133bce2 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 22 May 2014 01:24:14 +0000 Subject: [PATCH] Allow quoting/escaping spaces in grab arguments --- PBot/Commands.pm | 6 ++++++ PBot/Quotegrabs.pm | 2 +- PBot/VERSION.pm | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/PBot/Commands.pm b/PBot/Commands.pm index 264a06cc..b0cbf715 100644 --- a/PBot/Commands.pm +++ b/PBot/Commands.pm @@ -14,6 +14,7 @@ use strict; use base 'PBot::Registerable'; use Carp (); +use Text::ParseWords qw(shellwords); sub new { if(ref($_[1]) eq 'HASH') { @@ -101,4 +102,9 @@ sub interpreter { return undef; } +sub parse_arguments { + my ($self, $arguments) = @_; + return shellwords($arguments); +} + 1; diff --git a/PBot/Quotegrabs.pm b/PBot/Quotegrabs.pm index e4be4c90..c590706d 100644 --- a/PBot/Quotegrabs.pm +++ b/PBot/Quotegrabs.pm @@ -171,7 +171,7 @@ sub grab_quotegrab { my ($grab_nick, $grab_history, $channel, $grab_nicks, $grab_text); 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 $channel = $from if not defined $channel; diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 1f667e50..2c134f1f 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 => 598, - BUILD_DATE => "2014-05-20", + BUILD_REVISION => 599, + BUILD_DATE => "2014-05-21", }; 1;