make Route::findroutes the basis of all routing
[spider.git] / perl / DXProtHandle.pm
index b5a8bcdcda89c0a085b9c21452cc012140f245d2..d55e15e362ecec7b5e83d8f5cac7ee563d548019 100644 (file)
@@ -598,24 +598,32 @@ sub handle_18
        my $parent = Route::Node::get($self->{call});
 
        # record the type and version offered
-       if ($_[1] =~ /DXSpider Version: (\d+\.\d+) Build: (\d+(?:\.\d+)?)/) {
-               $self->{version} = 53 + $1;
-               $self->user->version(53 + $1);
-               $parent->version(0 + $1);
-               $self->{build} = 0 + $2;
-               $self->user->build(0 + $2);
-               $parent->build(0 + $2);
+       if (my ($version) = $_[1] =~ /DXSpider Version: (\d+\.\d+)/) {
+               $self->{version} = 53 + $version;
+               $self->user->version(53 + $version);
+               $parent->version(0 + $version);
+               my ($build) = $_[1] =~ /Build: (\d+(?:\.\d+)?)/;
+               $self->{build} = 0 + $build;
+               $self->user->build(0 + $build);
+               $parent->build(0 + $build);
+               dbg("DXSpider version $version build $build");
                unless ($self->is_spider) {
+                       dbg("Change U " . $self->user->sort . " C $self->{sort} -> S");
                        $self->user->sort('S');
                        $self->user->put;
                        $self->sort('S');
                }
-               $self->{handle_xml}++ if DXXml::available() && $_[1] =~ /\bxml/;
+#              $self->{handle_xml}++ if DXXml::available() && $_[1] =~ /\bxml/;
                if ($_[1] =~ /\bpc9x/) {
-                       $self->{do_pc9x} = 1;
-                       dbg("Do px9x set on $self->{call}");
+                       if ($self->{isolate}) {
+                               dbg("pc9x recognised, but is isolated, using old protocol");
+                       } else {
+                               $self->{do_pc9x} = 1;
+                               dbg("Do px9x set on $self->{call}");
+                       }
                }
        } else {
+               dbg("Unknown software");
                $self->version(50.0);
                $self->version($_[2] / 100) if $_[2] && $_[2] =~ /^\d+$/;
                $self->user->version($self->version);
@@ -787,10 +795,8 @@ sub handle_20
        my $origin = shift;
 
        if ($self->{do_pc9x} && $self->{state} ne 'init92') {
-               dbg("PCPROT: disconnecting because login call not sent in any pc92") if isdbg('chanerr');
-               $self->send("**** You logged in with $self->{call} but that is NOT your \$mycall");
-               $self->disconnect;
-               return;
+               $self->send("Reseting to oldstyle routing because login call not sent in any pc92");
+               $self->{do_pc9x} = 0;
        }
        $self->send_local_config;
        $self->send(pc22());
@@ -878,10 +884,8 @@ sub handle_22
 
        if ($self->{do_pc9x}) {
                if ($self->{state} ne 'init92') {
-                       dbg("PCPROT: disconnecting because login call not sent in any pc92") if isdbg('chanerr');
-                       $self->send("**** You logged in with $self->{call} but that is NOT your \$mycall");
-                       $self->disconnect;
-                       return;
+                       $self->send("Reseting to oldstyle routing because login call not sent in any pc92");
+                       $self->{do_pc9x} = 0;
                }
        }
        $self->{lastping} = 0;
@@ -1740,14 +1744,16 @@ sub handle_93
                # convert to PC10 talks where appropriate
                my $ref = Route::get($to);
                if ($ref) {
-                       my @dxchan = $ref->alldxchan;
-                       for $dxchan (@dxchan) {
+                       # just go for the "best" one for now (rather than broadcast)
+                       $dxchan = $ref->dxchan;
+#                      my @dxchan = $ref->alldxchan;
+#                      for $dxchan (@dxchan) {
                                if ($dxchan->{do_pc9x}) {
                                        $dxchan->send($line);
                                } else {
                                        $dxchan->talk($from, $to, $via, $text, $onode);
                                }
-                       }
+#                      }
                        return;
                }