2 # Query the WM7D Database server for a callsign
4 # Was Largely based on "sh/qrz"
6 # Original Copyright (c) 2002 Charlie Carroll K1XX
8 # Async version (c) Dirk Koopman G1TLH
17 my $buf = $conn->{msg};
20 dbg "state $conn->{state} '$msg' '$buf'";
22 if ($conn->{state} eq 'waitfor') {
23 if ($msg =~ /utc$/ ) {
24 $conn->send_later("$conn->{target_call}\n");
25 $conn->{state} = 'working';
27 } elsif ($conn->{state} eq 'working') {
28 if ($conn->{msg} =~ /^\rquery->\s*$/) {
29 $conn->send_later("QUIT\n");
30 $conn->{state} = 'ending';
32 return if $msg =~ /^query->/;
33 $conn->handle_raw($msg);
35 return if $msg =~ /^query->/ || $msg =~ /bye/;
36 $conn->handle_raw($msg);
40 # wm7d accepts only single callsign
44 my ($self, $line) = @_;
45 my $call = $self->call;
51 # send 'e24' if allow in Internet.pm is not set to 1
52 return (1, $self->msg('e24')) unless $Internet::allow;
53 return (1, "SHOW/WM7D <callsign>, e.g. SH/WM7D k1xx") unless $line;
54 my $target = $Internet::wm7d_url || 'www.wm7d.net';
56 my $cmdprompt = '/query->.*$/';
58 Log('call', "$call: show/wm7d \U$line");
60 my $conn = AsyncMsg->raw($self, $target, $port,
61 handler => \&waitfor, prefix=>'wm7d> ');
63 $conn->{state} = 'waitfor';
64 $conn->{target_call} = $line;
66 push @out, $self->msg('m21', "show/wm7d");
68 push @out, $self->msg('e18', 'WM7D.net');