mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 11:42:35 +01:00
Use proper lookbehind to prevent expansion of escaped variables
Remove adlib recursion loop since using $action already enables recursion since subsitution on $action resets the regex position
This commit is contained in:
parent
d2711956d6
commit
d1341ab4bd
@ -481,10 +481,9 @@ sub interpreter {
|
||||
$action =~ s/\$nick/$nick/g;
|
||||
$action =~ s/\$channel/$from/g;
|
||||
|
||||
my $adlib_recursion = 0;
|
||||
while ($action =~ /[^\\]\$([a-zA-Z0-9_\-]+)/ and ++$adlib_recursion < 5) {
|
||||
while ($action =~ /[^\\]\$([a-zA-Z0-9_\-]+)/g) {
|
||||
while ($action =~ /(?<!\\)\$([a-zA-Z0-9_\-]+)/g) {
|
||||
my $v = $1;
|
||||
print "v = [$v]\n";
|
||||
next if $v =~ m/^[0-9]+$/;
|
||||
my ($var_chan, $var) = $self->find_factoid($from, $v, undef, 0, 1);
|
||||
|
||||
@ -502,7 +501,6 @@ sub interpreter {
|
||||
$action =~ s/\$$var/$var/g;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$action =~ s/\\\$/\$/g;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user