new, more flexible, dx command
authordjk <djk>
Tue, 21 Sep 1999 13:05:58 +0000 (13:05 +0000)
committerdjk <djk>
Tue, 21 Sep 1999 13:05:58 +0000 (13:05 +0000)
cmd/Commands_en.hlp
cmd/dx.pl
perl/Messages

index 83d33ef879a8f3a36a222bda630903e2c20efa9e..58a68abe01e57381e7cc2bd885ec70ca18f2d5d2 100644 (file)
@@ -95,9 +95,25 @@ Sysops can see all users' messages.
 === 8^DISCONNECT <call> [<call> ...]^Disconnect a user or cluster
 Disconnect any <call> connected locally
 
-=== 0^DX <freq> <callsign> <remarks>^Send a DX spot throughout the cluster
-<freq> is compared against the available bands set up in the cluster.
-see show/bands for more information.
+=== 0^DX [BY <call>] <freq> <call> <remarks>^Send a DX spot
+This is how you send a DX Spot to other users. You can, in fact, now
+enter the <freq> and the <call> either way round. 
+
+   DX FR0G 144.600
+   DX 144.600 FR0G
+   DX 144600 FR0G 
+
+will all give the same result. You can add some remarks to the end
+of the command and they will be added to the spot.
+
+   DX FR0G 144600 this is a test
+
+You can credit someone else by saying:-
+
+   DX by G1TLH FR0G 144.600 he isn't on the cluster
+
+The <freq> is compared against the available bands set up in the 
+cluster.  See SHOW/BANDS for more information.
 
 === 1^FORWARD/OPERNAME <call>^Send out information on this <call> to all clusters
 This command sends out any information held in the user file which can 
index dd780699b62e6225727aa771f064e448dc1a3ca8..0ebfb1674cf17564919eea7f243e8e259ba62315 100644 (file)
--- a/cmd/dx.pl
+++ b/cmd/dx.pl
@@ -16,19 +16,32 @@ my $freq;
 my @out;
 my $valid = 0;
 
-# first lets see if we think we have a callsign as the first argument
-if (defined @f && @f >= 3 && $f[0] =~ /[A-Za-z]/) {
-       $spotter = uc $f[0];
+# do we have at least two args?
+return (1, $self->msg('dx2')) unless @f >= 2;
+
+# as a result of a suggestion by Steve K9AN, I am changing the syntax of
+# 'spotted by' things to "dx by g1tlh <freq> <call>" <freq> and <call>
+# can be in any order
+
+if ($f[0] =~ /^by$/i) {
+    $spotter = uc $f[1];
+    $line =~ s/^\s*$f[0]\s+$f[1]\s+//;
+    shift @f;
+       shift @f;
+       return (1, $self->msg('dx2')) unless @f >= 2;
+}
+
+# get the freq and callsign either way round
+if ($f[0] =~ /[A-Za-z]/) {
+       $spotted = uc $f[0];
        $freq = $f[1];
-       $spotted = uc $f[2];
-       $line =~ s/^$f[0]\s+$f[1]\s+$f[2]\s*//;
-} elsif (defined @f && @f >= 2) {
-       $freq = $f[0];
-       $spotted = uc $f[1]; 
-       $line =~ s/^$f[0]\s+$f[1]\s*//;
-} elsif (!defined @f || @f < 2) {
+} elsif ($f[0] =~ /^[0-9\.\,]+$/) {
+    $freq = $f[0];
+       $spotted = uc $f[1];
+} else {
        return (1, $self->msg('dx2'));
 }
+$line =~ s/^$f[0]\s+$f[1]\s*//;
 
 # bash down the list of bands until a valid one is reached
 my $bandref;
@@ -47,7 +60,7 @@ foreach $bandref (Bands::get_all()) {
        }
 }
 
-if (!$valid) {
+unless ($valid) {
 
        # try again in MHZ 
        $freq = $freq * 1000 if $freq;
@@ -65,7 +78,7 @@ if (!$valid) {
 }
 
 
-push @out, $self->msg('dx1', $freq) if !$valid;
+push @out, $self->msg('dx1', $freq) unless $valid;
 
 # check we have a callsign :-)
 if ($spotted le ' ') {
@@ -74,7 +87,7 @@ if ($spotted le ' ') {
        $valid = 0;
 }
 
-return (1, @out) if !$valid;
+return (1, @out) unless $valid;
 
 # change ^ into : for transmission
 $line =~ s/\^/:/og;
index a9afbad2853ef3ae88c3c5962f672c3776b91e50..ae63bd014ce55f0d678a71ef70e168b4705df455 100644 (file)
@@ -25,8 +25,8 @@ package DXM;
                                constart => 'connection to $_[0] started',
                                disc1 => 'Disconnected by $_[0]',
                                disc2 => '$_[0] disconnected',
-                               dx1 => 'Frequency $_[0] not in band [usage: DX freq call comments](see sh/band)',
-                               dx2 => 'Need a callsign [usage: DX freq call comments]',
+                               dx1 => 'Frequency $_[0] not in band (see show/band); usage: DX [BY call] freq call comments',
+                               dx2 => 'Need a callsign; usage: DX [BY call] freq call comments',
                                dxs => 'DX Spots flag set on $_[0]',
                                dxu => 'DX Spots flag unset on $_[0]',
                                e1 => 'Invalid command',