X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2F425.pl;h=938747fbf8cf4b9870a713d86edc5fb0cd9c842f;hb=8d006937d3630d245d81b57c4e5106431f761337;hp=a8558da9c184ac1eed18561d7363aaaa77284a20;hpb=2c2c45efbcce729b412cd1ec4e1298897c734a3f;p=spider.git diff --git a/cmd/show/425.pl b/cmd/show/425.pl index a8558da9..938747fb 100644 --- a/cmd/show/425.pl +++ b/cmd/show/425.pl @@ -1,58 +1,45 @@ # # Query the 425 Database server for a callsign # -# from an idea by Leonardo Lastrucci IZ5FSA and information from Mauro I1JQJ +# from an idea by Leo,IZ5FSA and 425DxNews Group +# # -# $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 $target = $Internet::http_proxy || $Internet::dx425_url || "192.168.0.2"; -my $port = $Internet::http_proxy_port || 80; -my $url = ''; -$url = 'http://' . ($Internet::dx425_url || 'www.ariscandicci.it'); # if $Internet::http_proxy; -#$url = 'http://' . ($Internet::dx425_url || '192.168.0.2'); # if $Internet::http_proxy; +sub handle +{ + my ($self, $line) = @_; + my @list = map {uc} split /\s+/, $line; # generate a list of callsigns + my $op; + my $call = $self->call; + my @out; -use Net::Telnet; + return (1, $self->msg('e24')) unless $Internet::allow; + return (1, "SHOW/425 \nSHOW/425 CAL\nSHOW/425 BULL \n e.g. SH/425 IQ5BL, SH/425 CAL, SH/425 BUL 779\n") unless @list; -my $t = new Net::Telnet; + my $target = $Internet::dx425_url || 'www.iz5fsa.net'; + my $port = 80; -foreach $l (@list) { - eval { - $t->open(Host => $target, - Port => $port, - Timeout => 15); - }; - if (!$t || $@) { - push @out, $self->msg('e18', 'Open(425.org)'); + dbg(join('|', @list)) if isdbg('425'); + if ($list[0] eq "CAL") { + $op="op=cal"; + } elsif ($list[0] eq "BULL") { + $op="op=bull&query=$list[1]"; + } else { + $op="op=search&query=$list[0]"; + } + + my $path = "/425dxn/spider.php?$op"; + + Log('call', "$call: show/425 \U$op"); + my $conn = AsyncMsg->get($self, $target, $path, prefix=>'425> ', 'User-Agent' => qq{DxSpider;$main::version;$main::build;$^O;$main::mycall;$call;$list[0]}); + + if ($conn) { + push @out, $self->msg('m21', "show/425"); } else { - my $s = "GET $url/modules.php?name=425dxn&op=spider&query=$l HTTP/1.0\n" - ."User-Agent:DxSpider;$main::version;$main::build;$^O;$main::mycall;$call;$l\n\n"; - dbg($s) if isdbg('425'); - $t->print($s); - Log('call', "$call: show/425 \U$l"); - my $state = "blank"; - my $count = 1; -# push @out, $s; - while (my $result = eval { $t->getline(Timeout => 30) } || $@) { - dbg($result) if isdbg('425') && $result; - ++$count; - if ($count > 10) - { - #chomp $result; - push @out, $result; - } - } - $t->close; - push @out, $self->msg('e3', 'Search(425.org)', uc $l) unless @out; + push @out, $self->msg('e18', 'Open(ARI.org)'); } + + return (1, @out); } -return (1, @out);