list.txt support
This commit is contained in:
parent
0bb271cefd
commit
326d033b29
31
II/Config.pm
31
II/Config.pm
@ -1,6 +1,9 @@
|
||||
package II::Config;
|
||||
|
||||
use Config::Tiny;
|
||||
use LWP::UserAgent;
|
||||
use HTTP::Request;
|
||||
use Data::Dumper;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
@ -25,6 +28,10 @@ sub load {
|
||||
my @echoareas = split /,/, $config->{node}->{echoareas};
|
||||
my $name = $config->{node}->{name};
|
||||
|
||||
if ( $config->{node}->{list} eq 'yes' ) {
|
||||
@echoareas = echo_from_list($host);
|
||||
}
|
||||
|
||||
$c = {
|
||||
nick => $nick,
|
||||
key => $key,
|
||||
@ -38,4 +45,28 @@ sub load {
|
||||
return $c;
|
||||
}
|
||||
|
||||
# Make echoareas list from list.txt
|
||||
sub echo_from_list {
|
||||
my ($host) = @_;
|
||||
|
||||
my $list = $host . 'list.txt';
|
||||
my @echoes;
|
||||
|
||||
my $ua = LWP::UserAgent->new();
|
||||
$ua->agent("Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0)");
|
||||
|
||||
my $req = HTTP::Request->new( GET => $list );
|
||||
my $res = $ua->request($req);
|
||||
|
||||
if ( $res->is_success ) {
|
||||
my @e = split /\n/, $res->content();
|
||||
while (<@e>) {
|
||||
my @description = split /:/, $_;
|
||||
push @echoes, $description[0];
|
||||
}
|
||||
}
|
||||
|
||||
return @echoes;
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -4,8 +4,9 @@ nick =
|
||||
|
||||
[node]
|
||||
host = http://ii-net.tk/ii/ii-point.php?q=/
|
||||
list = yes
|
||||
;host = http://spline.rooker.ru/i/ii-point.php?q=/
|
||||
echoareas = ii.14,pipe.2032,lit.14,linux.14,lor-opennet.15,ru.humor.14,music.14,bone.14,lenta.dark.14,mlp.15,habra.16,ifiction.15,game.rogue.14,vk-news.14,lenta.rss.15.4,piratemedia.rss.15,younglinux.info.14,iing.15,python.15
|
||||
echoareas = ii.14,pipe.2032,lit.14,linux.14,lor-opennet.15,ru.humor.14,music.14,bone.14,lenta.dark.14,mlp.15,habra.16,ifiction.15,game.rogue.14,vk-news.14,lenta.rss.15.4,piratemedia.rss.15,younglinux.info.14,iing.15,python.15,develop.16
|
||||
;echoareas = python.15
|
||||
|
||||
[elastic]
|
||||
|
Loading…
Reference in New Issue
Block a user