From 7ab17f423e9d5f27589cfe31ad962c4ea10e54f5 Mon Sep 17 00:00:00 2001 From: djk Date: Tue, 21 Sep 1999 13:05:58 +0000 Subject: [PATCH] new, more flexible, dx command --- cmd/Commands_en.hlp | 22 +++++++++++++++++++--- cmd/dx.pl | 39 ++++++++++++++++++++++++++------------- perl/Messages | 4 ++-- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 83d33ef8..58a68abe 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -95,9 +95,25 @@ Sysops can see all users' messages. === 8^DISCONNECT [ ...]^Disconnect a user or cluster Disconnect any connected locally -=== 0^DX ^Send a DX spot throughout the cluster - is compared against the available bands set up in the cluster. -see show/bands for more information. +=== 0^DX [BY ] ^Send a DX spot +This is how you send a DX Spot to other users. You can, in fact, now +enter the and the 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 is compared against the available bands set up in the +cluster. See SHOW/BANDS for more information. === 1^FORWARD/OPERNAME ^Send out information on this to all clusters This command sends out any information held in the user file which can diff --git a/cmd/dx.pl b/cmd/dx.pl index dd780699..0ebfb167 100644 --- 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 " and +# 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; diff --git a/perl/Messages b/perl/Messages index a9afbad2..ae63bd01 100644 --- a/perl/Messages +++ b/perl/Messages @@ -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', -- 2.34.1