X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FExtMsg.pm;h=b39637d10e2af6f243eb580a6cbd814041ff24a1;hb=e9ed4c81c3a4286ec5b32344a844a49ae18af8ba;hp=ee2ad231e40dfb8d3b935d62dfcc72fa197e348d;hpb=2a9a56c26e1ed0622dc9cd7fc48b0498b059e274;p=spider.git diff --git a/perl/ExtMsg.pm b/perl/ExtMsg.pm index ee2ad231..b39637d1 100644 --- a/perl/ExtMsg.pm +++ b/perl/ExtMsg.pm @@ -19,6 +19,7 @@ use DXUtil; use DXDebug; use IO::File; use IO::Socket; +use IPC::Open2; use vars qw(@ISA $deftimeout); @@ -58,6 +59,9 @@ sub dequeue my $conn = shift; my $msg; + if ($conn->{csort} eq 'ax25' && exists $conn->{msg}) { + $conn->{msg} =~ s/\cM/\cJ/g; + } if ($conn->{state} eq 'WC') { if (exists $conn->{cmd}) { if (@{$conn->{cmd}}) { @@ -193,7 +197,8 @@ sub _doconnect { my ($conn, $sort, $line) = @_; my $r; - + + $sort = lc $sort; dbg('connect', "CONNECT sort: $sort command: $line"); if ($sort eq 'telnet') { # this is a straight network connect @@ -206,7 +211,20 @@ sub _doconnect dbg('connect', "***Connect Failed to $host $port $!"); } } elsif ($sort eq 'ax25' || $sort eq 'prog') { - ; + $conn->{sock} = new IO::File; + if ($conn->{sock}) { + my $outfd = fileno($conn->{sock}); + my $out = new IO::File ">&$outfd"; + if ($conn->{pid} = open2($conn->{sock}, $out, $line)) { + $conn->{csort} = $sort; + $conn->{lineend} = "\cM" if $sort eq 'ax25'; + dbg('connect', "started $line"); + } else { + dbg('connect', "can't start $line $!"); + } + } else { + dbg('connect', "can't start $line $!"); + } } else { dbg('err', "invalid type of connection ($sort)"); $conn->disconnect; @@ -247,7 +265,7 @@ sub _dochat my $conn = shift; my $cmd = shift; my $line = shift; - + if ($line) { my ($expect, $send) = $cmd =~ /^\s*\'(.*)\'\s+\'(.*)\'/; if ($expect) { @@ -261,6 +279,7 @@ sub _dochat if ($line =~ /$expect/i) { dbg('connect', "got: \"$expect\" sending: \"$send\""); $conn->send_later($send); + delete $conn->{msg}; # get rid any input if a match return; } }