From 7a1ff7a9a2828f2fb9bcce8662fee706f7d96bfb Mon Sep 17 00:00:00 2001 From: minima Date: Sun, 23 Feb 2003 00:32:06 +0000 Subject: [PATCH] added US State information on DX Spots --- Changes | 6 +++++- cmd/Commands_en.hlp | 13 +++++++++++++ cmd/set/usstate.pl | 29 +++++++++++++++++++++++++++++ cmd/unset/usstate.pl | 29 +++++++++++++++++++++++++++++ perl/DXCommandmode.pm | 26 +++++++++++++++++++++++--- perl/DXUser.pm | 6 ++++++ perl/Messages | 2 ++ 7 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 cmd/set/usstate.pl create mode 100644 cmd/unset/usstate.pl diff --git a/Changes b/Changes index 036c1043..0e6b3a6d 100644 --- a/Changes +++ b/Changes @@ -2,7 +2,9 @@ 1. changed qrz.com address 2. added Charlie's [K1XX] new wpxloc.raw data stuff to get WA1, KC3 type callsigns to work better. -3. Merged in the new (faster) DXUser.pm. +3. added in set/usstate command which prints any US state information +available on both the spotted (LHS of time) and spotter (RHS of time). +4. Merged in the new (faster) DXUser.pm. [NOTE] this version will require Storable to be installed. On the other hand the code may work without, in a compatible way. This bit hasn't @@ -20,6 +22,8 @@ If it fails then you will need to edit your latest user_asc file on (or about) line 25 it says: $ref = decode($f[1]); you will need to change that to $ref = asc_decode($f[1]); and then do: perl user_asc +DO MAKE SURE THAT you include subdirectories in your CVS update + 21Feb03======================================================================= 1. moved the export of the users file to Wednesday night (GMT) to avoid possible crashes and/or delays during a contest weekend. diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 48ae9f78..fd2a17cb 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1668,6 +1668,19 @@ overwritten by any weekly updates that affect this callsign see also DELETE/USDB +=== 0^SET/DXSTATE^Allow US State info on the end of DX announcements +=== 0^UNSET/DXSTATE^Stop US State info on the end of DX announcements +If the spotter's or spotted's US State is known it is output on the +end of a DX announcement (there is just enough room). + +A spotter's state will appear on the RHS of the time (like +SET/DXGRID) and the spotted's State will appear on the LHS of the +time field. Any information found will override any locator +information from SET/DXGRID. + +Some user programs cannot cope with this. You can use this command +to reset (or set) this feature. + === 0^SET/WCY^Allow WCY messages to come out on your terminal === 0^UNSET/WCY^Stop WCY messages coming out on your terminal diff --git a/cmd/set/usstate.pl b/cmd/set/usstate.pl new file mode 100644 index 00000000..dd55cac2 --- /dev/null +++ b/cmd/set/usstate.pl @@ -0,0 +1,29 @@ +# +# set the usstate flag +# +# Copyright (c) 2000 - Dirk Koopman +# +# $Id$ +# + +my ($self, $line) = @_; +my @args = split /\s+/, $line; +my $call; +my @out; + +return (1, $self->msg('db3', 'FCC USDB')) unless $USDB::present; + +@args = $self->call if (!@args || $self->priv < 9); + +foreach $call (@args) { + $call = uc $call; + my $user = DXUser->get_current($call); + if ($user) { + $user->wantusstate(1); + $user->put; + push @out, $self->msg('usstates', $call); + } else { + push @out, $self->msg('e3', "Set US State", $call); + } +} +return (1, @out); diff --git a/cmd/unset/usstate.pl b/cmd/unset/usstate.pl new file mode 100644 index 00000000..3bfaf6dd --- /dev/null +++ b/cmd/unset/usstate.pl @@ -0,0 +1,29 @@ +# +# unset the usstate flag +# +# Copyright (c) 2003 - Dirk Koopman +# +# $Id$ +# + +my ($self, $line) = @_; +my @args = split /\s+/, $line; +my $call; +my @out; + +return (1, $self->msg('db3', 'FCC USDB')) unless $USDB::present; + +@args = $self->call if (!@args || $self->priv < 9); + +foreach $call (@args) { + $call = uc $call; + my $user = DXUser->get_current($call); + if ($user) { + $user->wantusstate(0); + $user->put; + push @out, $self->msg('usstateu', $call); + } else { + push @out, $self->msg('e3', "Unset US State", $call); + } +} +return (1, @out); diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 9e9a708e..731379df 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -814,11 +814,31 @@ sub dx_spot my $t = ztime($_[2]); + my $loc; + my $clth = $self->{consort} eq 'local' ? 29 : 30; + my $comment = substr $_[3], 0, $clth; + $comment .= ' ' x ($clth - length($comment)); my $ref = DXUser->get_current($_[4]); - my $loc = $ref->qra if $ref && $ref->qra && $self->{user}->wantgrid; - $loc = ' ' . substr($loc, 0, 4) if $loc; + if ($ref) { + $loc = $ref->qra || '' if $self->{user}->wantgrid; + $loc = ' ' . substr($loc, 0, 4) if $loc; + } $loc = "" unless $loc; - my $buf = sprintf "DX de %-7.7s%11.1f %-12.12s %-*s $t$loc", "$_[4]:", $_[0], $_[1], $self->{consort} eq 'local' ? 29 : 30, $_[3]; + + # USDB stuff + if ($USDB::present && $self->{user}->wantusstate) { + my ($city, $state) = USDB::get($_[4]); + if ($state) { + $loc = ' ' . $state; + } + ($city, $state) = USDB::get($_[1]); + if ($state) { + $comment = substr($comment, 0, $self->{consort} eq 'local' ? 26 : 27) . ' ' . $state; + } + } + + my $buf = sprintf "DX de %-7.7s%11.1f %-12.12s %-s $t$loc", "$_[4]:", $_[0], $_[1], $comment; + $buf .= "\a\a" if $self->{beep}; $buf =~ s/\%5E/^/g; $self->local_send('X', $buf); diff --git a/perl/DXUser.pm b/perl/DXUser.pm index f2abe804..0522cf2d 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -83,6 +83,7 @@ $v3 = 0; wantpc16 => '9,Want Users from node,yesno', wantsendpc16 => '9,Send PC16,yesno', wantroutepc19 => '9,Route PC19,yesno', + wantusstate => '9,Show US State,yesno', lastoper => '9,Last for/oper,cldatetime', nothere => '0,Not Here Text', registered => '9,Registered?,yesno', @@ -669,6 +670,11 @@ sub wantroutepc16 return _want('routepc16', @_); } +sub wantusstate +{ + return _want('usstate', @_); +} + sub wantlogininfo { my $self = shift; diff --git a/perl/Messages b/perl/Messages index e8abfae4..45f281b6 100644 --- a/perl/Messages +++ b/perl/Messages @@ -286,6 +286,8 @@ package DXM; unsethop1 => 'usage: unset/hops ann|spots|wwv|wcy', unsethop2 => 'hops unset on $_[1] for $_[0]', usernf => '*** User record for $_[0] not found ***', + usstates => 'US State display enabled for $_[0]', + usstateu => 'US State display disabled for $_[0]', wcy1 => '$_[0] is missing or out of range', wcy2 => 'Duplicate WCY', wcys => 'WCY enabled for $_[0]', -- 2.43.0