try fix node type changes from outside
[spider.git] / perl / DXProtHandle.pm
index 1114a1d0811834cb736605bb07f0409d9fa312b6..4e55b9402c534a512a530362d26f380c9c2218b8 100644 (file)
@@ -458,7 +458,7 @@ sub handle_16
 
        my $i;
        my @rout;
-       for ($i = 2; $i < $#_; $i++) {
+       for ($i = 2; $i < $#$pc; $i++) {
                my ($call, $conf, $here) = $pc->[$i] =~ /^(\S+) (\S) (\d)/o;
                next unless $call && $conf && defined $here && is_callsign($call);
                next if $call eq $main::mycall;
@@ -695,7 +695,7 @@ sub handle_19
        # From now on we are only going to believe PC92 data and locally connected
        # non-pc92 nodes.
        #
-       for ($i = 1; $i < $#_-1; $i += 4) {
+       for ($i = 1; $i < $#$pc-1; $i += 4) {
                my $here = $pc->[$i];
                my $call = uc $pc->[$i+1];
                my $conf = $pc->[$i+2];
@@ -1169,6 +1169,16 @@ sub handle_41
                return;
        }
 
+       if ($call eq $main::mycall && $call eq $main::myalias) {
+               dbg "DXPROT: PC41 trying to update $call from outside via $origin, ignored";
+               return;
+       }
+       my $chan = DXChannel::get($call);
+       if ($chan) {
+               dbg "DXPROT: PC41 trying to update online $call from outside via $origin, ignored";
+               return;
+       }
+
        # add this station to the user database, if required
        my $user = DXUser::get_current($call);
        $user = DXUser->new($call) unless $user;
@@ -1176,9 +1186,6 @@ sub handle_41
        if ($sort == 1) {
                if (($val =~ /spotter/i || $val =~ /self/i) && $user->name && $user->name ne $val) {
                        dbg("PCPROT: invalid name") if isdbg('chanerr');
-                       if ($main::mycall eq 'GB7DJK' || $main::mycall eq 'GB7BAA' || $main::mycall eq 'WR3D') {
-                               DXChannel::broadcast_nodes(pc41($pc->[1], 1, $user->name)); # send it to everyone including me
-                       }
                        return;
                }
                $user->name($val);
@@ -1810,7 +1817,7 @@ sub handle_92
                my $me = $pc->[4] || '';
                $me ||= _encode_pc92_call($parent) unless $me ;
 
-               my @ent = map {my @a = _decode_pc92_call($_); @a ? \@a : ()} grep {$_ && /^[0-7]/} $me, @$pc[5 .. $#_];
+               my @ent = map {my @a = _decode_pc92_call($_); @a ? \@a : ()} grep {$_ && /^[0-7]/} $me, @$pc[5 .. $#$pc];
 
                if (@ent) {