use List::Util ();
use Symbol();
use Time::HiRes ();
+use Carp ();
{
package Xchat;
}
sub get_list {
+ unless( grep { $_[0] eq $_ } qw(channels dcc ignore notify users networks) ) {
+ Carp::carp( "'$_[0]' does not appear to be a valid list name" );
+ }
if( $_[0] eq 'networks' ) {
- return Xchat::List::Server->get();
+ return Xchat::List::Network->get();
} else {
return Xchat::Internal::get_list( $_[0] );
}
} # end of Xchat::Embed package
{
-package Xchat::List::Server;
+package Xchat::List::Network;
use strict;
use warnings;
use Storable qw(dclone);
while( my $record = <$fh> ) {
chomp $record;
next if $record =~ /^v=/; # skip the version line
- push @servers, Xchat::List::Server::Entry::parse( $record );
+ push @servers, Xchat::List::Network::Entry::parse( $record );
}
} else {
warn "Unable to open '$server_file': $!";
my $clone = dclone( \@servers );
return @$clone;
}
-} # end of Xchat::List::Server
+} # end of Xchat::List::Network
{
-package Xchat::List::Server::Entry;
+package Xchat::List::Network::Entry;
use strict;
use warnings;
# the order of the channels need to be maintained
# list of { channel => .., key => ... }
- autojoins => Xchat::List::Server::AutoJoin->new( '' ),
+ autojoins => Xchat::List::Network::AutoJoin->new( '' ),
connect_commands => [],
flags => {},
selected => undef,
/^J.(.*)/ && do {
$entry->{ autojoins } =
- Xchat::List::Server::AutoJoin->new( $1 );
+ Xchat::List::Network::AutoJoin->new( $1 );
};
/^F.(.*)/ && do {
}
}
-} # end of Xchat::List::Server::Entry
+} # end of Xchat::List::Network::Entry
{
-package Xchat::List::Server::AutoJoin;
+package Xchat::List::Network::AutoJoin;
use strict;
use warnings;
if ( $line ) {
my ( $channels, $keys ) = split / /, $line, 2;
my @channels = split /,/, $channels;
- my @keys = split /,/, $keys;
+ my @keys = split /,/, ($keys || '');
for my $channel ( @channels ) {
my $key = shift @keys;