Change DXUser->get* to DXUser::get*
[spider.git] / perl / DXXml / Cmd.pm
index 821606afb65df2272b1df5cb966b8212cf16abcb..5f89456838f439253d2554427edd40df3d88af68 100644 (file)
@@ -1,7 +1,7 @@
 #
 # XML (R)Cmd handler
 #
-# $Id$
+#
 #
 # Copyright (c) Dirk Koopman, G1TLH
 #
@@ -13,16 +13,10 @@ package DXXml::Cmd;
 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+)/ );
-$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
-$main::build += $VERSION;
-$main::branch += $BRANCH;
-
+use vars qw(@ISA);
 @ISA = qw(DXXml);
 
 sub handle_input
@@ -35,11 +29,11 @@ sub handle_input
                
                my $cmd = $self->{content};
                
-               if ($self->{o} eq $dxchan->call) {      # online user or node
+               if ($self->{u} && $self->{u} eq $dxchan->call) {        # online user or node
                        @in = (DXCommandmode::run_cmd($dxchan, $cmd));
                } else {
                        # remote command
-                       my $ref = DXUser->get_current($self->{o});
+                       my $ref = DXUser::get_current($self->{o});
                        my $cref = Route::Node::get($self->{o});
                        my $answer;
                        
@@ -56,8 +50,8 @@ 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));
-               $rep->route($dxchan);
+               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);
        }
@@ -67,7 +61,7 @@ sub topcxx
 {
        my $self = shift;
 
-       my $ref = DXUser->get_current($self->{to});
+       my $ref = DXUser::get_current($self->{to});
        my $s;
        
        if ($ref && $ref->is_clx && $self->{u}) {