X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FAGWMsg.pm;h=693f31085235cc6105301d403251e7fbceffe76f;hb=6a98ae5890ea507e2687fcb9e783c4a26127e557;hp=69c63c1ef702423bd4a1d2df1aca0f8443dad531;hpb=49a14209678e26e31b2a9c89aec330c1a7a87b80;p=spider.git diff --git a/perl/AGWMsg.pm b/perl/AGWMsg.pm index 69c63c1e..693f3108 100644 --- a/perl/AGWMsg.pm +++ b/perl/AGWMsg.pm @@ -46,7 +46,7 @@ $hpolltime = 300 unless defined $hpolltime; use vars qw($VERSION $BRANCH); $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); -$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0; +$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); $main::build += $VERSION; $main::branch += $BRANCH; @@ -266,7 +266,8 @@ sub _decode $data = '' unless defined $data; if ($sort eq 'D') { my $d = unpack "Z*", $data; - $d =~ s/\cM$//; + $d =~ s/\cM\cJ?$//; + $d =~ s/^\cJ//; dbg("AGW Data In port: $port pid: $pid '$from'->'$to' length: $len \"$d\"") if isdbg('agw'); my $conn = _find($from eq $main::mycall ? $to : $from); if ($conn) { @@ -281,13 +282,10 @@ sub _decode $conn->to_connected($conn->{call}, 'O', $conn->{csort}); } } else { - my @lines = split /\cM/, $data; - if (@lines) { - for (@lines) { - &{$conn->{rproc}}($conn, "I$conn->{call}|$_"); - } - } else { - &{$conn->{rproc}}($conn, "I$conn->{call}|"); + my @lines = split /\cM\cJ?/, $d; + push @lines, $d unless @lines; + for (@lines) { + &{$conn->{rproc}}($conn, "I$conn->{call}|$_"); } } } else { @@ -295,8 +293,9 @@ sub _decode } } elsif ($sort eq 'I' || $sort eq 'S' || $sort eq 'U' || $sort eq 'M' || $sort eq 'T') { my $d = unpack "Z*", $data; - $d =~ s/\cM$//; - my @lines = split /\cM/, $d; + $d =~ s/^\cJ//; + $d =~ s/\cM\cJ?$//; + my @lines = split /\cM\cJ?/, $d; for (@lines) { # s/([\x00-\x1f\x7f-\xff])/sprintf("%%%02X", ord($1))/eg; @@ -304,7 +303,7 @@ sub _decode } } elsif ($sort eq 'C') { my $d = unpack "Z*", $data; - $d =~ s/\cM$//; + $d =~ s/\cM\cJ?$//; dbg("AGW Connect port: $port pid: $pid '$from'->'$to' \"$d\"") if isdbg('agw'); my $call = $from eq $main::mycall ? $to : $from; my $conn = _find($call); @@ -339,7 +338,7 @@ sub _decode } } elsif ($sort eq 'd') { my $d = unpack "Z*", $data; - $d =~ s/\cM$//; + $d =~ s/\cM\cJ?$//; dbg("AGW '$from'->'$to' port: $port Disconnected ($d)") if isdbg('agw'); my $conn = _find($from eq $main::mycall ? $to : $from); if ($conn) { @@ -359,7 +358,7 @@ sub _decode } elsif ($sort eq 'H') { unless ($from =~ /^\s+$/) { my $d = unpack "Z*", $data; - $d =~ s/\cM$//; + $d =~ s/\cM\cJ?$//; dbg("AGW Heard port: $port \"$d\"") if isdbg('agw'); } } elsif ($sort eq 'X') {