added show/425 command
authorminima <minima>
Mon, 26 Jul 2004 15:10:19 +0000 (15:10 +0000)
committerminima <minima>
Mon, 26 Jul 2004 15:10:19 +0000 (15:10 +0000)
added variables into Internet.pm for 'external' connections

Changes
cmd/show/425.pl [new file with mode: 0644]
cmd/show/db0sdx.pl
cmd/show/qrz.pl
cmd/show/wm7d.pl
perl/Internet.pm

diff --git a/Changes b/Changes
index 4792fdc0d1af8aa600298ec05a5119b07640e513..3ac0fd7a10bb217eaf425a66ffd5baa6d7b8dfd5 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,7 @@
+26Jul04=======================================================================
+1. added extra variables to Internet.pm to allow the various internet query
+commands to alter the url that they use. 
+2. Added show/425 command from Leo, IZ5FSA.
 05Jul04=======================================================================
 1. fix rspfcheck on pc27
 23Jun04=======================================================================
diff --git a/cmd/show/425.pl b/cmd/show/425.pl
new file mode 100644 (file)
index 0000000..9fb8d96
--- /dev/null
@@ -0,0 +1,49 @@
+#
+# Query the 425 Database server for a callsign
+#
+# from an idea by Leonardo Lastrucci IZ5FSA and information from Mauro I1JQJ
+#
+# $Id$
+#
+my ($self, $line) = @_;
+my @list = map {uc} split /\s+/, $line;                      # generate a list of callsigns
+my $l;
+my $call = $self->call;
+my @out;
+
+return (1, $self->msg('e24')) unless $Internet::allow;
+return (1, "SHOW/425 <callsign>, e.g. SH/425 3B9FR") unless @list;
+my $target = $Internet::http_proxy || $Internet::dx425_url || "www.ariscandicci.it";
+my $port = $Internet::http_proxy_port || 80;
+my $url = '';
+$url = 'http://' . ($Internet::dx425_url || 'www.ariscandicci.it'); #  if $Internet::http_proxy; 
+
+use Net::Telnet;
+
+my $t = new Net::Telnet;
+
+foreach $l (@list) {
+       eval {
+               $t->open(Host     =>  $target,
+                                Port     =>  $port,
+                                Timeout  =>  15);
+       };
+       if (!$t || $@) {
+               push @out, $self->msg('e18', 'Open(425.org)');
+       } else {
+               my $s = "GET $url/modules.php?name=425dxn&op=spider&query=$l";
+               dbg($s) if isdbg('425');
+               $t->print($s);
+               Log('call', "$call: show/425 \U$l");
+               my $state = "blank";
+               while (my $result = eval { $t->getline(Timeout => 30) } || $@) {
+                       dbg($result) if isdbg('425') && $result;
+                               chomp $result;
+                               push @out, $result;
+               }
+               $t->close;
+               push @out, $self->msg('e3', 'Search(425.org)', uc $l) unless @out;
+       }
+}
+
+return (1, @out);
index c90ecf976215f810ed64f30c520437509ee6dd3b..4fab75b2be2edcc4507e4fe2d9f0532c16202dcb 100644 (file)
@@ -13,7 +13,7 @@ my @out;
 $line = uc $line;
 return (1, $self->msg('e24')) unless $Internet::allow;
 return (1, "SHOW/DB0SDX <callsign>, e.g. SH/DB0SDX ea7wa") unless $line && is_callsign($line);
-my $target = 'dotnet.grossmann.com';
+my $target = $Internet::db0sdx_url || 'dotnet.grossmann.com';
 my $port = 80;
 my $cmdprompt = '/query->.*$/';
 
index 7122992f6d91c79c3f7d5f8df3cae1c2928a1158..ca1935a4c53dbe131e5bb5e4aade2a80d7b234cb 100644 (file)
@@ -15,10 +15,15 @@ my @out;
 
 return (1, $self->msg('e24')) unless $Internet::allow;
 return (1, "SHOW/QRZ <callsign>, e.g. SH/QRZ g1tlh") unless @list;
-my $target = $Internet::http_proxy || 'www.qrz.com';
+#my $target = $Internet::http_proxy || 'www.qrz.com';
+#my $port = $Internet::http_proxy_port || 80;
+#my $url = '';
+#$url = 'http://www.qrz.com' if $Internet::http_proxy; 
+my $target = $Internet::http_proxy || $Internet::qrz_url || 'www.qrz.com';
 my $port = $Internet::http_proxy_port || 80;
 my $url = '';
-$url = 'http://www.qrz.com' if $Internet::http_proxy; 
+$url = 'http://' . ($Internet::qrz_url || '$www.qrz.com') if $Internet::http_proxy;
+
 
 use Net::Telnet;
 
index 8e48a20d93ff33eb5b387a0ff7daa805ecb40ae6..097a6295824730e66b229387069cc1c83906d141 100644 (file)
@@ -16,7 +16,7 @@ my @out;
 # send 'e24' if allow in Internet.pm is not set to 1
 return (1, $self->msg('e24')) unless $Internet::allow;
 return (1, "SHOW/WM7D <callsign>, e.g. SH/WM7D k1xx") unless $line;
-my $target = 'www.wm7d.net';
+my $target = $Internet::wm7d_url || 'www.wm7d.net';
 my $port = 5000;
 my $cmdprompt = '/query->.*$/';
 
index b6a387ee36fb98bc03d0da059e263b2f36fdc060..98ae03612c9bf3316e3f46db469a6fa300472e5f 100644 (file)
@@ -29,6 +29,7 @@ $allow = 0;
 # $qrz_uid = 'gb7xxx';
 #
 
+
 $qrz_uid = undef;
 
 #
@@ -58,6 +59,15 @@ $http_proxy = undef;
 
 $http_proxy_port = undef;
 
+#
+# list of urls that are used in commands, here so that they
+# can be changed if necessary.
+#
+
+$qrz_url = 'www.qrz.com';     # used by show/qrz
+$wm7d_url = 'www.wm7d.net';   # used by show/wm7d
+$db0sdx_url = 'dotnet.grossmann.com';   # used by show/db0sdx
+$dx425_url = 'www.ariscandicci.it';            # used by show/425
 
 #
 # end