12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
# # This class is the internal subclass that deals with the internal port 27754 # communications for Msg.pm # # $Id: IntMsg.pm,v 1.9 2005/01/24 09:09:00 minima Exp $ # # Copyright (c) 2001 - Dirk Koopman G1TLH # package IntMsg; use strict; use vars qw($VERSION $BRANCH); $VERSION = sprintf( "%d.%03d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/ ); $BRANCH = sprintf( "%d.%03d", q$Revision: 1.9 $ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); $main::build += $VERSION; $main::branch += $BRANCH; 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) = @_; $msg =~ s/([\%\x00-\x1f\x7f-\xff])/sprintf("%%%02X", ord($1))/eg; push (@{$conn->{outqueue}}, $msg . "\n"); } sub dequeue { my $conn = shift; 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; } else { $_ = ''; } &{$conn->{rproc}}($conn, $_) if exists $conn->{rproc}; } } }
About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us
©2009 Koders is a trademark of Black Duck Software, Inc. Black Duck, Know Your Code and the Black Duck logo are registered trademarks of Black Duck Software, Inc. in the United States and other jurisdictions. All other trademarks are the property of their respective holders.