X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FIntMsg.pm;h=e3360fdbf566cf6990dda643c41a78953a3a65bd;hb=b50b7a1c99679f3624852f29068a6cde268e9560;hp=150ec91a2f0a860c9a63ad73a2f2a81c74d73a2e;hpb=04ff9a5a6bf8f3ab55bc2922b76a44e2798af8ee;p=spider.git diff --git a/perl/IntMsg.pm b/perl/IntMsg.pm index 150ec91a..e3360fdb 100644 --- a/perl/IntMsg.pm +++ b/perl/IntMsg.pm @@ -26,12 +26,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} =~ /\n/) { + my @lines = split /\r?\n/, $conn->{msg}; + if ($conn->{msg} =~ /\n$/) { + delete $conn->{msg}; + } else { + $conn->{msg} = pop @lines; + } + 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}; + } } } +