perl: Fixed get_list('networks') to work with new servlist.conf syntax for autojoin channels.

This commit is contained in:
Arnavion 2013-06-22 22:06:49 -07:00
parent 6e3f05fcc7
commit c7d1102c61
2 changed files with 17 additions and 18 deletions

View File

@ -10,27 +10,25 @@ 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, {
my $line = shift;
my ( $channel, $key ) = split /,/, $line, 2;
$key = $key || '';
push @$self, {
channel => $channel,
key => $key,
};
}
}
return bless \@autojoins, $class;
}
sub channels {
my $self = shift;

View File

@ -39,6 +39,8 @@ sub parse {
my @fields = split /\n/, $data;
chomp @fields;
$entry->{ autojoins } = Xchat::List::Network::AutoJoin->new();
for my $field ( @fields ) {
SWITCH: for ( $field ) {
/^($letter_key_re)=(.*)/ && do {
@ -47,8 +49,7 @@ sub parse {
};
/^J.(.*)/ && do {
$entry->{ autojoins } =
Xchat::List::Network::AutoJoin->new( $1 );
$entry->{ autojoins }->add( $1 );
};
/^F.(.*)/ && do {