From 9cf59888c0e93ff89fa683b8fe7fec5baa82fce6 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Tue, 28 Jul 2015 17:47:22 -0700 Subject: [PATCH] join_channel() can now take a comma-separated list of channels and issue them as one IRC command --- PBot/ChanOps.pm | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/PBot/ChanOps.pm b/PBot/ChanOps.pm index dd998c81..fe2864e2 100644 --- a/PBot/ChanOps.pm +++ b/PBot/ChanOps.pm @@ -179,18 +179,21 @@ sub mute_user_timed { } sub join_channel { - my ($self, $channel) = @_; + my ($self, $channels) = @_; - $self->{pbot}->{event_dispatcher}->dispatch_event('pbot.join', { channel => $channel }); - $self->{pbot}->{conn}->join($channel); + $self->{pbot}->{conn}->join($channels); - delete $self->{is_opped}->{$channel}; - delete $self->{op_requested}->{$channel}; + foreach my $channel (split /,/, $channels) { + $self->{pbot}->{event_dispatcher}->dispatch_event('pbot.join', { channel => $channel }); - if (exists $self->{pbot}->{channels}->{channels}->hash->{$channel} - and exists $self->{pbot}->{channels}->{channels}->hash->{$channel}{permop} - and $self->{pbot}->{channels}->{channels}->hash->{$channel}{permop}) { - $self->gain_ops($channel); + delete $self->{is_opped}->{$channel}; + delete $self->{op_requested}->{$channel}; + + if (exists $self->{pbot}->{channels}->{channels}->hash->{$channel} + and exists $self->{pbot}->{channels}->{channels}->hash->{$channel}{permop} + and $self->{pbot}->{channels}->{channels}->hash->{$channel}{permop}) { + $self->gain_ops($channel); + } } }