mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-22 20:09:43 +01:00
Users: users
command now strictly filters to channel argument if provided
This commit is contained in:
parent
12be1e87dd
commit
d0d1ae5194
@ -318,13 +318,20 @@ sub logoutcmd {
|
|||||||
sub users {
|
sub users {
|
||||||
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
my ($self, $from, $nick, $user, $host, $arguments, $stuff) = @_;
|
||||||
my $channel = $self->{pbot}->{interpreter}->shift_arg($stuff->{arglist});
|
my $channel = $self->{pbot}->{interpreter}->shift_arg($stuff->{arglist});
|
||||||
$channel = $from if not defined $channel;
|
|
||||||
|
my $include_global = '';
|
||||||
|
if (not defined $channel) {
|
||||||
|
$channel = $from;
|
||||||
|
$include_global = '.*';
|
||||||
|
} else {
|
||||||
|
$channel = '.*' if $channel !~ /^#/;
|
||||||
|
}
|
||||||
|
|
||||||
my $text = "Users: ";
|
my $text = "Users: ";
|
||||||
my $last_channel = "";
|
my $last_channel = "";
|
||||||
my $sep = "";
|
my $sep = "";
|
||||||
foreach my $chan (sort keys %{ $self->{users}->{hash} }) {
|
foreach my $chan (sort keys %{ $self->{users}->{hash} }) {
|
||||||
next if $from =~ m/^#/ and $chan ne $channel and $chan ne '.*';
|
next if $from =~ m/^#/ and $chan ne $channel and $chan ne $include_global;
|
||||||
next if $from !~ m/^#/ and $channel =~ m/^#/ and $chan ne $channel;
|
next if $from !~ m/^#/ and $channel =~ m/^#/ and $chan ne $channel;
|
||||||
|
|
||||||
if ($last_channel ne $chan) {
|
if ($last_channel ne $chan) {
|
||||||
|
Loading…
Reference in New Issue
Block a user