3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 11:12:42 +01:00

Add unquote_spaces factoid module metadata to remove escaped quotes from quotemeta, and allow g modifier to modulelauncher_subpattern

This commit is contained in:
Pragmatic Software 2014-04-19 10:32:49 +00:00
parent 08e300bd54
commit f003ff1178
3 changed files with 824 additions and 602 deletions

View File

@ -64,11 +64,21 @@ sub execute_module {
$arguments = quotemeta($arguments); $arguments = quotemeta($arguments);
if(exists $self->{pbot}->factoids->factoids->hash->{$channel}->{$trigger}->{unquote_spaces}) {
$arguments =~ s/\\ / /g;
}
if(exists $self->{pbot}->factoids->factoids->hash->{$channel}->{$trigger}->{modulelauncher_subpattern}) { if(exists $self->{pbot}->factoids->factoids->hash->{$channel}->{$trigger}->{modulelauncher_subpattern}) {
if($self->{pbot}->factoids->factoids->hash->{$channel}->{$trigger}->{modulelauncher_subpattern} =~ m/s\/(.*?)\/(.*)\//) { if($self->{pbot}->factoids->factoids->hash->{$channel}->{$trigger}->{modulelauncher_subpattern} =~ m/s\/(.*?)\/(.*)\/(.*)/) {
my ($p1, $p2) = ($1, $2); my ($p1, $p2, $p3) = ($1, $2, $3);
$arguments =~ s/$p1/$p2/; my ($a, $b, $c, $d, $e, $f, $g, $h, $i, $before, $after);
my ($a, $b, $c, $d, $e, $f, $g, $h, $i, $before, $after) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $`, $'); if($p3 eq 'g') {
$arguments =~ s/$p1/$p2/g;
($a, $b, $c, $d, $e, $f, $g, $h, $i, $before, $after) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $`, $');
} else {
$arguments =~ s/$p1/$p2/;
($a, $b, $c, $d, $e, $f, $g, $h, $i, $before, $after) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $`, $');
}
$arguments =~ s/\$1/$a/g; $arguments =~ s/\$1/$a/g;
$arguments =~ s/\$2/$b/g; $arguments =~ s/\$2/$b/g;
$arguments =~ s/\$3/$c/g; $arguments =~ s/\$3/$c/g;

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 => 543, BUILD_REVISION => 544,
BUILD_DATE => "2014-04-07", BUILD_DATE => "2014-04-19",
}; };
1; 1;

File diff suppressed because it is too large Load Diff