do some more rigorous checking of PC9x sentences
[spider.git] / perl / DXProt.pm
index 7ad886fd16bc9f1cc8462077395fb32ec49c14fc..e1bfd6ec6a59236e0c9218a463ccc2ba623d6073 100644 (file)
@@ -45,7 +45,7 @@ use vars qw($pc11_max_age $pc23_max_age $last_pc50 $eph_restime $eph_info_restim
                        $allowzero $decode_dk0wcy $send_opernam @checklist
                        $eph_pc15_restime $pc92_update_period $pc92_obs_timeout
                        %pc92_find $pc92_find_timeout $pc92_short_update_period
-                       $next_pc92_obs_timeout
+                       $next_pc92_obs_timeout $pc92_slug_changes $last_pc92_slug
                   );
 
 $pc11_max_age = 1*3600;                        # the maximum age for an incoming 'real-time' pc11
@@ -82,7 +82,6 @@ $pc92_obs_timeout = 60*60; # the time between obscount for incoming countdowns
 $next_pc92_obs_timeout = $main::systime + 60*60; # the time between obscount countdowns
 
 
-
 @checklist =
 (
  [ qw(i c c m bp bc c) ],                      # pc10
@@ -165,7 +164,10 @@ $next_pc92_obs_timeout = $main::systime + 60*60; # the time between obscount cou
  undef,
  undef,
  undef,
- [ qw(i c n) ],                                        # pc90
+ undef,                                                        # pc90
+ undef,
+ [ qw(i c f l)],                               # pc92
+ [ qw(i c f *m c *c m)],                                       # pc93
 );
 
 # use the entry in the check list to check the field list presented
@@ -182,7 +184,8 @@ sub check
        for ($i = 1; $i < @$ref; $i++) {
                my ($blank, $act) = $$ref[$i] =~ /^(b?)(\w)$/;
                return 0 unless $act;
-               next if $blank && $_[$i] =~ /^[ \*]$/;
+               next if $blank eq 'b' && $_[$i] =~ /^[ \*]$/;
+               next if $blank eq '*' && $_[$i] =~ /^\*$/;
                if ($act eq 'c') {
                        return $i unless is_callsign($_[$i]);
                } elsif ($act eq 'i') {
@@ -201,6 +204,8 @@ sub check
                        return $i unless $_[$i] =~ /^\s*\d+-\w\w\w-[12][90]\d\d$/;
                } elsif ($act eq 't') {
                        return $i unless $_[$i] =~ /^[012]\d[012345]\dZ$/;
+               } elsif ($act eq 'l') {
+                       return $i unless $_[$i] =~ /^[A-Z]$/;
                }
        }
        return 0;
@@ -484,6 +489,13 @@ sub process
                                }
                        }
                }
+
+               if ($pc92_slug_changes && $main::systime >= $last_pc92_slug + $pc92_slug_changes) {
+                       my ($add, $del) = gen_pc92_changes();
+                       $main::me->route_pc92d($main::mycall, undef, $main::routeroot, @$del) if @$del;
+                       $main::me->route_pc92a($main::mycall, undef, $main::routeroot, @$add) if @$add;
+                       clear_pc92_changes();
+               }
        }
 
        if ($main::systime - 3600 > $last_hour) {
@@ -866,6 +878,7 @@ sub gen_my_pc92_config
        my $node = shift;
 
        if ($node->{call} eq $main::mycall) {
+               clear_pc92_changes();           # remove any slugged data, we are generating it as now
                my @dxchan = grep { $_->call ne $main::mycall && !$_->{isolate} } DXChannel::get_all();
                dbg("ROUTE: all dxchan: " . join(',', map{$_->{call}} @dxchan)) if isdbg('routelow');
                my @localnodes = map { my $r = Route::get($_->{call}); $r ? $r : () } @dxchan;
@@ -1187,7 +1200,7 @@ sub disconnect
 
        # here we determine what needs to go out of the routing table
        my @rout;
-       if ($node) {
+       if ($node && $pc39flag != 2) {
                dbg('%Route::Node::List = ' . join(',', sort keys %Route::Node::list)) if isdbg('routedisc');
 
                @rout = $node->del($main::routeroot);