3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-04 18:38:47 +02:00

Fix /say substitution derp that allowed "/say /msg foo bar" to actually invoke /msg rather than saying "/msg foo bar"

This commit is contained in:
Pragmatic Software 2013-10-12 15:06:27 +00:00
parent 02ebf106a8
commit c91a8e5c3d
3 changed files with 16 additions and 7 deletions

View File

@ -478,11 +478,15 @@ sub interpreter {
$result =~ s/\\\$/\$/g;
if($result =~ s/^\/say\s+/$ref_from/i || $result =~ s/^\/me\s+(.*)/\/me $1 $ref_from/i
|| $result =~ s/^\/msg\s+([^ ]+)/\/msg $1 $ref_from/i) {
if($ref_from) {
if($result =~ s/^\/say\s+/$ref_from/i || $result =~ s/^\/me\s+(.*)/\/me $1 $ref_from/i
|| $result =~ s/^\/msg\s+([^ ]+)/\/msg $1 $ref_from/i) {
return $result;
} else {
return $ref_from . "$keyword is $result";
}
}else {
return $result;
} else {
return $ref_from . "$keyword is $result";
}
} elsif($self->factoids->hash->{$channel}->{$keyword}->{type} eq 'regex') {
$result = eval {

View File

@ -168,11 +168,16 @@ sub process_line {
$pbot->logger->log("Final result: $result\n");
if($result =~ s/^\/me\s+//i) {
if($result =~ s/^\/say\s+//i) {
$pbot->conn->privmsg($from, $result) if defined $from && $from !~ /\Q$mynick\E/i;
} elsif($result =~ s/^\/me\s+//i) {
$pbot->conn->me($from, $result) if defined $from && $from !~ /\Q$mynick\E/i;
} elsif($result =~ s/^\/msg\s+([^\s]+)\s+//i) {
my $to = $1;
if($to =~ /.*serv$/i) {
if($to =~ /,/) {
$pbot->logger->log("[HACK] Possible HACK ATTEMPT /msg multiple users: [$nick!$user\@$host] [$command] [$result]\n");
}
elsif($to =~ /.*serv$/i) {
$pbot->logger->log("[HACK] Possible HACK ATTEMPT /msg *serv: [$nick!$user\@$host] [$command] [$result]\n");
}
elsif($result =~ s/^\/me\s+//i) {

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 445,
BUILD_REVISION => 446,
BUILD_DATE => "2013-10-12",
};