Allow PC10s to be converted to PC93 and be processed
[spider.git] / perl / DXProtHandle.pm
index 5e3f0597d9405d2279ad1d7fab742a3da36b39ff..fed2cbeea1efad9eb25675aa209090fba341f19d 100644 (file)
@@ -106,8 +106,8 @@ sub handle_10
        RouteDB::update($_[6], $self->{call});
 #      RouteDB::update($to, $_[6]);
 
-       # convert this to a PC93 and process it as such
-       $self->normal(pc93($to, $from, $via, $_[3], $_[6]));
+       # convert this to a PC93, coming from mycall with origin set and process it as such
+       $main::me->normal(pc93($to, $from, $via, $_[3], $_[6]));
 }
 
 # DX Spot handling
@@ -1696,6 +1696,7 @@ sub handle_93
                return;
        }
 
+       # remember that we are converting PC10->PC93
        unless ($self->{do_pc9x}) {
                dbg("PCPROT: PC9x come in from non-PC9x node, ignored") if isdbg('chanerr');
                return;
@@ -1738,9 +1739,16 @@ sub handle_93
                my $dxchan;
                $dxchan = DXChannel::get($main::myalias) if $to eq $main::mycall;
                $dxchan = DXChannel::get($to) unless $dxchan;
-               if ($dxchan && $dxchan->is_user) {
-                       $dxchan->talk($from, $to, $via, $text, $onode);
-                       return;
+               # check it...
+               if ($dxchan) {
+                       if (ref $dxchan && $dxchan->isa('DXChannel')) {
+                               if ($dxchan->is_user) {
+                                       $dxchan->talk($from, $to, $via, $text, $onode);
+                                       return;
+                               }
+                       } else {
+                               dbg("ERROR: $to -> $dxchan is not a DXChannel! (local talk)");
+                       }
                }
 
                # convert to PC10 talks where appropriate
@@ -1748,14 +1756,17 @@ sub handle_93
                if ($ref) {
                        # just go for the "best" one for now (rather than broadcast)
                        $dxchan = $ref->dxchan;
-#                      my @dxchan = $ref->alldxchan;
-#                      for $dxchan (@dxchan) {
+
+                       # check it...
+                       if (ref $dxchan && $dxchan->isa('DXChannel')) {
                                if ($dxchan->{do_pc9x}) {
                                        $dxchan->send($line);
                                } else {
                                        $dxchan->talk($from, $to, $via, $text, $onode);
                                }
-#                      }
+                       } else {
+                               dbg("ERROR: $to -> $dxchan is not a DXChannel! (convert to pc10)");
+                       }
                        return;
                }