From: Dirk Koopman Date: Tue, 10 Sep 2013 22:42:24 +0000 (+0100) Subject: update sh/qrz and start get/keps X-Git-Tag: 1.57~4 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=b099b4a232e18d4204e10d0dbe0b63f741176baf;p=spider.git update sh/qrz and start get/keps --- diff --git a/cmd/get/keps.pl b/cmd/get/keps.pl new file mode 100644 index 00000000..54e38609 --- /dev/null +++ b/cmd/get/keps.pl @@ -0,0 +1,58 @@ +# +# Query the DB0SDX QSL server for a callsign +# +# Copyright (c) 2003 Dirk Koopman G1TLH +# Modified Dec 9, 2004 for new website and xml schema by David Spoelstra N9KT +# and tidied up by me (Dirk) +# +# +# + +sub on_disc +{ + my $conn = shift; + my $dxchan = shift; + my @out; + + dbg("keps in: $conn->{kepsin}") if isdbg('keps'); + + $dxchan->send("get/keps: new keps loaded"); +} + +sub process +{ + my $conn = shift; + my $msg = shift; + + $conn->{kepsin} .= "$msg\n"; + + dbg("keps in: $conn->{kepsin}") if isdbg('keps'); +} + +sub handle +{ + my ($self, $line) = @_; + my $call = $self->call; + my @out; + + $line = uc $line; + return (1, $self->msg('e24')) unless $Internet::allow; + my $target = $Internet::keps_url || 'www.amsat.org'; + my $path = $Internet::keps_path || '/amsat/ftp/keps/current/nasa.all'; + my $port = 80; + + dbg("keps: contacting $target:$port") if isdbg('keps'); + + Log('call', "$call: show/keps $line"); + my $conn = AsyncMsg->post($self, $target, $port, $path, + filter => \&process, + on_disc => \&on_disc); + + if ($conn) { + push @out, $self->msg('m21', "show/keps"); + } else { + push @out, $self->msg('e18', 'get/keps error'); + } + + return (1, @out); +} diff --git a/cmd/show/qrz.pl b/cmd/show/qrz.pl index b9d70441..3e928f58 100644 --- a/cmd/show/qrz.pl +++ b/cmd/show/qrz.pl @@ -9,6 +9,10 @@ # Copyright (c) 2001-2013 Dirk Koopman G1TLH # +use vars qw (%allowed); + +%allowed = qw(call 1 fname 1 name 1 addr2 1 state 1 country 1 lat 1 lon 1 county 1 moddate 1 qslmgr 1 grid 1 ); + sub _send { my $conn = shift; @@ -16,8 +20,17 @@ sub _send my $dxchan = shift; my ($tag, $data) = $msg =~ m|^\s*<(\w+)>(.*){prefix} || ' '; - $dxchan->send($prefix . sprintf("%-10s: $data", $tag)); + if ($allowed{$tag}) { + my $prefix = $conn->{prefix} || ' '; + $dxchan->send($prefix . sprintf("%-10s: $data", $tag)); + } +} + +sub _on_disc +{ + my $conn = shift; + my $dxchan = shift; + $dxchan->send("Data provided by www.qrz.com"); } sub filter @@ -37,11 +50,6 @@ sub filter _send($conn, $msg, $dxchan); } } elsif ($state eq 'go') { - return if $msg =~ m||; - return if $msg =~ m||; - return if $msg =~ m||; - return if $msg =~ m||; - return if $msg =~ m||; if ($msg =~ m||) { $conn->{state} = 'skip'; return; @@ -59,13 +67,13 @@ sub handle return (1, $self->msg('e24')) unless $Internet::allow; return (1, "SHOW/QRZ , e.g. SH/QRZ g1tlh") unless $line; - my $target = $Internet::qrz_url || 'xml.qrz.com'; + my $target = $Internet::qrz_url || 'xmldata.qrz.com'; my $port = 80; - my $path = qq{/xml?callsign=$line;username=$Internet::qrz_uid;password=$Internet::qrz_pw;agent=dxspider}; + my $path = qq{/xml/current/?callsign=$line;username=$Internet::qrz_uid;password=$Internet::qrz_pw;agent=dxspider}; dbg("qrz: $path") if isdbg('qrz'); Log('call', "$call: show/qrz \U$line"); - my $conn = AsyncMsg->get($self, $target, $port, $path, filter=>\&filter, prefix=>'qrz> '); + my $conn = AsyncMsg->get($self, $target, $port, $path, filter=>\&filter, prefix=>'qrz> ', on_disc=>\&_on_disc); if ($conn) { $conn->{state} = 'blank'; push @out, $self->msg('m21', "show/qrz"); diff --git a/perl/Version.pm b/perl/Version.pm index b23b359f..5740ddeb 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,7 +11,7 @@ use vars qw($version $subversion $build $gitversion); $version = '1.55'; $subversion = '0'; -$build = '132'; -$gitversion = '8bb293d'; +$build = '133'; +$gitversion = 'e941823'; 1;