X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fik3qar.pl;fp=cmd%2Fshow%2Fik3qar.pl;h=cc1d67d54c0421dac708f12de29ed1bdcd1e6497;hb=51de27cf70637ec8687f43d75d4d9ef3f67e1fa3;hp=0000000000000000000000000000000000000000;hpb=2255cfd184e50c01e1b655961a59ae050147aa79;p=spider.git diff --git a/cmd/show/ik3qar.pl b/cmd/show/ik3qar.pl new file mode 100644 index 00000000..cc1d67d5 --- /dev/null +++ b/cmd/show/ik3qar.pl @@ -0,0 +1,51 @@ +# +# Query the IK3QAR Database server for a callsign +# +# from an idea by Paolo,IK3QAR and Leo,IZ5FSA +# +# $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; + +my $target = $Internet::ik3qar_url; +my $port = 80; +my $url = "http://".$target; + +use Net::Telnet; +my $t = new Net::Telnet; +eval {$t->open( Host => $target, + Port => $port, + Timeout => 30); +}; + +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; +} + +return (1, @out);