X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fqrz.pl;h=ca1935a4c53dbe131e5bb5e4aade2a80d7b234cb;hb=65a4b5776154155cb012fe7968558d0449d74ef3;hp=4468e13161990504238e8e2f3eba5436c2a82ee5;hpb=4857e1753d2fa365287d222e5fe8eacff9236eb5;p=spider.git diff --git a/cmd/show/qrz.pl b/cmd/show/qrz.pl index 4468e131..ca1935a4 100644 --- a/cmd/show/qrz.pl +++ b/cmd/show/qrz.pl @@ -3,6 +3,8 @@ # # from an idea by Steve Franke K9AN and information from Angel EA7WA # +# Copyright (c) 2001 Dirk Koopman G1TLH +# # $Id$ # my ($self, $line) = @_; @@ -13,23 +15,41 @@ my @out; return (1, $self->msg('e24')) unless $Internet::allow; return (1, "SHOW/QRZ , e.g. SH/QRZ g1tlh") unless @list; +#my $target = $Internet::http_proxy || 'www.qrz.com'; +#my $port = $Internet::http_proxy_port || 80; +#my $url = ''; +#$url = 'http://www.qrz.com' if $Internet::http_proxy; +my $target = $Internet::http_proxy || $Internet::qrz_url || 'www.qrz.com'; +my $port = $Internet::http_proxy_port || 80; +my $url = ''; +$url = 'http://' . ($Internet::qrz_url || '$www.qrz.com') if $Internet::http_proxy; + use Net::Telnet; my $t = new Net::Telnet; foreach $l (@list) { - $t->open(Host => "qrz.com", - Port => 80, - Timeout => 15); - if ($t) { - my $s = "GET /dxcluster.cgi?callsign=$l\&uid=$Internet::qrz_uid\&pw=$Internet::qrz_pw HTTP/1.0\n\n"; -# print $s; + eval { + $t->open(Host => $target, + Port => $port, + Timeout => 15); + }; + + if (!$t || $@) { + push @out, $self->msg('e18', 'QRZ.com'); + } else { + my $s = "GET $url/p/dxcluster.pl?callsign=$l\&username=$Internet::qrz_uid\&password=$Internet::qrz_pw HTTP/1.0\n\n"; + dbg($s) if isdbg('qrz'); $t->print($s); Log('call', "$call: show/qrz \U$l"); my $state = "blank"; - while (my $result = $t->getline) { -# print $result; + while (my $result = eval { $t->getline(Timeout => 30) } || $@) { + dbg($result) if isdbg('qrz') && $result; + if ($@) { + push @out, $self->msg('e18', 'QRZ.com'); + last; + } if ($state eq 'blank' && $result =~ /^\s*Callsign\s*:/i) { $state = 'go'; } elsif ($state eq 'go') { @@ -39,9 +59,7 @@ foreach $l (@list) { } } $t->close; - push @out, $self->msg('e3', 'qrz.com', $l) unless @out; - } else { - push @out, $self->msg('e18', 'QRZ.com'); + push @out, $self->msg('e3', 'qrz.com', uc $l) unless @out; } }