mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 04:22:35 +01:00
BotAdmins: admin hostmasks are no longer treated as regex. They support the normal * and ? wildcards. Removed stdin admin from data/admins.
This commit is contained in:
parent
97dd3ea56e
commit
3188b690e8
@ -120,13 +120,11 @@ sub find_admin {
|
||||
foreach my $channel_regex (keys %{ $self->{admins}->hash }) {
|
||||
if ($from !~ m/^#/ or $from =~ m/^$channel_regex$/i) {
|
||||
foreach my $hostmask_regex (keys %{ $self->{admins}->hash->{$channel_regex} }) {
|
||||
if ($hostmask_regex =~ m/\.\*/) {
|
||||
# contains .* so it's considered a regex
|
||||
return $self->{admins}->hash->{$channel_regex}->{$hostmask_regex} if $hostmask =~ m/^$hostmask_regex$/i;
|
||||
} elsif ($hostmask_regex =~ m/\*/) {
|
||||
# contains * so it's converted to a regex
|
||||
if ($hostmask_regex =~ m/[*?]/) {
|
||||
# contains * or ? so it's converted to a regex
|
||||
my $hostmask_quoted = quotemeta $hostmask_regex;
|
||||
$hostmask_quoted =~ s/\\\*/.*/g;
|
||||
$hostmask_quoted =~ s/\\\*/.*?/g;
|
||||
$hostmask_quoted =~ s/\\\?/./g;
|
||||
return $self->{admins}->hash->{$channel_regex}->{$hostmask_regex} if $hostmask =~ m/^$hostmask_quoted$/i;
|
||||
} else {
|
||||
# direct comparison
|
||||
|
@ -212,7 +212,7 @@ sub initialize {
|
||||
|
||||
# create implicit bot-admin account for bot
|
||||
my $botnick = $self->{registry}->get_value('irc', 'botnick');
|
||||
$self->{admins}->add_admin($botnick, '.*', ".*!stdin\@pbot", 100, 'notused', 1);
|
||||
$self->{admins}->add_admin($botnick, '.*', "*!stdin\@pbot", 100, 'notused', 1);
|
||||
$self->{admins}->login($botnick, "$botnick!stdin\@pbot", 'notused');
|
||||
|
||||
# start timer
|
||||
|
10
data/admins
10
data/admins
@ -1,10 +0,0 @@
|
||||
{
|
||||
".*" : {
|
||||
"pbot3!stdin@localhost" : {
|
||||
"password" : "admin",
|
||||
"level" : "90",
|
||||
"name" : "pbot3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user