--- /dev/null
+#
+# 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);
+}
# 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;
my $dxchan = shift;
my ($tag, $data) = $msg =~ m|^\s*<(\w+)>(.*)</|;
- my $prefix = $conn->{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
_send($conn, $msg, $dxchan);
}
} elsif ($state eq 'go') {
- return if $msg =~ m|<user>|;
- return if $msg =~ m|<u_views>|;
- return if $msg =~ m|<locref>|;
- return if $msg =~ m|<ccode>|;
- return if $msg =~ m|<dxcc>|;
if ($msg =~ m|</Callsign>|) {
$conn->{state} = 'skip';
return;
return (1, $self->msg('e24')) unless $Internet::allow;
return (1, "SHOW/QRZ <callsign>, 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");