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:
parent
329ffc20eb
commit
5e54712a7b
@ -141,9 +141,24 @@ sub set_meta {
|
||||
$nick = lc $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");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
$self->{nicklist}->{$channel}->{$nick}->{$key} = $value;
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user