AsyncMsgise sh/425
authorDirk Koopman <djk@tobit.co.uk>
Sun, 8 Sep 2013 15:17:17 +0000 (16:17 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Sun, 8 Sep 2013 15:17:17 +0000 (16:17 +0100)
cmd/show/425.pl
cmd/show/contest.pl
cmd/show/wm7d.pl
perl/Version.pm

index 4328e3aca85e0af5aa9ffc548972057feac477d7..86e66554181c82dcbbf8aadf39a101e07ded6794 100644 (file)
@@ -5,59 +5,41 @@
 #
 #
 #
-my ($self, $line) = @_;
-my @list = map {uc} split /\s+/, $line;               # generate a list of callsigns
-my $op;
-my $call = $self->call;
-my @out;
 
-return (1, $self->msg('e24')) unless $Internet::allow;
-return (1, "SHOW/425 <callsign>\nSHOW/425 CAL\nSHOW/425 BULL <bulletin number>\n e.g. SH/425 IQ5BL, SH/425 CAL, SH/425 BUL 779\n") unless @list;
+sub handle
+{
+       my ($self, $line) = @_;
+       my @list = map {uc} split /\s+/, $line; # generate a list of callsigns
+       my $op;
+       my $call = $self->call;
+       my @out;
 
-my $target = "www.ariscandicci.it";
-my $port = 80;
-my $url = "http://www.ariscandicci.it";
+       return (1, $self->msg('e24')) unless $Internet::allow;
+       return (1, "SHOW/425 <callsign>\nSHOW/425 CAL\nSHOW/425 BULL <bulletin number>\n e.g. SH/425 IQ5BL, SH/425 CAL, SH/425 BUL 779\n") unless @list;
 
-use Net::Telnet;
-my $t = new Net::Telnet;
-eval {$t->open( Host     => $target,
-                Port     => $port,
-                Timeout  => 30);
-};
+       my $target = "www.ariscandicci.it";
+       my $port = 80;
 
-if (!$t || $@) {
+       dbg(join('|', @list)) if isdbg('425');
+       if ($list[0] eq "CAL") {
+               $op="op=cal";
+       } elsif ($list[0] eq "BULL") {
+               $op="op=bull&query=$list[1]";
+       } else {
+               $op="op=search&query=$list[0]";
+       }
+       
+       my $path = "/425dxn/spider.php?$op";
+       
+       Log('call', "$call: show/425 \U$op");
+       my $conn = AsyncMsg->get($self, $target, $port, $path, prefix=>'425> ', 'User-Agent' => qq{DxSpider;$main::version;$main::build;$^O;$main::mycall;$call;$list[0]});
+       
+       if ($conn) {
+               push @out, $self->msg('m21', "show/425");
+       } else {
         push @out, $self->msg('e18', 'Open(ARI.org)');
-} else {
-        dbg($list[0]."|".$list[1]) if isdbg('425');
-        if ($list[0] eq "CAL") {
-                $op="op=cal";
-        }
-        elsif ($list[0] eq "BULL") {
-                $op="op=bull&query=".$list[1];
-        }
-        else {
-                $op="op=search&query=".$list[0];
-        }
-       my $s = "GET /425dxn/spider.php?$op HTTP/1.1\n"
-        ."User-Agent:DxSpider;$main::version;$main::build;$^O;$main::mycall;$call;$list[0]\nHost: $target\n\n";
-        dbg($s) if isdbg('425');
-        $t->print($s);
-        Log('call', "$call: show/425 \U$op");
-        my $state = "blank";
-        my $count = 1;
-               my @timeout = qw(Timeout 30);
-        while (my $result = eval { $t->getline(@timeout) } || $@) {
-                dbg($result) if isdbg('425') && $result;
-                dbg($@) if isdbg('425') && $@;
-                ++$count;
-                if ($count > 9) {
-                                               last if $@;
-                        push @out, $result;
-                }
-                               @timeout = qw(Timeout 2);
-        }
-        $t->close;
-        push @out, $self->msg('e3', 'Search(ARI.org)', uc $op) unless @out;
+       }
+
+       return (1, @out);
 }
 
-return (1, @out);
index a43e0ea715fa4ede421ef9c7c1703af30ae21cf8..524f6b86c84995e6e8e7af5530408e901df222b3 100644 (file)
@@ -2,9 +2,8 @@
 # used with 1 argument: sh/contest <yearandmonth>
 # e g sh/contest 2002sep
 # Tommy Johansson (SM3OSM) 2002-07-23
-# New version using Net::Telnet  2003-03-09
-#
 #
+# New version use AsyncMsg (c) Dirk Koopman G1TLH
 #
 
 sub handle
index 068097cac1a47f9ff92851ae845a2ecf2b84ed90..e77bed269dfcd7783f3cccd27634752e2fd06074 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Query the WM7D Database server for a callsign
 #
-# Was Largely based on "sh/qrz" and info in the Net::Telnet documentation
+# Was Largely based on "sh/qrz"
 #
 # Original Copyright (c) 2002 Charlie Carroll K1XX
 #
index 4178804a3f83d66114ec91a014f3330b7d43e4a0..acd6cd8d28607cf85db8a8809a88518922335a5f 100644 (file)
@@ -11,7 +11,7 @@ use vars qw($version $subversion $build $gitversion);
 
 $version = '1.55';
 $subversion = '0';
-$build = '129';
-$gitversion = '9fc2ec1';
+$build = '130';
+$gitversion = 'cc83de0';
 
 1;