2 # Query the QRZ Database server for a callsign
4 # from an idea by Steve Franke K9AN and information from Angel EA7WA
5 # and finally (!) modified to use the XML interface
7 # Then made asyncronous...
9 # Copyright (c) 2001-2013 Dirk Koopman G1TLH
18 my ($tag, $data) = $msg =~ m|^\s*<(\w+)>(.*)</|;
19 my $prefix = $conn->{prefix} || ' ';
20 $dxchan->send($prefix . sprintf("%-10s: $data", $tag));
29 my $state = $conn->{state};
31 dbg("qrz: $state $msg") if isdbg('qrz');
33 if ($state eq 'blank') {
34 if ($msg =~ /^<Callsign>/) {
35 $conn->{state} = 'go';
36 } elsif ($msg =~ /^<Error>/) {
37 _send($conn, $msg, $dxchan);
39 } elsif ($state eq 'go') {
40 return if $msg =~ m|<user>|;
41 return if $msg =~ m|<u_views>|;
42 return if $msg =~ m|<locref>|;
43 return if $msg =~ m|<ccode>|;
44 return if $msg =~ m|<dxcc>|;
45 if ($msg =~ m|</Callsign>|) {
46 $conn->{state} = 'skip';
50 _send($conn, $msg, $dxchan);
56 my ($self, $line) = @_;
57 my $call = $self->call;
60 return (1, $self->msg('e24')) unless $Internet::allow;
61 return (1, "SHOW/QRZ <callsign>, e.g. SH/QRZ g1tlh") unless $line;
62 my $target = $Internet::qrz_url || 'xml.qrz.com';
64 my $path = qq{/xml?callsign=$line;username=$Internet::qrz_uid;password=$Internet::qrz_pw;agent=dxspider};
65 dbg("qrz: $path") if isdbg('qrz');
67 Log('call', "$call: show/qrz \U$line");
68 my $conn = AsyncMsg->get($self, $target, $port, $path, filter=>\&filter, prefix=>'qrz> ');
70 $conn->{state} = 'blank';
71 push @out, $self->msg('m21', "show/qrz");
73 push @out, $self->msg('e18', 'QRZ.com');