3 # This module impliments the user facing command mode for a dx cluster
5 # Copyright (c) 1998 Dirk Koopman G1TLH
10 package DXCommandmode;
44 use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug
45 $maxbadcount $msgpolltime $default_pagelth $cmdimportdir);
47 %Cache = (); # cache of dynamically loaded routine's mod times
48 %cmd_cache = (); # cache of short names
49 $errstr = (); # error string from eval
50 %aliases = (); # aliases for (parts of) commands
51 $scriptbase = "$main::root/scripts"; # the place where all users start scripts go
52 $maxerrors = 20; # the maximum number of concurrent errors allowed before disconnection
53 $maxbadcount = 3; # no of bad words allowed before disconnection
54 $msgpolltime = 3600; # the time between polls for new messages
55 $default_pagelth = 20; # the default page length 0 = unlimited
56 $cmdimportdir = "$main::root/cmd_import"; # the base directory for importing command scripts
57 # this does not exist as default, you need to create it manually
61 use vars qw($VERSION $BRANCH);
63 main::mkver($VERSION = q$Revision$);
66 # obtain a new connection this is derived from dxchannel
71 my $self = DXChannel::alloc(@_);
73 # routing, this must go out here to prevent race condx
76 my @rout = $main::routeroot->add_user($call, 1);
79 my $ref = Route::User::get($call);
80 $main::me->route_pc16($main::mycall, undef, $main::routeroot, $ref) if $ref;
84 # this is how a a connection starts, you get a hello message and the motd with
85 # possibly some other messages asking you to set various things up if you are
86 # new (or nearly new and slacking) user.
90 my ($self, $line, $sort) = @_;
91 my $user = $self->{user};
92 my $call = $self->{call};
93 my $name = $user->{name};
96 my $host = $self->{conn}->{peerhost} || "unknown";
97 Log('DXCommand', "$call connected from $host");
99 $self->{name} = $name ? $name : $call;
100 $self->send($self->msg('l2',$self->{name}));
101 $self->state('prompt'); # a bit of room for further expansion, passwords etc
102 $self->{priv} = $user->priv || 0;
103 $self->{lang} = $user->lang || $main::lang || 'en';
104 my $pagelth = $user->pagelth;
105 $pagelth = $default_pagelth unless defined $pagelth;
106 $self->{pagelth} = $pagelth;
107 ($self->{width}) = $line =~ /width=(\d+)/; $line =~ s/\s*width=\d+\s*//;
108 $self->{width} = 80 unless $self->{width} && $self->{width} > 80;
109 $self->{consort} = $line; # save the connection type
111 # set some necessary flags on the user if they are connecting
112 $self->{beep} = $user->wantbeep;
113 $self->{ann} = $user->wantann;
114 $self->{wwv} = $user->wantwwv;
115 $self->{wcy} = $user->wantwcy;
116 $self->{talk} = $user->wanttalk;
117 $self->{wx} = $user->wantwx;
118 $self->{dx} = $user->wantdx;
119 $self->{logininfo} = $user->wantlogininfo;
120 $self->{ann_talk} = $user->wantann_talk;
122 $self->{prompt} = $user->prompt if $user->prompt;
124 # sort out new dx spot stuff
125 $user->wantdxcq(0) unless defined $user->{wantdxcq};
126 $user->wantdxitu(0) unless defined $user->{wantdxitu};
127 $user->wantusstate(0) unless defined $user->{wantusstate};
129 # sort out registration
130 if ($main::reqreg == 1) {
131 $self->{registered} = $user->registered;
132 } elsif ($main::reqreg == 2) {
133 $self->{registered} = !$user->registered;
135 $self->{registered} = 1;
139 # decide which motd to send
141 unless ($self->{registered}) {
142 $motd = "${main::motd}_nor_$self->{lang}";
143 $motd = "${main::motd}_nor" unless -e $motd;
145 $motd = "${main::motd}_$self->{lang}" unless $motd && -e $motd;
146 $motd = $main::motd unless $motd && -e $motd;
147 $self->send_file($motd) if -e $motd;
149 # sort out privilege reduction
150 $self->{priv} = 0 if $line =~ /^(ax|te)/ && !$self->conn->{usedpasswd};
153 $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'user_default', 0);
154 $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'user_default', 0);
155 $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'user_default', 0);
156 $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'user_default', 0) ;
158 # clean up qra locators
159 my $qra = $user->qra;
160 $qra = undef if ($qra && !DXBearing::is_qra($qra));
162 my $lat = $user->lat;
163 my $long = $user->long;
164 $user->qra(DXBearing::lltoqra($lat, $long)) if (defined $lat && defined $long);
168 my $echo = $user->wantecho;
170 $self->send_now('E', "0");
171 $self->send($self->msg('echow'));
172 $self->conn->echo($echo) if $self->conn->can('echo');
175 $self->tell_login('loginu');
177 # do we need to send a forward/opernam?
178 my $lastoper = $user->lastoper || 0;
179 my $homenode = $user->homenode || "";
180 if ($homenode eq $main::mycall && $main::systime >= $lastoper + $DXUser::lastoperinterval) {
181 run_cmd($main::me, "forward/opernam $call");
182 $user->lastoper($main::systime + ((int rand(10)) * 86400));
185 # ALWAYS output the user
186 my $thing = Thingy::Hello->new(user => $call, h => $self->{here});
187 $thing->broadcast($self);
188 $self->lasthello($main::systime);
190 # run a script send the output to the punter
191 my $script = new Script(lc $call) || new Script('user_default');
192 $script->run($self) if $script;
195 my $info = Route::cluster();
196 $self->send("Cluster:$info");
198 # send prompts and things
199 $self->send($self->msg('namee1')) if !$user->name;
200 $self->send($self->msg('qthe1')) if !$user->qth;
201 $self->send($self->msg('qll')) if !$user->qra || (!$user->lat && !$user->long);
202 $self->send($self->msg('hnodee1')) if !$user->qth;
203 $self->send($self->msg('m9')) if DXMsg::for_me($call);
204 $self->lastmsgpoll($main::systime);
209 # This is the normal command prompt driver
218 # save this for them's that need it
219 my $rawline = $cmdline;
221 # remove leading and trailing spaces
222 $cmdline =~ s/^\s*(.*)\s*$/$1/;
224 if ($self->{state} eq 'page') {
225 my $i = $self->{pagelth};
226 my $ref = $self->{pagedata};
229 # abort if we get a line starting in with a
230 if ($cmdline =~ /^a/io) {
235 # send a tranche of data
236 while ($i-- > 0 && @$ref) {
237 my $line = shift @$ref;
238 $line =~ s/\s+$//o; # why am having to do this?
242 # reset state if none or else chuck out an intermediate prompt
244 $tot -= $self->{pagelth};
245 $self->send($self->msg('page', $tot));
247 $self->state('prompt');
249 } elsif ($self->{state} eq 'sysop') {
250 my $passwd = $self->{user}->passwd;
252 my @pw = grep {$_ !~ /\s/} split //, $passwd;
253 my @l = @{$self->{passwd}};
254 my $str = "$pw[$l[0]].*$pw[$l[1]].*$pw[$l[2]].*$pw[$l[3]].*$pw[$l[4]]";
255 if ($cmdline =~ /$str/) {
256 $self->{priv} = $self->{user}->priv;
258 $self->send($self->msg('sorry'));
261 $self->send($self->msg('sorry'));
263 $self->state('prompt');
264 } elsif ($self->{state} eq 'passwd') {
265 my $passwd = $self->{user}->passwd;
266 if ($passwd && $cmdline eq $passwd) {
267 $self->send($self->msg('pw1'));
268 $self->state('passwd1');
270 $self->conn->{echo} = $self->conn->{decho};
271 delete $self->conn->{decho};
272 $self->send($self->msg('sorry'));
273 $self->state('prompt');
275 } elsif ($self->{state} eq 'passwd1') {
276 $self->{passwd} = $cmdline;
277 $self->send($self->msg('pw2'));
278 $self->state('passwd2');
279 } elsif ($self->{state} eq 'passwd2') {
280 if ($cmdline eq $self->{passwd}) {
281 $self->{user}->passwd($cmdline);
282 $self->send($self->msg('pw3'));
284 $self->send($self->msg('pw4'));
286 $self->conn->{echo} = $self->conn->{decho};
287 delete $self->conn->{decho};
288 $self->state('prompt');
289 } elsif ($self->{state} eq 'talk') {
290 if ($cmdline =~ m{^(?:/EX|/ABORT)}i) {
291 for (@{$self->{talklist}}) {
292 $self->send_talks($_, $self->msg('talkend'));
294 $self->state('prompt');
295 delete $self->{talklist};
296 } elsif ($cmdline =~ m|^/+\w+|) {
298 my $sendit = $cmdline =~ s|^/+||;
299 my @in = $self->run_cmd($cmdline);
300 $self->send_ans(@in);
301 if ($sendit && $self->{talklist} && @{$self->{talklist}}) {
302 foreach my $l (@in) {
304 if (@bad = BadWords::check($l)) {
305 $self->badcount(($self->badcount||0) + @bad);
306 Log('DXCommand', "$self->{call} swore: $l");
308 for (@{$self->{talklist}}) {
309 $self->send_talks($_, $l);
314 $self->send($self->talk_prompt);
315 } elsif ($self->{talklist} && @{$self->{talklist}}) {
316 # send what has been said to whoever is in this person's talk list
318 if (@bad = BadWords::check($cmdline)) {
319 $self->badcount(($self->badcount||0) + @bad);
320 Log('DXCommand', "$self->{call} swore: $cmdline");
322 for (@{$self->{talklist}}) {
323 $self->send_talks($_, $rawline);
326 $self->send($self->talk_prompt) if $self->{state} eq 'talk';
329 $self->state('prompt');
331 } elsif (my $func = $self->{func}) {
334 if (ref $self->{edit}) {
335 eval { @ans = $self->{edit}->$func($self, $rawline)};
337 eval { @ans = &{$self->{func}}($self, $rawline) };
340 $self->send_ans("Syserr: on stored func $self->{func}", $@);
341 delete $self->{func};
342 $self->state('prompt');
345 $self->send_ans(@ans);
347 $self->send_ans(run_cmd($self, $cmdline));
350 # check for excessive swearing
351 if ($self->{badcount} && $self->{badcount} >= $maxbadcount) {
352 Log('DXCommand', "$self->{call} logged out for excessive swearing");
357 # send a prompt only if we are in a prompt state
358 $self->prompt() if $self->{state} =~ /^prompt/o;
361 # send out the talk messages taking into account vias and connectivity
364 my ($self, $ent, $line) = @_;
366 my ($to, $via) = $ent =~ /(\S+)>(\S+)/;
367 $to = $ent unless $to;
368 my $call = $via ? $via : $to;
369 my $clref = Route::get($call);
370 my $dxchan = $clref->dxchan if $clref;
372 $dxchan->talk($self->{call}, $to, $via, $line);
374 $self->send($self->msg('disc2', $via ? $via : $to));
375 my @l = grep { $_ ne $ent } @{$self->{talklist}};
377 $self->{talklist} = \@l;
379 delete $self->{talklist};
380 $self->state('prompt');
389 for (@{$self->{talklist}}) {
390 my ($to, $via) = /(\S+)>(\S+)/;
394 return $self->msg('talkprompt', join(',', @call));
398 # send a load of stuff to a command user with page prompting
406 if ($self->{pagelth} && @_ > $self->{pagelth}) {
408 for ($i = $self->{pagelth}; $i-- > 0; ) {
410 $line =~ s/\s+$//o; # why am having to do this?
413 $self->{pagedata} = [ @_ ];
414 $self->state('page');
415 $self->send($self->msg('page', scalar @_));
427 # this is the thing that runs the command, it is done like this for the
428 # benefit of remote command execution
434 my $user = $self->{user};
435 my $call = $self->{call};
440 return () if length $cmdline == 0;
442 # split the command line up into parts, the first part is the command
443 my ($cmd, $args) = split /\s+/, $cmdline, 2;
444 $args = "" unless defined $args;
447 # strip out // and .. on command only
449 $cmd =~ s|^/||g; # no leading / either
450 $cmd =~ s|[^-?\w/]||g; # and no funny characters
454 dbg("cmd: $cmd") if isdbg('command');
456 # alias it if possible
457 my $acmd = CmdAlias::get_cmd($cmd);
459 ($cmd, $args) = split /\s+/, "$acmd $args", 2;
460 $args = "" unless defined $args;
461 dbg("aliased cmd: $cmd $args") if isdbg('command');
464 # first expand out the entry to a command
465 ($path, $fcmd) = search($main::localcmd, $cmd, "pl");
466 ($path, $fcmd) = search($main::cmd, $cmd, "pl") unless $path && $fcmd;
469 dbg("path: $cmd cmd: $fcmd") if isdbg('command');
471 my $package = find_cmd_name($path, $fcmd);
476 dbg("package: $package") if isdbg('command');
477 eval { @ans = &$package($self, $args) };
478 return (DXDebug::shortmess($@)) if $@;
481 dbg("cmd: $cmd not found") if isdbg('command');
482 if (++$self->{errors} > $maxerrors) {
483 $self->send($self->msg('e26'));
487 return ($self->msg('e1'));
494 delete $self->{errors};
496 if (++$self->{errors} > $maxerrors) {
497 $self->send($self->msg('e26'));
502 return map {s/([^\s])\s+$/$1/; $_} @ans;
506 # This is called from inside the main cluster processing loop and is used
507 # for despatching commands that are doing some long processing job
512 my @dxchan = DXChannel::get_all();
515 foreach $dxchan (@dxchan) {
516 next if $dxchan->sort ne 'U';
518 # send a outstanding message prompt if required
519 if ($t >= $dxchan->lastmsgpoll + $msgpolltime) {
520 $dxchan->send($dxchan->msg('m9')) if DXMsg::for_me($dxchan->call);
521 $dxchan->lastmsgpoll($t);
524 # send a prompt if no activity out on this channel
525 if ($t >= $dxchan->t + $main::user_interval) {
526 $dxchan->prompt() if $dxchan->{state} =~ /^prompt/o;
531 while (my ($k, $v) = each %nothereslug) {
532 if ($main::systime >= $v + 300) {
533 delete $nothereslug{$k};
541 # finish up a user context
546 my $call = $self->call;
548 return if $self->{disconnecting}++;
550 delete $self->{senddbg};
552 my $uref = Route::User::get($call);
555 @rout = $main::routeroot->del_user($uref);
556 dbg("B/C PC17 on $main::mycall for: $call") if isdbg('route');
558 # issue a pc17 to everybody interested
559 $main::me->route_pc17($main::mycall, undef, $main::routeroot, $uref);
561 my $thing = Thingy::Bye->new(user=>$call);
562 $thing->broadcast($self);
564 confess "trying to disconnect a non existant user $call";
567 # I was the last node visited
568 $self->user->node($main::mycall);
570 # send info to all logged in thingies
571 $self->tell_login('logoutu');
573 # remove any outstanding pings I have sent
574 Thingy::Ping::forget($call);
576 Log('DXCommand', "$call disconnected");
578 $self->SUPER::disconnect;
582 # short cut to output a prompt
588 my $call = $self->call;
589 my $date = cldate($main::systime);
590 my $time = ztime($main::systime);
591 my $prompt = $self->{prompt} || $self->msg('pr');
593 $call = "($call)" unless $self->here;
594 $prompt =~ s/\%C/$call/g;
595 $prompt =~ s/\%D/$date/g;
596 $prompt =~ s/\%T/$time/g;
597 $prompt =~ s/\%M/$main::mycall/g;
599 $self->send($prompt);
602 # broadcast a message to all users [except those mentioned after buffer]
605 my $pkg = shift; # ignored
606 my $s = shift; # the line to be rebroadcast
608 foreach my $dxchan (DXChannel::get_all()) {
609 next unless $dxchan->{sort} eq 'U'; # only interested in user channels
610 next if grep $dxchan == $_, @_;
611 $dxchan->send($s); # send it
615 # gimme all the users
618 return grep {$_->{sort} eq 'U'} DXChannel::get_all();
622 # search for the command in the cache of short->long form commands
627 my ($path, $short_cmd, $suffix) = @_;
630 # commands are lower case
631 $short_cmd = lc $short_cmd;
632 dbg("command: $path $short_cmd\n") if isdbg('command');
634 # do some checking for funny characters
635 return () if $short_cmd =~ /\/$/;
637 # return immediately if we have it
638 ($apath, $acmd) = split ',', $cmd_cache{$short_cmd} if $cmd_cache{$short_cmd};
639 if ($apath && $acmd) {
640 dbg("cached $short_cmd = ($apath, $acmd)\n") if isdbg('command');
641 return ($apath, $acmd);
645 my @parts = split '/', $short_cmd;
649 while (my $p = shift @parts) {
650 opendir(D, $curdir) or confess "can't open $curdir $!";
654 # if this isn't the last part
657 foreach my $l (sort @ls) {
659 if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
660 dbg("got dir: $curdir/$l\n") if isdbg('command');
667 # only proceed if we find the directory asked for
668 return () unless $found;
670 foreach my $l (sort @ls) {
672 next unless $l =~ /\.$suffix$/;
673 if ($p eq substr($l, 0, length $p)) {
674 $l =~ s/\.$suffix$//;
675 $dirfn = "" unless $dirfn;
676 $cmd_cache{$short_cmd} = join(',', ($path, "$dirfn$l")); # cache it
677 dbg("got path: $path cmd: $dirfn$l\n") if isdbg('command');
678 return ($path, "$dirfn$l");
686 # clear the command name cache
692 undef *{$_} unless /cmd_cache/;
693 dbg("Undefining cmd $_") if isdbg('command');
700 # the persistant execution of things from the command directories
703 # This allows perl programs to call functions dynamically
705 # This has been nicked directly from the perlembed pages
708 #require Devel::Symdump;
710 sub valid_package_name {
712 $string =~ s|([^A-Za-z0-9_/])|sprintf("_%2x",unpack("C",$1))|eg;
715 return "cmd_$string";
719 # this bit of magic finds a command in the offered directory
723 my $package = valid_package_name($cmdname);
724 my $filename = "$path/$cmdname.pl";
725 my $mtime = -M $filename;
727 # return if we can't find it
729 unless (defined $mtime) {
730 $errstr = DXM::msg('e1');
734 if(defined $Cache{$package}->{mtime} &&$Cache{$package}->{mtime} <= $mtime) {
735 #we have compiled this subroutine already,
736 #it has not been updated on disk, nothing left to do
737 #print STDERR "already compiled $package->handler\n";
741 my $sub = readfilestr($filename);
743 $errstr = "Syserr: can't open '$filename' $!";
747 #wrap the code into a subroutine inside our unique package
748 my $eval = qq( sub $package { $sub } );
751 my @list = split /\n/, $eval;
754 dbg($_ . "\n") if isdbg('eval');
758 # get rid of any existing sub and try to compile the new one
761 if (exists $Cache{$package}) {
762 dbg("Redefining $package") if isdbg('command');
765 dbg("Defining $package") if isdbg('command');
769 $Cache{$package} = {mtime => $mtime };
778 my ($self, $let, $buf) = @_;
779 if ($self->{state} eq 'prompt' || $self->{state} eq 'talk') {
780 if ($self->{enhanced}) {
781 $self->send_later($let, $buf);
790 # send a talk message here
793 my ($self, $from, $to, $via, $line) = @_;
794 $line =~ s/\\5E/\^/g;
795 $self->local_send('T', "$to de $from: $line") if $self->{talk};
796 Log('talk', $to, $from, $via?$via:$main::mycall, $line);
797 # send a 'not here' message if required
798 unless ($self->{here} && $from ne $to) {
799 my $key = "$to$from";
800 unless (exists $nothereslug{$key}) {
802 if (($ref = Route::get($from)) && ($dxchan = $ref->dxchan)) {
803 my $name = $self->user->name || $to;
804 my $s = $self->user->nothere || $dxchan->msg('nothere', $name);
805 $nothereslug{$key} = $main::systime;
806 $dxchan->talk($to, $from, undef, $s);
823 if (!$self->{ann_talk} && $to ne $self->{call}) {
824 my $call = AnnTalk::is_talk_candidate($_[0], $text);
828 if ($self->{annfilter}) {
829 ($filter, $hops) = $self->{annfilter}->it(@_ );
830 return unless $filter;
833 unless ($self->{ann}) {
834 return if $_[0] ne $main::myalias && $_[0] ne $main::mycall;
836 return if $target eq 'SYSOP' && $self->{priv} < 5;
837 my $buf = "$to$target de $_[0]: $text";
839 $buf .= "\a\a" if $self->{beep};
840 $self->local_send($target eq 'WX' ? 'W' : 'N', $buf);
854 return unless grep uc $_ eq $target, @{$self->{user}->{group}};
856 $text =~ s/^\#\d+ //;
857 my $buf = "$target de $_[0]: $text";
859 $buf .= "\a\a" if $self->{beep};
860 $self->local_send('C', $buf);
871 return unless $self->{wwv};
873 if ($self->{wwvfilter}) {
874 ($filter, $hops) = $self->{wwvfilter}->it(@_ );
875 return unless $filter;
878 my $buf = "WWV de $_[6] <$_[1]>: SFI=$_[2], A=$_[3], K=$_[4], $_[5]";
879 $buf .= "\a\a" if $self->{beep};
880 $self->local_send('V', $buf);
890 return unless $self->{wcy};
892 if ($self->{wcyfilter}) {
893 ($filter, $hops) = $self->{wcyfilter}->it(@_ );
894 return unless $filter;
897 my $buf = "WCY de $_[10] <$_[1]> : K=$_[4] expK=$_[5] A=$_[3] R=$_[6] SFI=$_[2] SA=$_[7] GMF=$_[8] Au=$_[9]";
898 $buf .= "\a\a" if $self->{beep};
899 $self->local_send('Y', $buf);
902 # broadcast debug stuff to all interested parties
905 my $s = shift; # the line to be rebroadcast
907 foreach my $dxchan (DXChannel::get_all) {
908 next unless $dxchan->{enhanced} && $dxchan->{senddbg};
909 $dxchan->send_later('L', $s);
919 if ($self->state eq 'enterbody') {
920 my $loc = $self->{loc} || confess "local var gone missing" ;
921 if ($line eq "\032" || $line eq '%1A' || uc $line eq "/EX") {
923 push @out, &{$loc->{endaction}}($self); # like this for < 5.8.0
925 $self->state('prompt');
926 } elsif ($line eq "\031" || uc $line eq "/ABORT" || uc $line eq "/QUIT") {
927 push @out, $self->msg('m10');
928 delete $loc->{lines};
931 $self->state('prompt');
933 push @{$loc->{lines}}, length($line) > 0 ? $line : " ";
934 # i.e. it ain't and end or abort, therefore store the line
937 confess "Invalid state $self->{state}";
942 sub store_startup_script
945 my $loc = $self->{loc} || confess "local var gone missing" ;
947 my $call = $loc->{call} || confess "callsign gone missing";
948 confess "lines array gone missing" unless ref $loc->{lines};
949 my $r = Script::store($call, $loc->{lines});
952 push @out, $self->msg('m19', $call, $r);
954 push @out, $self->msg('m20', $call);
957 push @out, "error opening startup script $call $!";
962 # Import any commands contained in any files in import_cmd directory
964 # If the filename has a recogisable callsign as some delimited part
965 # of it, then this is the user the command will be run as.
969 # are there any to do in this directory?
970 return unless -d $cmdimportdir;
971 unless (opendir(DIR, $cmdimportdir)) {
972 dbg("can\'t open $cmdimportdir $!");
973 Log('err', "can\'t open $cmdimportdir $!");
977 my @names = readdir(DIR);
980 foreach $name (@names) {
981 next if $name =~ /^\./;
983 my $s = Script->new($name, $cmdimportdir);
986 dbg("Run import cmd file $name");
987 Log('DXCommand', "Run import cmd file $name");
988 my @cat = split /[^A-Za-z0-9]+/, $name;
989 my ($call) = grep {is_callsign(uc $_)} @cat;
990 $call ||= $main::mycall;
995 $s->inscript(0); # switch off script checks
997 if ($call eq $main::mycall) {
998 @out = $s->run($main::me, 1);
1000 my $dxchan = DXChannel::get($call);
1002 @out = $s->run($dxchan, 1);
1004 my $u = DXUser->get($call);
1006 $dxchan = $main::me;
1007 my $old = $dxchan->{call};
1008 my $priv = $dxchan->{priv};
1009 my $user = $dxchan->{user};
1010 $dxchan->{call} = $call;
1011 $dxchan->{priv} = $u->priv;
1012 $dxchan->{user} = $u;
1013 @out = $s->run($dxchan, 1);
1014 $dxchan->{call} = $call;
1015 $dxchan->{priv} = $priv;
1016 $dxchan->{user} = $user;
1018 Log('err', "Trying to run import cmd for non-existant user $call");
1019 dbg( "Trying to run import cmd for non-existant user $call");
1025 Log('DXCommand', "Import cmd $name/$call: $_");
1026 dbg("Import cmd $name/$call: $_");
1029 Log("Failed to open $cmdimportdir/$name $!");
1030 dbg("Failed to open $cmdimportdir/$name $!");
1031 unlink "$cmdimportdir/$name";