]> dxcluster.net Git - spider.git/commitdiff
get the basic (r)cmd thing working.
authorminima <minima>
Mon, 23 Jan 2006 23:37:19 +0000 (23:37 +0000)
committerminima <minima>
Mon, 23 Jan 2006 23:37:19 +0000 (23:37 +0000)
perl/DXChannel.pm
perl/DXXml.pm
perl/DXXml/Cmd.pm
perl/DXXml/Text.pm

index adf7c358ddfec793cf90cedf136da8e799355e0e..b0208f103e0e6093df5b654c133420e110780419 100644 (file)
@@ -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)
index 2d83e16bb61e0d6f4a16c1f86b785b48c9be59cb..280d19ced31691e35612880b3b48ee086e297470 100644 (file)
@@ -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);
        }
 }
 
index e985b37d2d899856679a29152eff3ee03473433b..f56c270e80f478444c36957da15bbed5976b36f0 100644 (file)
@@ -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);
index a08cbda0ded9623ec17ac12095956f786a61e868..3496e0edad09355c7c382b7dc3fe0ff41d6b8464 100644 (file)
@@ -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");
                }
        }