X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FIntMsg.pm;h=190d0b43c49b4bcaafb8c6d62511af31d30a2270;hb=1cc51a6696899a05d1b9ca40dab497cfdc39294b;hp=150ec91a2f0a860c9a63ad73a2f2a81c74d73a2e;hpb=04ff9a5a6bf8f3ab55bc2922b76a44e2798af8ee;p=spider.git diff --git a/perl/IntMsg.pm b/perl/IntMsg.pm index 150ec91a..190d0b43 100644 --- a/perl/IntMsg.pm +++ b/perl/IntMsg.pm @@ -10,6 +10,13 @@ package IntMsg; use strict; + +use vars qw($VERSION $BRANCH); +$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); +$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0; +$main::build += $VERSION; +$main::branch += $BRANCH; + use Msg; use vars qw(@ISA); @@ -26,12 +33,23 @@ sub enqueue sub dequeue { my $conn = shift; - my $msg; - - while ($msg = shift @{$conn->{inqueue}}){ - $msg =~ s/\%([2-9A-F][0-9A-F])/chr(hex($1))/eg; - $msg =~ s/[\x00-\x08\x0a-\x1f\x80-\x9f]/./g; # immutable CSI sequence + control characters - &{$conn->{rproc}}($conn, $msg, $!); - $! = 0; + + if ($conn && $conn->{msg} =~ /\cJ/) { + my @lines = $conn->{msg} =~ /([^\cM\cJ]*)\cM?\cJ/g; + if ($conn->{msg} =~ /\cJ$/) { + delete $conn->{msg}; + } else { + $conn->{msg} =~ s/([^\cM\cJ]*)\cM?\cJ//g; + } + for (@lines) { + if (defined $_) { + s/\%([0-9A-F][0-9A-F])/chr(hex($1))/eg; + s/[\x00-\x08\x0a-\x19\x1b-\x1f\x80-\x9f]/./g; # immutable CSI sequence + control characters + } else { + $_ = ''; + } + &{$conn->{rproc}}($conn, $_) if exists $conn->{rproc}; + } } } +