fix always 'telnet' in a connect script with a client line
[spider.git] / perl / ExtMsg.pm
index e181722d1ba36d0d9f614bcdaa894ca017250ef6..49982a18c9aafd9e2f54588cb7aad99c1172b7ac 100644 (file)
@@ -70,7 +70,7 @@ sub dequeue
                        } 
                }
                if ($conn->{state} eq 'WC' && exists $conn->{cmd} && @{$conn->{cmd}} == 0) {
-                       $conn->to_connected($conn->{call}, 'O', $conn->{sort});
+                       $conn->to_connected($conn->{call}, 'O', $conn->{csort});
                }
        } elsif ($conn->{msg} =~ /\cJ/) {
                my @lines =  $conn->{msg} =~ /([^\cM\cJ]*)\cM?\cJ/g;
@@ -90,7 +90,7 @@ sub dequeue
                        } elsif ($conn->{state} eq 'WL' ) {
                                $msg = uc $msg;
                                if (is_callsign($msg)) {
-                                       $conn->to_connected($msg, 'A', 'telnet');
+                                       $conn->to_connected($msg, 'A', $conn->{csort});
                                } else {
                                        $conn->send_now("Sorry $msg is an invalid callsign");
                                        $conn->disconnect;
@@ -99,7 +99,7 @@ sub dequeue
                                if (exists $conn->{cmd} && @{$conn->{cmd}}) {
                                        $conn->_docmd($msg);
                                        if ($conn->{state} eq 'WC' && exists $conn->{cmd} &&  @{$conn->{cmd}} == 0) {
-                                               $conn->to_connected($conn->{call}, 'O', $conn->{sort});
+                                               $conn->to_connected($conn->{call}, 'O', $conn->{csort});
                                        }
                                }
                        }
@@ -211,6 +211,10 @@ sub _doconnect
                } else {
                        dbg('connect', "***Connect Failed to $host $port $!");
                }
+       } elsif ($sort eq 'agw') {
+               # turn it into an AGW object
+               bless $conn, 'AGWMsg';
+               $r = $conn->connect($line);
        } elsif ($sort eq 'ax25' || $sort eq 'prog') {
                local $^F = 10000;              # make sure it ain't closed on exec
                my ($a, $b) = IO::Socket->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
@@ -308,7 +312,7 @@ sub _dochat
                        }
                        if ($line =~ /\Q$expect/i) {
                                dbg('connect', "got: \"$expect\" sending: \"$send\"");
-                               $conn->send_later($send);
+                               $conn->send_later("D$conn->{call}|$send");
                                delete $conn->{msg}; # get rid any input if a match
                                return;
                        }
@@ -337,7 +341,7 @@ sub _doclient
        $conn->conns($call);
        $conn->{csort} = $f[1] if $f[1];
        $conn->{state} = 'C';
-       &{$conn->{rproc}}($conn, "O$call|telnet");
+       &{$conn->{rproc}}($conn, "O$call|$conn->{csort}");
        delete $conn->{cmd};
        $conn->{timeout}->del if $conn->{timeout};
 }