X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2F425.pl;fp=cmd%2Fshow%2F425.pl;h=9fb8d968f55863633b0a4d16fb2b2dd73219a362;hb=65a4b5776154155cb012fe7968558d0449d74ef3;hp=0000000000000000000000000000000000000000;hpb=a162f8f36fe83f8e45b284a5aa5e71022dcd8be2;p=spider.git diff --git a/cmd/show/425.pl b/cmd/show/425.pl new file mode 100644 index 00000000..9fb8d968 --- /dev/null +++ b/cmd/show/425.pl @@ -0,0 +1,49 @@ +# +# Query the 425 Database server for a callsign +# +# from an idea by Leonardo Lastrucci IZ5FSA and information from Mauro I1JQJ +# +# $Id$ +# +my ($self, $line) = @_; +my @list = map {uc} split /\s+/, $line; # generate a list of callsigns +my $l; +my $call = $self->call; +my @out; + +return (1, $self->msg('e24')) unless $Internet::allow; +return (1, "SHOW/425 , e.g. SH/425 3B9FR") unless @list; +my $target = $Internet::http_proxy || $Internet::dx425_url || "www.ariscandicci.it"; +my $port = $Internet::http_proxy_port || 80; +my $url = ''; +$url = 'http://' . ($Internet::dx425_url || 'www.ariscandicci.it'); # if $Internet::http_proxy; + +use Net::Telnet; + +my $t = new Net::Telnet; + +foreach $l (@list) { + eval { + $t->open(Host => $target, + Port => $port, + Timeout => 15); + }; + if (!$t || $@) { + push @out, $self->msg('e18', 'Open(425.org)'); + } else { + my $s = "GET $url/modules.php?name=425dxn&op=spider&query=$l"; + dbg($s) if isdbg('425'); + $t->print($s); + Log('call', "$call: show/425 \U$l"); + my $state = "blank"; + while (my $result = eval { $t->getline(Timeout => 30) } || $@) { + dbg($result) if isdbg('425') && $result; + chomp $result; + push @out, $result; + } + $t->close; + push @out, $self->msg('e3', 'Search(425.org)', uc $l) unless @out; + } +} + +return (1, @out);