improve the pc24 fix
[spider.git] / perl / DXProt.pm
index e184685bd7341e2c0bf55c517073fd8e34c42f1a..52e7b3eda744774ad3e6f9ce673c4214d4e1faaa 100644 (file)
@@ -275,10 +275,8 @@ sub normal
        
 #      print join(',', @field), "\n";
                                                
-       # ignore any lines that don't start with PC
-       return if !$field[0] =~ /^PC/;
        
-       # process PC frames
+       # process PC frames, this will fail unless the frame starts PCnn
        my ($pcno) = $field[0] =~ /^PC(\d\d)/; # just get the number
        return unless $pcno;
        return if $pcno < 10 || $pcno > 99;
@@ -785,16 +783,23 @@ sub normal
                
                if ($pcno == 24) {              # set here status
                        my $call = uc $field[1];
-                       my $ref = Route::Node::get($call);
-                       $ref->here($field[2]) if $ref;
-                       $ref = Route::User::get($call);
-                       $ref->here($field[2]) if $ref;
-                       $ref ||= Route->new($call);
+                       my ($nref, $uref);
+                       $nref = Route::Node::get($call);
+                       $uref = Route::User::get($call);
+                       return unless $nref || $uref;   # if we don't know where they are, it's pointless sending it on
                        
-                       # input filter if required
-                       return unless $self->in_filter_route($ref);
-
-                       $self->route_pc24($ref, $field[3]) if $ref && !eph_dup($line);
+                       unless (eph_dup($line)) {
+                               if ($nref) {
+                                       $nref->here($field[2]);
+                                       return unless $self->in_filter_route($nref);
+                                       $self->route_pc24($nref, $field[3])
+                               }
+                               if ($uref) {
+                                       $uref->here($field[2]);
+                                       return unless $self->in_filter_route($uref);
+                                       $self->route_pc24($uref, $field[3]);
+                               }
+                       }
                        return;
                }
                
@@ -1449,7 +1454,7 @@ sub send_local_config
                # and are not themselves isolated, this to make sure that isolated nodes
         # don't appear outside of this node
                my @dxchan = grep { $_->call ne $main::mycall && $_->call ne $self->{call} } DXChannel::get_all_nodes();
-               @localnodes = map { Route::Node::get($_->{call}) or die "connot find node $_->{call}" } @dxchan if @dxchan;
+               @localnodes = map { my $r = Route::Node::get($_->{call}); $r ? $r : () } @dxchan if @dxchan;
                my @intcalls = map { $_->nodes } @localnodes if @localnodes;
                my $ref = Route::Node::get($self->{call});
                my @rnodes = $ref->nodes;
@@ -1488,7 +1493,7 @@ sub route
        # always send it down the local interface if available
        my $dxchan = DXChannel->get($call);
        unless ($dxchan) {
-               my $cl = Route::Node::get($call);
+               my $cl = Route::get($call);
                $dxchan = $cl->dxchan if $cl;
                if (ref $dxchan) {
                        if (ref $self && $dxchan eq $self) {