some detail changes in the send routines and spot formatting
authordjk <djk>
Sun, 4 Oct 1998 16:34:05 +0000 (16:34 +0000)
committerdjk <djk>
Sun, 4 Oct 1998 16:34:05 +0000 (16:34 +0000)
cmd/dx.pl
cmd/send.pl
cmd/show/dxcc.pl
perl/DXMsg.pm
perl/Spot.pm

index a966ff6b01ccd56c304ea6c24e5e5df0385bd72a..fdd07bf37c39da6b739cbf5faa8225638cefdcea 100644 (file)
--- 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);
index 8667d0cc35edf80ae0e21ea4a088e469c9c37bfc..a426228500975f3e777cd91f6ae267926dcacd61 100644 (file)
@@ -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;
index 615aac04569d22e14552d876fb0edb3f08955c82..3a2911c583e7bbd9a1904dba450e5cc6428e4269 100644 (file)
@@ -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);
index 9c032ba56f02caf41b682cd87731c6dcbd2c1c0b..e9097d9ca4f8fa159b2ecce5092e08689a8d8a3f 100644 (file)
@@ -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__
index fee069a2d7a9ea9867d32a20da6a9c39b1703bf9..d5b5adf93994ef4aa6f5fba77689268feff524c3 100644 (file)
@@ -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