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

NickList: fix set_meta on wildcard hostmasks

This commit is contained in:
Pragmatic Software 2020-01-22 16:50:45 -08:00
parent 329ffc20eb
commit 5e54712a7b

View File

@ -141,9 +141,24 @@ sub set_meta {
$nick = lc $nick; $nick = lc $nick;
if (not exists $self->{nicklist}->{$channel} or not exists $self->{nicklist}->{$channel}->{$nick}) { if (not exists $self->{nicklist}->{$channel} or not exists $self->{nicklist}->{$channel}->{$nick}) {
if (exists $self->{nicklist}->{$channel} and $nick =~ m/[*?]/) {
my $regex = quotemeta $nick;
$regex =~ s/\\\*/.*/g;
$regex =~ s/\\\?/./g;
my $found = 0;
foreach my $n (keys %{$self->{nicklist}->{$channel}}) {
if ($self->{nicklist}->{$channel}->{$n}->{hostmask} =~ m/$regex/i) {
$self->{nicklist}->{$channel}->{$n}->{$key} = $value;
$found++;
}
}
return $found;
} else {
$self->{pbot}->{logger}->log("Nicklist: Attempt to set invalid meta ($key => $value) for $nick in $channel.\n"); $self->{pbot}->{logger}->log("Nicklist: Attempt to set invalid meta ($key => $value) for $nick in $channel.\n");
return 0; return 0;
} }
}
$self->{nicklist}->{$channel}->{$nick}->{$key} = $value; $self->{nicklist}->{$channel}->{$nick}->{$key} = $value;
return 1; return 1;