From: minima Date: Mon, 23 Jan 2006 23:37:19 +0000 (+0000) Subject: get the basic (r)cmd thing working. X-Git-Tag: 1.54~132 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?p=spider.git;a=commitdiff_plain;h=b359511572b5dcd67dc17437e7ce4ca3574eada8 get the basic (r)cmd thing working. --- diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index adf7c358..b0208f10 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -396,15 +396,16 @@ sub send # this is always later and always data return unless $conn; my $call = $self->{call}; - for (@_) { -# chomp; - my @lines = split /\n/; - for (@lines) { - $conn->send_later("D$call|$_"); - dbg("-> D $call $_") if isdbg('chan'); + foreach my $l (@_) { + for (ref $l ? @$l : $l) { + my @lines = split /\n/; + for (@lines) { + $conn->send_later("D$call|$_"); + dbg("-> D $call $_") if isdbg('chan'); + } } } - $self->{t} = time; + $self->{t} = $main::systime; } # send a file (always later) diff --git a/perl/DXXml.pm b/perl/DXXml.pm index 2d83e16b..280d19ce 100644 --- a/perl/DXXml.pm +++ b/perl/DXXml.pm @@ -39,7 +39,7 @@ sub new { my $pkg = shift; my $class = ref $pkg || $pkg; - my $self = bless{@_}, $class; + my $self = bless{}, $class; while (@_) { my $key = shift; my $val = shift; @@ -271,22 +271,10 @@ sub route $dxchan->send($self->toxml); } elsif ($dxchan->is_node) { my $ref = $self->topcxx($dxchan); - if (ref $ref) { - for (@$ref) { - $dxchan->send($_); - } - } else { - $dxchan->send($ref); - } + $dxchan->send($ref); } else { my $ref = $self->tocmd($dxchan); - if (ref $ref) { - for (@$ref) { - $dxchan->send($_); - } - } else { - $dxchan->send($ref); - } + $dxchan->send($ref); } } diff --git a/perl/DXXml/Cmd.pm b/perl/DXXml/Cmd.pm index e985b37d..f56c270e 100644 --- a/perl/DXXml/Cmd.pm +++ b/perl/DXXml/Cmd.pm @@ -14,8 +14,8 @@ use DXDebug; use DXProt; use IsoTime; use Investigate; -use Time::HiRes qw(gettimeofday tv_interval); use DXXml::Text; +use DXLog; use vars qw($VERSION $BRANCH @ISA %pings); $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); @@ -56,7 +56,7 @@ sub handle_input } Log('rcmd', 'in', $ref->{priv}, $self->{o}, "$self->{content}($answer)"); } - my $rep = DXXml::Text->new(u=>$self->{u}, to=>$self->{o}, content=>join('%0A', @in)); + my $rep = DXXml::Text->new(u=>$self->{u}, to=>$self->{o}, content=>join('%0A', map {"$main::mycall:$_"} @in)); $rep->route($main::me); # because it's coming from me! } else { $self->route($dxchan); diff --git a/perl/DXXml/Text.pm b/perl/DXXml/Text.pm index a08cbda0..3496e0ed 100644 --- a/perl/DXXml/Text.pm +++ b/perl/DXXml/Text.pm @@ -12,9 +12,7 @@ package DXXml::Text; use DXDebug; use DXProt; -use IsoTime; -use Investigate; -use Time::HiRes qw(gettimeofday tv_interval); +use DXLog; use vars qw($VERSION $BRANCH @ISA %pings); $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); @@ -32,8 +30,7 @@ sub handle_input if ($self->{to} eq $main::mycall) { my $tochan = DXChannel::get($self->{u} || $main::myalias); if ($tochan) { - my $ref = $self->tocmd; - $tochan->send($_) for (ref $ref ? @$ref : $ref); + $tochan->send($self->tocmd); } else { dbg("no user or $main::myalias not online") if isdbg('chanerr'); } @@ -54,9 +51,9 @@ sub topcxx $line =~ s/\s*$//; Log('rcmd', 'out', $self->{to}, $line); if ($self->{u} && $dxchan->is_clx && $ref->is_clx) { - push @out, pc85($main::mycall, $self->{to}, $self->{u}, "$main::mycall:$line"); + push @out, DXProt::pc85($main::mycall, $self->{to}, $self->{u}, "$main::mycall:$line"); } else { - push @out, pc35($main::mycall, $self->{to}, "$main::mycall:$line"); + push @out, DXProt::pc35($main::mycall, $self->{to}, "$main::mycall:$line"); } }