fix last warning of this tranche.
authorDirk Koopman <djk@tobit.co.uk>
Thu, 6 Jan 2022 12:35:14 +0000 (12:35 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Thu, 6 Jan 2022 12:35:14 +0000 (12:35 +0000)
Be rigorous about what is in incoming PC92 K version and build fields.

Changes
perl/DXProtHandle.pm

diff --git a/Changes b/Changes
index dc40b96a9a1ad1b845fb0075a3258c8ee9e00a30..4e9f22d37e188d8d1ba4d1a1df2e14460e3829d8 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+06Jan22=======================================================================
+1. Fix the last of any frequent warnings caused by yesterday's modifications.
 05Jan22=======================================================================
 1. Mark nodes that send PC92 K records as spider. These will include VE7CC
    nodes. NOTE: there appear to be user records marked as user or other sorts
index 2055a2941d861f681b6e8a41df6a6f442f19c582..1ea3ebc97bd2cb1b3326eedc830ffe4ffdeb2737 100644 (file)
@@ -34,7 +34,7 @@ use Route::Node;
 use Script;
 
 use strict;
-use warnings;
+use warnings qw(all);
 
 use vars qw($pc11_max_age $pc23_max_age $last_pc50 $eph_restime $eph_info_restime $eph_pc34_restime
                        $last_hour $last10 %eph  %pings %rcmds $ann_to_talk
@@ -1558,17 +1558,20 @@ sub _decode_pc92_call
        my $is_extnode = $flag & 2;
        my $here = $flag & 1;
        my $ip;
-       $part[1] //= '';
-       $part[2] //= '';
-       $part[3] //= '';
-       if ($part[1] =~ /[,.]/) {
-               $ip = $part[1];
-               $part[1] = $part[2] = 0;
-       } elsif ($part[3] =~ /[,.]/) {
-               $ip = $part[3];
+       my $version = $part[1] || 0;
+       my $build = $part[2] || 0;
+       $build =~ s/\D+//g;
+       my $ip = $part[3] || '';
+       
+       if ($version =~ /[,.]/) {
+               $ip = $version;
+               $version = 0;
        }
+       $version =~ s/\D+//g;
+       $build =~ s/^0\.//;
+       $build =~ s/\D+//g;
        $ip =~ s/,/:/g if $ip;
-       return ($call, $is_node, $is_extnode, $here, $part[1], $part[2], $ip);
+       return ($call, $is_node, $is_extnode, $here, $version, $build, $ip);
 }
 
 # decode a pc92 call: flag call : version : build
@@ -1876,7 +1879,7 @@ sub pc92_handle_first_slot
        }
        $parent->here(Route::here($here));
        $parent->version($version || $pc19_version) if $version;
-       $build =~ s/^0\.//, $parent->build($build) if $build;
+    $parent->build($build) if $build;
        $parent->PC92C_dxchan($self->{call}, $hops) unless $self->{call} eq $parent->call;
        return ($parent, @radd);
 }
@@ -2000,13 +2003,11 @@ sub handle_92
                        my $call = $parent->call;
                        my $version = $ent[4] || 0;
                        my $build = $ent[5] ||  0;
-                       $build =~ s/^0\.//;
                        my $oldbuild = $parent->build || 0;
-                       $oldbuild =~ s/^0\.//;
                        my $oldversion = $parent->version || 0;
                        my $user = check_add_user($parent->call, 'S');
                        my $oldsort = $user->sort // '';
-                       if ($version =~ /^\d+$/) {
+#                      if ($version =~ /^\d+$/  && $oldversion =~ /^\d+$/) {
                                if ($oldsort ne 'S' || $oldversion != $version || $build != $oldbuild) {
                                        dbg("PCProt PC92 K node $call updated version: $version (was $oldversion) build: $build (was $oldbuild) sort: 'S' (was $oldsort)");
                                        $user->sort('S');
@@ -2014,7 +2015,9 @@ sub handle_92
                                        $user->build($parent->build($build));
                                        $user->put;
                                }
-                       }
+#                      } else {
+#                              dbg("DXProt PC92 K version strings new: '$version' old: '$oldversion'");
+#                      }
                        dbg("ROUTE: reset obscount on $parent->{call} now " . $parent->obscount) if isdbg('obscount');
                }
        } elsif ($sort eq 'A' || $sort eq 'D' || $sort eq 'C') {