X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FIntMsg.pm;h=4361b7b59c13a50c84e3e86e4cc561ae9aba719c;hb=cbb522ef802d48991734a4ce803fa6ffa9774588;hp=150ec91a2f0a860c9a63ad73a2f2a81c74d73a2e;hpb=04ff9a5a6bf8f3ab55bc2922b76a44e2798af8ee;p=spider.git diff --git a/perl/IntMsg.pm b/perl/IntMsg.pm index 150ec91a..4361b7b5 100644 --- a/perl/IntMsg.pm +++ b/perl/IntMsg.pm @@ -2,7 +2,7 @@ # This class is the internal subclass that deals with the internal port 27754 # communications for Msg.pm # -# $Id$ +# # # Copyright (c) 2001 - Dirk Koopman G1TLH # @@ -10,12 +10,18 @@ package IntMsg; use strict; + use Msg; use vars qw(@ISA); @ISA = qw(Msg); +sub login +{ + goto &main::login; # save some writing, this was the default +} + sub enqueue { my ($conn, $msg) = @_; @@ -26,12 +32,24 @@ 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; + } + $conn->{linesin} += @lines; + $Msg::total_lines_in += @lines; + for (@lines) { + if (defined $_) { + s/\%([0-9A-F][0-9A-F])/chr(hex($1))/eg; + } else { + $_ = ''; + } + &{$conn->{rproc}}($conn, $_) if exists $conn->{rproc}; + } } } +