Escape nicks in regular expressions so that they still work even if the bot is called something silly like '[bot]'. Bug 134599.

This commit is contained in:
ian%hixie.ch 2003-10-26 11:30:09 +00:00
Родитель cc3a97c21b
Коммит 160a2ba452
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -224,7 +224,7 @@ sub DoFactoidCheck {
'is', # am => is
$event->{'from'}, # subject
$direct);
} elsif ($shortMessage =~ /^(no\s*, (\s*$event->{'nick'}\s*,)? \s+)? (?:remember\s*:\s+)? (.+?) \s+ (is|are) \s+ (also\s+)? (.+?) $/six) {
} elsif ($shortMessage =~ /^(no\s*, (\s*\Q$event->{'nick'}\E\s*,)? \s+)? (?:remember\s*:\s+)? (.+?) \s+ (is|are) \s+ (also\s+)? (.+?) $/six) {
# the "remember:" prefix can be used to delimit the start of the actual content, if necessary.
$self->SetFactoid($event,
defined($1), # replace existing answer?
@ -233,7 +233,7 @@ sub DoFactoidCheck {
defined($5), # add to existing answer?
$6, # object
($direct or defined($2)));
} elsif ($shortMessage =~ /^(no\s*, (\s*$event->{'nick'}\s*,)? \s+)? (?:remember\s*:\s+)? I \s+ am \s+ (also\s+)? (.+?) $/osix) {
} elsif ($shortMessage =~ /^(no\s*, (\s*\Q$event->{'nick'}\E\s*,)? \s+)? (?:remember\s*:\s+)? I \s+ am \s+ (also\s+)? (.+?) $/osix) {
# the "remember:" prefix can be used to delimit the start of the actual content, if necessary.
$self->SetFactoid($event,
defined($1), # replace existing answer?