X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fwm7d.pl;h=313fb0fe8151efa51aab4adcfcab6d153daa06cb;hb=fd2d8314dd4fcdd7997ef80e7740702e0bad618d;hp=6dfb5b14172a8885511fd9fa97055eb19565c6e4;hpb=a55492232d670247a2c1fb3406a129bc04847e8b;p=spider.git diff --git a/cmd/show/wm7d.pl b/cmd/show/wm7d.pl index 6dfb5b14..313fb0fe 100644 --- a/cmd/show/wm7d.pl +++ b/cmd/show/wm7d.pl @@ -9,35 +9,41 @@ # # wm7d accepts only single callsign -my ($self, $line) = @_; -my $call = $self->call; -my @out; +sub handle +{ -# send 'e24' if allow in Internet.pm is not set to 1 -return (1, $self->msg('e24')) unless $Internet::allow; -return (1, "SHOW/WM7D , e.g. SH/WM7D k1xx") unless $line; -my $target = $Internet::wm7d_url || 'www.wm7d.net'; -my $port = 5000; -my $cmdprompt = '/query->.*$/'; + my ($self, $line) = @_; + my $call = $self->call; + my @out; -my($info, $t); + # send 'e24' if allow in Internet.pm is not set to 1 + return (1, $self->msg('e24')) unless $Internet::allow; + return (1, "SHOW/WM7D , e.g. SH/WM7D k1xx") unless $line; + my $target = $Internet::wm7d_url || 'www.wm7d.net'; + my $port = 5000; + my $cmdprompt = '/query->.*$/'; + + my($info, $t); -$t = new Net::Telnet; -$info = $t->open(Host => $target, - Port => $port, - Timeout => 20); + $t = new Net::Telnet; + $info = $t->open(Host => $target, + Port => $port, + Timeout => 20); -if (!$info) { - push @out, $self->msg('e18', 'WM7D.net'); -} else { + if (!$info) { + push @out, $self->msg('e18', 'WM7D.net'); + } + else { ## Wait for prompt and respond with callsign. $t->waitfor($cmdprompt); - $t->print($line); + $t->print($line); ($info) = $t->waitfor($cmdprompt); - # Log the lookup - Log('call', "$call: show/wm7d \U$line"); - $t->close; - push @out, split /[\r\n]+/, $info; + # Log the lookup + Log('call', "$call: show/wm7d \U$line"); + $t->close; + push @out, split /[\r\n]+/, $info; + } + return (1, @out); } -return (1, @out); +