summary refs log tree commit diff stats
path: root/plugins/perl
diff options
context:
space:
mode:
authorArnavion <arnavion@gmail.com>2013-06-22 22:06:49 -0700
committerArnavion <arnavion@gmail.com>2013-06-22 22:06:49 -0700
commitc7d1102c61fd3efe8d46c6b0d714d6de2760db5a (patch)
tree70c92590338dd1eac2827f25fd7a994b875b3dc8 /plugins/perl
parent6e3f05fcc7c1b57fc97e3473d1f01071c325c695 (diff)
perl: Fixed get_list('networks') to work with new servlist.conf syntax for autojoin channels.
Diffstat (limited to 'plugins/perl')
-rw-r--r--plugins/perl/lib/Xchat/List/Network/AutoJoin.pm28
-rw-r--r--plugins/perl/lib/Xchat/List/Network/Entry.pm5
2 files changed, 16 insertions, 17 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 {
diff --git a/plugins/perl/lib/Xchat/List/Network/Entry.pm b/plugins/perl/lib/Xchat/List/Network/Entry.pm
index e40b48bd..6f2aa925 100644
--- a/plugins/perl/lib/Xchat/List/Network/Entry.pm
+++ b/plugins/perl/lib/Xchat/List/Network/Entry.pm
@@ -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 {