From 3c932e6294c79fad1effeb667b20b1ad7a0d3154 Mon Sep 17 00:00:00 2001 From: "Denis(Difrex) Zheleztsov" Date: Thu, 6 Nov 2014 11:24:03 +0300 Subject: [PATCH] Initial multihosts support --- iiplc.app | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/iiplc.app b/iiplc.app index 6b93116..aab6029 100644 --- a/iiplc.app +++ b/iiplc.app @@ -64,10 +64,22 @@ my $thread = sub { return [ 200, [ 'Content-type' => 'text/html' ], ["$thread"], ]; }; +# Get new messages my $get = sub { $config = $c->reload(); - my $GET = II::Get->new($config); - my $msgs = $GET->get_echo(); + my $msgs; + if ( $config->{host} =~ m/.+\,.+/ ) { + my @hosts = split( /,/, $config->{host} ); + foreach my $host (@hosts) { + $config->{host} = $host; + my $GET = II::Get->new($config); + $msgs .= $GET->get_echo(); + } + } + else { + my $GET = II::Get->new($config); + $msgs .= $GET->get_echo(); + } my $new_mes = $render->new_mes($msgs); return [ 200, [ 'Content-type' => 'text/html' ], ["$new_mes"], ]; };