6 # Copyright (c) Dirk Koopman, G1TLH
17 use Time::HiRes qw(gettimeofday tv_interval);
20 use vars qw($VERSION $BRANCH @ISA %pings);
21 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
22 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
23 $main::build += $VERSION;
24 $main::branch += $BRANCH;
33 if ($self->{to} eq $main::mycall) {
36 my $cmd = $self->{content};
38 if ($self->{u} && $self->{u} eq $dxchan->call) { # online user or node
39 @in = (DXCommandmode::run_cmd($dxchan, $cmd));
42 my $ref = DXUser->get_current($self->{o});
43 my $cref = Route::Node::get($self->{o});
46 if ($cmd !~ /^\s*rcmd/i && $cref && $ref && $cref->call eq $ref->homenode) { # not allowed to relay RCMDS!
47 $self->{remotecmd} = 1; # for the benefit of any command that needs to know
48 my $oldpriv = $dxchan->{priv};
49 $dxchan->{priv} = $ref->{priv}; # assume the user's privilege level
50 @in = (DXCommandmode::run_cmd($dxchan, $cmd));
51 $dxchan->{priv} = $oldpriv;
52 delete $dxchan->{remotecmd};
57 Log('rcmd', 'in', $ref->{priv}, $self->{o}, "$self->{content}($answer)");
59 my $rep = DXXml::Text->new(u=>$self->{u}, to=>$self->{o}, content=>join('%0A', @in));
60 $rep->route($main::me); # because it's coming from me!
62 $self->route($dxchan);
70 my $ref = DXUser->get_current($self->{to});
73 if ($ref && $ref->is_clx && $self->{u}) {
74 $s = DXProt::pc84(($self->{o} || $main::mycall), $self->{to}, $self->{u}, $self->{content});
76 $s = DXProt::pc34(($self->{o} || $main::mycall), $self->{to}, $self->{content});
78 return $self->{'-pcxx'} = $s;