X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FIntMsg.pm;h=a50d9a1e93c7830ae6f3b1174d410c16d30628d4;hb=b9dffeff7239952814342dad19db3a51def6fab7;hp=6e588b3ef7ddbb86c0165e229d37181c08179253;hpb=51ed97f9175c71dd611f8333adeee346760d6a98;p=spider.git diff --git a/perl/IntMsg.pm b/perl/IntMsg.pm index 6e588b3e..a50d9a1e 100644 --- a/perl/IntMsg.pm +++ b/perl/IntMsg.pm @@ -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) = @_; @@ -27,21 +33,20 @@ sub dequeue { my $conn = shift; - if ($conn->{msg} =~ /\n/) { - my @lines = split /\r?\n/, $conn->{msg}; - if ($conn->{msg} =~ /\n$/) { + if ($conn && $conn->{msg} =~ /\cJ/) { + my @lines = $conn->{msg} =~ /([^\cM\cJ]*)\cM?\cJ/g; + if ($conn->{msg} =~ /\cJ$/) { delete $conn->{msg}; } else { - $conn->{msg} = pop @lines; + $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, $_); + &{$conn->{rproc}}($conn, $_) if exists $conn->{rproc}; } } }