3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

AntiSpam: "unless" is too confusing

This commit is contained in:
Pragmatic Software 2018-08-06 11:24:05 -07:00
parent e861c9dea2
commit bb11282e13

View File

@ -50,9 +50,10 @@ sub is_spam {
my $ret = eval {
foreach my $space (keys %{ $self->{keywords}->hash }) {
next unless $all_namespaces and $namespace =~ m/^$space$/i;
foreach my $keyword (keys %{ $self->{keywords}->hash->{$space} }) {
return 1 if $text =~ m/$keyword/i;
if ($all_namespaces or $namespace =~ m/^$space$/i) {
foreach my $keyword (keys %{ $self->{keywords}->hash->{$space} }) {
return 1 if $text =~ m/$keyword/i;
}
}
}
return 0;