From b5b58db69484da5554b4f7e10b813d13e8cf16cb Mon Sep 17 00:00:00 2001 From: djk Date: Sun, 4 Oct 1998 16:34:05 +0000 Subject: [PATCH] some detail changes in the send routines and spot formatting --- cmd/dx.pl | 24 ++++++++++++++++-------- cmd/send.pl | 4 +++- cmd/show/dxcc.pl | 6 ++---- perl/DXMsg.pm | 34 +++++++++++++++++++--------------- perl/Spot.pm | 2 +- 5 files changed, 41 insertions(+), 29 deletions(-) diff --git a/cmd/dx.pl b/cmd/dx.pl index a966ff6b..fdd07bf3 100644 --- a/cmd/dx.pl +++ b/cmd/dx.pl @@ -14,6 +14,7 @@ my $spotter = $self->call; my $spotted; my $freq; my @out; +my $valid = 0; # first lets see if we think we have a callsign as the first argument if ($f[0] =~ /[A-Za-z]/) { @@ -31,7 +32,6 @@ if ($f[0] =~ /[A-Za-z]/) { $freq = $freq * 1000 if $freq < 1800; # bash down the list of bands until a valid one is reached -my $valid = 0; my $bandref; my @bb; my $i; @@ -48,16 +48,24 @@ foreach $bandref (Bands::get_all()) { } push @out, "Frequency $freq not in band [usage: DX freq call comments]" if !$valid; -return (1, @out) if !$valid; -# send orf to the users -my $buf = sprintf "DX de %-7.7s %13.1f %-12.12s %-30.30s %5.5s\a\a", $spotter, $freq, $spotted, $line, ztime(time); -DXProt::broadcast_users($buf); +# check we have a callsign :-) +if ($spotted le ' ') { + push @out, "Need a callsign for the spot [usage: DX freq call comments]" ; + $valid = 0; +} + +return (1, @out) if !$valid; # Store it here -Spot::add($freq, $spotted, time, $line, $spotter); +if (Spot::add($freq, $spotted, $main::systime, $line, $spotter)) { + # send orf to the users + my $buf = Spot::formatb($freq, $spotted, $main::systime, $line, $spotter); + DXProt::broadcast_users($buf); -# send it orf to the cluster (hang onto your tin helmets)! -DXProt::broadcast_ak1a(DXProt::pc11($spotter, $freq, $spotted, $line)); + + # send it orf to the cluster (hang onto your tin helmets)! + DXProt::broadcast_ak1a(DXProt::pc11($spotter, $freq, $spotted, $line)); +} return (1, @out); diff --git a/cmd/send.pl b/cmd/send.pl index 8667d0cc..a4262285 100644 --- a/cmd/send.pl +++ b/cmd/send.pl @@ -52,7 +52,9 @@ if ($self->state eq "prompt") { $main::systime, '1', $newsubj, - $main::mycall, $rr); + $main::mycall, + '0', + $rr); my @list; my $from = $oref->from; my $to = $oref->to; diff --git a/cmd/show/dxcc.pl b/cmd/show/dxcc.pl index 615aac04..3a2911c5 100644 --- a/cmd/show/dxcc.pl +++ b/cmd/show/dxcc.pl @@ -90,12 +90,10 @@ if (@ans) { # we have a valid prefix! my @dx; foreach $ref (@res) { @dx = @$ref; - my $t = ztime($dx[2]); - my $d = cldate($dx[2]); - push @out, sprintf "%9s %-12s %s %s %-28s <%s>", $dx[0], $dx[1], $d, $t, $dx[3], $dx[4]; + push @out, Spot::formatl(@dx); } } else { - @out = DXM::msg('e4'); + @out = $self->msg('e4'); } return (1, @out); diff --git a/perl/DXMsg.pm b/perl/DXMsg.pm index 9c032ba5..e9097d9c 100644 --- a/perl/DXMsg.pm +++ b/perl/DXMsg.pm @@ -66,6 +66,7 @@ sub alloc $self->{subject} = shift; $self->{origin} = shift; $self->{read} = shift; + $self->{rrreq} = shift; $self->{gotit} = []; return $self; @@ -131,7 +132,7 @@ sub process $ref->{count} = 0; $ref->{linesreq} = 5; $work{"$f[2]$f[3]"} = $ref; # new ref - dbg('msg', "incoming subject ack stream $[3]\n"); + dbg('msg', "incoming subject ack stream $f[3]\n"); $busy{$f[2]} = $ref; # interlock $ref->{lines} = []; push @{$ref->{lines}}, ($ref->read_msg_body); @@ -591,18 +592,8 @@ sub field_prompt return $valid{$ele}; } -no strict; -sub AUTOLOAD -{ - my $self = shift; - my $name = $AUTOLOAD; - return if $name =~ /::DESTROY$/; - $name =~ s/.*:://o; - - confess "Non-existant field '$AUTOLOAD'" if !$valid{$name}; - @_ ? $self->{$name} = shift : $self->{$name} ; -} - +# +# send a message state machine sub do_send_stuff { my $self = shift; @@ -623,7 +614,7 @@ sub do_send_stuff my $loc = $self->{loc}; if ($line eq "\032" || uc $line eq "/EX") { my $to; - + if (@{$loc->{lines}} > 0) { foreach $to (@{$loc->{to}}) { my $ref; @@ -635,7 +626,8 @@ sub do_send_stuff $systime, $loc->{private}, $loc->{subject}, - $mycall, + $mycall, + '0', $loc->{rrreq}); $ref->store($loc->{lines}); $ref->add_dir(); @@ -666,6 +658,18 @@ sub do_send_stuff return (1, @out); } +no strict; +sub AUTOLOAD +{ + my $self = shift; + my $name = $AUTOLOAD; + return if $name =~ /::DESTROY$/; + $name =~ s/.*:://o; + + confess "Non-existant field '$AUTOLOAD'" if !$valid{$name}; + @_ ? $self->{$name} = shift : $self->{$name} ; +} + 1; __END__ diff --git a/perl/Spot.pm b/perl/Spot.pm index fee069a2..d5b5adf9 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -184,7 +184,7 @@ sub formatb { my @dx = @_; my $t = ztime($dx[2]); - return sprintf "DX de %-9.9s: %9.1f %-12s %-30s<%s>", $dx[4], $dx[0], $dx[1], $dx[3], $t ; + return sprintf "DX de %-7.7s: %13.1f %-12.12s %-30s<%s>", $dx[4], $dx[0], $dx[1], $dx[3], $t ; } # format a spot for user output in list mode -- 2.34.1