mirror of
https://github.com/pragma-/pbot.git
synced 2025-02-18 06:20:41 +01:00
Users: improve find_user
This commit is contained in:
parent
cfc3ad855f
commit
1f94973bd2
@ -184,8 +184,15 @@ sub find_user {
|
|||||||
$hostmask = '.*' if not defined $hostmask;
|
$hostmask = '.*' if not defined $hostmask;
|
||||||
$hostmask = lc $hostmask;
|
$hostmask = lc $hostmask;
|
||||||
|
|
||||||
|
my $sort;
|
||||||
|
if ($channel =~ m/^#/) {
|
||||||
|
$sort = sub { $a cmp $b };
|
||||||
|
} else {
|
||||||
|
$sort = sub { $b cmp $a };
|
||||||
|
}
|
||||||
|
|
||||||
my $user = eval {
|
my $user = eval {
|
||||||
foreach my $channel_regex (keys %{ $self->{users}->{hash} }) {
|
foreach my $channel_regex (sort $sort keys %{ $self->{users}->{hash} }) {
|
||||||
if ($channel !~ m/^#/ or $channel =~ m/^$channel_regex$/i) {
|
if ($channel !~ m/^#/ or $channel =~ m/^$channel_regex$/i) {
|
||||||
foreach my $hostmask_regex (keys %{ $self->{users}->{hash}->{$channel_regex} }) {
|
foreach my $hostmask_regex (keys %{ $self->{users}->{hash}->{$channel_regex} }) {
|
||||||
next if $hostmask_regex eq '_name';
|
next if $hostmask_regex eq '_name';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user