diff options
Diffstat (limited to 'plugins/perl/lib/Xchat/List/Network/AutoJoin.pm')
-rw-r--r-- | plugins/perl/lib/Xchat/List/Network/AutoJoin.pm | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/plugins/perl/lib/Xchat/List/Network/AutoJoin.pm b/plugins/perl/lib/Xchat/List/Network/AutoJoin.pm index 16036a9d..8b4e40d2 100644 --- a/plugins/perl/lib/Xchat/List/Network/AutoJoin.pm +++ b/plugins/perl/lib/Xchat/List/Network/AutoJoin.pm @@ -10,26 +10,24 @@ use overload sub new { my $class = shift; - my $line = shift; my @autojoins; - if ( $line ) { - my ( $channels, $keys ) = split / /, $line, 2; - my @channels = split /,/, $channels; - my @keys = split /,/, ($keys || ''); + return bless \@autojoins, $class; +} - for my $channel ( @channels ) { - my $key = shift @keys; - $key = '' unless defined $key; +sub add { + my $self = shift; - push @autojoins, { - channel => $channel, - key => $key, - }; - } - } - return bless \@autojoins, $class; + my $line = shift; + + my ( $channel, $key ) = split /,/, $line, 2; + $key = $key || ''; + + push @$self, { + channel => $channel, + key => $key, + }; } sub channels { |