From 06963a9fca5e08982934c10946b8452f13feba2c Mon Sep 17 00:00:00 2001 From: minima Date: Wed, 14 Nov 2001 12:40:43 +0000 Subject: [PATCH] rearrange spot broadcast so that it copes according to terminal type --- Changes | 3 +++ cmd/dx.pl | 14 ++++++-------- perl/DXCommandmode.pm | 8 +++++++- perl/Spot.pm | 12 ------------ 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/Changes b/Changes index 9c42d466..bf7b49c8 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +14Nov01======================================================================= +1. make the number of characters of the dx comment dependant on the type of +connection. This should mean that 'legacy' user programs can cope. 07Nov01======================================================================= 1. fix is_pctext so that it actually catches corrupt spots and announces. 2. fix console.pl so that you can type in '0' again diff --git a/cmd/dx.pl b/cmd/dx.pl index 3876ff1f..a7dc99ad 100644 --- a/cmd/dx.pl +++ b/cmd/dx.pl @@ -52,7 +52,6 @@ if (is_freq($f[1]) && $f[0] =~ m{^[\w\d]+(?:/[\w\d]+){0,2}$}) { return (1, $self->msg('dx3')); } - # make line the rest of the line $line = $f[2] || " "; @f = split /\s+/, $line; @@ -97,14 +96,16 @@ push @out, $self->msg('dx1', $freq) unless $valid; # check we have a callsign :-) if ($spotted le ' ') { push @out, $self->msg('dx2'); - $valid = 0; } return (1, @out) unless $valid; - # Store it here (but only if it isn't baddx) +my $t = (int ($main::systime/60)) * 60; +return (1, $self->msg('dup')) if Spot::dup($freq, $spotted, $t, $line); +my @spot = Spot::prepare($freq, $spotted, $t, $line, $spotter, $main::mycall); + if ($DXProt::baddx->in($spotted) || $freq =~ /^69/ || $localonly) { # heaven forfend that we get a 69Mhz band :-) @@ -112,12 +113,9 @@ if ($DXProt::baddx->in($spotted) || $freq =~ /^69/ || $localonly) { $self->badcount(($self->badcount||0) + 1); } - my $buf = Spot::formatb($self->user->wantgrid, $freq, $spotted, $main::systime, $line, $spotter); - push @out, $buf; + $self->dx_spot(undef, undef, @spot); + return (1); } else { - my $t = (int ($main::systime/60)) * 60; - return (1, $self->msg('dup')) if Spot::dup($freq, $spotted, $t, $line); - my @spot = Spot::prepare($freq, $spotted, $t, $line, $spotter, $main::mycall); if (@spot) { # store it Spot::add(@spot); diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index c0388552..791256dc 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -786,7 +786,13 @@ sub dx_spot return unless $filter; } - my $buf = Spot::formatb($self->{user}->wantgrid, $_[0], $_[1], $_[2], $_[3], $_[4]); + + my $t = ztime($_[2]); + my $ref = DXUser->get_current($_[4]); + my $loc = $ref->qra if $ref && $ref->qra && $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]; $buf .= "\a\a" if $self->{beep}; $buf =~ s/\%5E/^/g; $self->local_send('X', $buf); diff --git a/perl/Spot.pm b/perl/Spot.pm index 963ed4a5..fb5683fb 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -264,18 +264,6 @@ sub ftor return $out; } -# format a spot for user output in 'broadcast' mode -sub formatb -{ - my $wantgrid = shift; - my $t = ztime($_[2]); - my $ref = DXUser->get_current($_[4]); - my $loc = $ref->qra if $ref && $ref->qra && $wantgrid; - $loc = ' ' . substr($ref->qra, 0, 4) if $loc; - $loc = "" unless $loc; - return sprintf "DX de %-7.7s%11.1f %-12.12s %-29s %s$loc", "$_[4]:", $_[0], $_[1], $_[3], $t ; -} - # format a spot for user output in list mode sub formatl { -- 2.43.0