make isolation work in both directions again?
[spider.git] / perl / DXProt.pm
index 0f8aaebf78e65027d1ef634cf84ae9ad21116d5a..7359fdead0d7a85f2c6d51ff4ab36e2a0c147329 100644 (file)
@@ -406,7 +406,7 @@ sub normal
                        my $user = DXUser->get_current($spot[4]);
                        if ($user) {
                                my $qra = $user->qra;
-                               unless ($qra && DXBearing::is_qra($qra)) {
+                               unless ($qra && is_qra($qra)) {
                                        my $lat = $user->lat;
                                        my $long = $user->long;
                                        if (defined $lat && defined $long) {
@@ -884,14 +884,8 @@ sub normal
                        my $call = $field[1];
 
                        # input filter if required
-                       my $ref = Route::get($call) || Route->new($call);
-                       return unless $self->in_filter_route($ref);
-
-                       # dup check it
-                       if (eph_dup($line)) {
-                               dbg("PCPROT: ephemeral PC41 dup dropped") if isdbg('chanerr');
-                               return;
-                       }
+#                      my $ref = Route::get($call) || Route->new($call);
+#                      return unless $self->in_filter_route($ref);
 
                        # add this station to the user database, if required
                        my $user = DXUser->get_current($call);
@@ -902,12 +896,27 @@ sub normal
                        } elsif ($field[2] == 2) {
                                $user->qth($field[3]);
                        } elsif ($field[2] == 3) {
-                               my ($lat, $long) = DXBearing::stoll($field[3]);
-                               $user->lat($lat);
-                               $user->long($long);
-                               $user->qra(DXBearing::lltoqra($lat, $long)) unless $user->qra && DXBearing::is_qra($user->qra);
+                               if (is_latlong($field[3])) {
+                                       my ($lat, $long) = DXBearing::stoll($field[3]);
+                                       $user->lat($lat);
+                                       $user->long($long);
+                                       $user->qra(DXBearing::lltoqra($lat, $long));
+                               } else {
+                                       dbg('PCPROT: not a valid lat/long') if isdbg('chanerr');
+                                       return;
+                               }
                        } elsif ($field[2] == 4) {
                                $user->homenode($field[3]);
+                       } elsif ($field[2] == 5) {
+                               if (is_qra($field[3])) {
+                                       my ($lat, $long) = DXBearing::qratoll($field[3]);
+                                       $user->lat($lat);
+                                       $user->long($long);
+                                       $user->qra($field[3]);
+                               } else {
+                                       dbg('PCPROT: not a valid QRA locator') if isdbg('chanerr');
+                                       return;
+                               }
                        }
                        $user->lastoper($main::systime);   # to cut down on excessive for/opers being generated
                        $user->put;
@@ -1596,7 +1605,7 @@ sub process_rcmd_reply
                my $s = $rcmds{$fromnode};
                if ($s) {
                        my $dxchan = DXChannel->get($s->{call});
-                       my $ref = DXChannel->get($user) || $dxchan;
+                       my $ref = $user eq $tonode ? $dxchan : (DXChannel->get($user) || $dxchan);
                        $ref->send($line) if $ref;
                        delete $rcmds{$fromnode} if !$dxchan;
                } else {
@@ -1745,7 +1754,7 @@ sub send_route
                                $routeit = adjust_hops($self, $line);  # adjust its hop count by node name
                                next unless $routeit;
                        }
-                       $self->send($routeit) if $self->{routefilter} || !$self->{isolate};
+                       $self->send($routeit);
                }
        }
 }
@@ -1761,7 +1770,7 @@ sub broadcast_route
        foreach $dxchan (@dxchan) {
                next if $dxchan == $self;
                next if $dxchan == $me;
-               if ($dxchan->{routefilter} || !$self->{isolate}) {
+               if ($dxchan->{routefilter} || (!$self->{isolate} && !$dxchan->{isolate})) {
                        $dxchan->send_route($generate, @_) 
                } else {
                        dbg('DXPROT: isolated') if isdbg('chanerr');
@@ -1829,7 +1838,7 @@ sub eph_dup
        my $s = shift;
 
        # chop the end off
-       $s =~ s/\^H\d\d?\^?~?$//;
+       $s =~ s/\^H\d\d?\^?\~?$//;
        return 1 if exists $eph{$s};
        $eph{$s} = $main::systime;
        return undef;