3 # pretend that you are another user, execute a command
4 # as that user, then send the output back to them.
6 # This is for educating users....
8 # Copyright (c) 2002 Dirk Koopman G1TLH
10 my ($self, $line) = @_;
12 my ($call, $newline) = split /\s+/, $line, 2;
14 my $dxchan = DXChannel->get($call);
15 my $mycall = $self->call;
17 return (1, $self->msg('e7', $call)) unless $dxchan;
18 return (1, $self->msg('e31', $call)) unless $dxchan->is_user;
19 if ($self->remotecmd) {
20 Log('DXCommand', "$mycall is trying to 'demo' to $call remotely");
21 return (1, $self->msg('e5'));
23 if ($self->priv < 9) {
24 Log('DXCommand', "$mycall is trying to 'demo' to $call locally");
25 return (1, $self->msg('e5'));
27 Log('DXCommand', "demo '$newline' to $call by $mycall");
28 my @in = $dxchan->run_cmd($newline);
30 $dxchan->send($newline, @in);
32 return (1, map { "->$call: $_" } @in);