3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-30 07:59:42 +01:00

Fix adminset not working on hostmasks with anchors

This commit is contained in:
Pragmatic Software 2017-11-22 15:25:14 -08:00
parent a1217190c7
commit 834cfaa11d

View File

@ -145,6 +145,7 @@ sub find_admin {
$from = $self->{pbot}->{registry}->get_value('irc', 'botnick') if not defined $from; $from = $self->{pbot}->{registry}->get_value('irc', 'botnick') if not defined $from;
$hostmask = '.*' if not defined $hostmask; $hostmask = '.*' if not defined $hostmask;
$hostmask = lc $hostmask;
my $result = eval { my $result = eval {
foreach my $channel_regex (keys %{ $self->{admins}->hash }) { foreach my $channel_regex (keys %{ $self->{admins}->hash }) {
@ -154,7 +155,7 @@ sub find_admin {
} }
} elsif($from =~ m/^$channel_regex$/i) { } elsif($from =~ m/^$channel_regex$/i) {
foreach my $hostmask_regex (keys %{ $self->{admins}->hash->{$channel_regex} }) { foreach my $hostmask_regex (keys %{ $self->{admins}->hash->{$channel_regex} }) {
return $self->{admins}->hash->{$channel_regex}->{$hostmask_regex} if $hostmask =~ m/$hostmask_regex/i; return $self->{admins}->hash->{$channel_regex}->{$hostmask_regex} if $hostmask =~ m/$hostmask_regex/i or $hostmask eq lc $hostmask_regex;
} }
} }
} }