mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-23 02:24:25 +01:00
Allow quoting/escaping spaces in grab arguments
This commit is contained in:
parent
35e150d2b6
commit
5904a3f1f4
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user