X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fik3qar.pl;h=d18906ae0db0b3d8d72e287923e759e5e8a280ee;hb=fd2d8314dd4fcdd7997ef80e7740702e0bad618d;hp=cc1d67d54c0421dac708f12de29ed1bdcd1e6497;hpb=a55492232d670247a2c1fb3406a129bc04847e8b;p=spider.git diff --git a/cmd/show/ik3qar.pl b/cmd/show/ik3qar.pl index cc1d67d5..d18906ae 100644 --- a/cmd/show/ik3qar.pl +++ b/cmd/show/ik3qar.pl @@ -5,47 +5,34 @@ # # $Id$ # -my ($self, $line) = @_; -my @list = map {uc} split /\s+/, $line; # generate a list of callsigns -my $op; -my $call = $self->call; -my @out; -return (1, $self->msg('e24')) unless $Internet::allow; -return (1, "SHOW/IK3QAR \n e.g. SH/IK3QAR II5I, SH/IK3QAR V51AS\n") unless @list; +sub handle +{ + my ($self, $line) = @_; + my $op; + my $call = $self->call; + my @out; -my $target = $Internet::ik3qar_url; -my $port = 80; -my $url = "http://".$target; + return (1, $self->msg('e24')) unless $Internet::allow; + return (1, "SHOW/IK3QAR \n e.g. SH/IK3QAR II5I, SH/IK3QAR V51AS\n") unless $line; -use Net::Telnet; -my $t = new Net::Telnet; -eval {$t->open( Host => $target, - Port => $port, - Timeout => 30); -}; + my $target = $Internet::ik3qar_url; + my $port = 80; + my $url = "http://".$target; -if (!$t || $@) { - push @out, $self->msg('e18', 'Open(IK3QAR.it)'); -} else { - dbg($list[0]."|".$list[1]) if isdbg('IK3QAR'); - $op="call=".$list[0]."&node=".$main::mycall."&passwd=".$Internet::ik3qar_pw."&user=".$call; - my $s = "GET $url/manager/dxc/dxcluster.php?$op HTTP/1.0\n" - ."User-Agent:DxSpider;$main::version;$main::build;$^O;$main::mycall;$call\n\n"; - dbg($s) if isdbg('IK3QAR'); - $t->print($s); - Log('call', "$call: SH/IK3QAR $list[0]"); - my $state = "blank"; - my $count = 1; - while (my $result = eval { $t->getline(Timeout => 30) } || $@) { - dbg($result) if isdbg('IK3QAR') && $result; - ++$count; - if ($count > 9) { - push @out, $result; - } - } - $t->close; - push @out, $self->msg('e3', 'Search(IK3QAR.it)', uc $list[0]) unless @out; + $line = uc $line; + dbg("IK3QAR: call = $line") if isdbg('ik3qar'); + $op="call=$line\&node=$main::mycall\&passwd=$Internet::ik3qar_pw\&user=$call"; + my $path = "/manager/dxc/dxcluster.php?$op"; + dbg("IK3QAR: url=$path") if isdbg('ik3qar'); + Log('call', "$call: SH/IK3QAR $line"); + + my $r = HTTPMsg->get($self->call, $target, $port, $path); + if ($r) { + push @out, $self->msg('m21', "show/ik3qar"); + } else { + push @out, $self->msg('e18', 'Open(IK3QAR.it)'); + } + + return (1, @out); } - -return (1, @out);