3 # This module impliments the user facing command mode for a dx cluster
5 # Copyright (c) 1998 Dirk Koopman G1TLH
10 package DXCommandmode;
40 use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug $maxbadcount $msgpolltime);
42 %Cache = (); # cache of dynamically loaded routine's mod times
43 %cmd_cache = (); # cache of short names
44 $errstr = (); # error string from eval
45 %aliases = (); # aliases for (parts of) commands
46 $scriptbase = "$main::root/scripts"; # the place where all users start scripts go
47 $maxerrors = 20; # the maximum number of concurrent errors allowed before disconnection
48 $maxbadcount = 3; # no of bad words allowed before disconnection
49 $msgpolltime = 3600; # the time between polls for new messages
52 use vars qw($VERSION $BRANCH);
53 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
54 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
55 $main::build += $VERSION;
56 $main::branch += $BRANCH;
59 # obtain a new connection this is derived from dxchannel
64 my $self = DXChannel::alloc(@_);
66 # routing, this must go out here to prevent race condx
69 my @rout = $main::routeroot->add_user($call, Route::here(1));
71 # ALWAYS output the user
72 my $ref = Route::User::get($call);
73 $main::me->route_pc16($main::mycall, undef, $main::routeroot, $ref) if $ref;
78 # this is how a a connection starts, you get a hello message and the motd with
79 # possibly some other messages asking you to set various things up if you are
80 # new (or nearly new and slacking) user.
84 my ($self, $line, $sort) = @_;
85 my $user = $self->{user};
86 my $call = $self->{call};
87 my $name = $user->{name};
90 my $host = $self->{conn}->{peerhost} || "unknown";
91 Log('DXCommand', "$call connected from $host");
93 $self->{name} = $name ? $name : $call;
94 $self->send($self->msg('l2',$self->{name}));
95 $self->state('prompt'); # a bit of room for further expansion, passwords etc
96 $self->{priv} = $user->priv || 0;
97 $self->{lang} = $user->lang || $main::lang || 'en';
98 $self->{pagelth} = $user->pagelth || 20;
99 ($self->{width}) = $line =~ /width=(\d+)/; $line =~ s/\s*width=\d+\s*//;
100 $self->{width} = 80 unless $self->{width} && $self->{width} > 80;
101 $self->{consort} = $line; # save the connection type
103 # set some necessary flags on the user if they are connecting
104 $self->{beep} = $user->wantbeep;
105 $self->{ann} = $user->wantann;
106 $self->{wwv} = $user->wantwwv;
107 $self->{wcy} = $user->wantwcy;
108 $self->{talk} = $user->wanttalk;
109 $self->{wx} = $user->wantwx;
110 $self->{dx} = $user->wantdx;
111 $self->{logininfo} = $user->wantlogininfo;
112 $self->{ann_talk} = $user->wantann_talk;
114 $self->{prompt} = $user->prompt if $user->prompt;
116 # sort out new dx spot stuff
117 $user->wantdxcq(0) unless defined $user->{wantdxcq};
118 $user->wantdxitu(0) unless defined $user->{wantdxitu};
119 $user->wantusstate(0) unless defined $user->{wantusstate};
121 # sort out registration
122 if ($main::reqreg == 1) {
123 $self->{registered} = $user->registered;
124 } elsif ($main::reqreg == 2) {
125 $self->{registered} = !$user->registered;
127 $self->{registered} = 1;
131 # decide which motd to send
133 unless ($self->{registered}) {
134 $motd = "${main::motd}_nor_$self->{lang}";
135 $motd = "${main::motd}_nor" unless -e $motd;
137 $motd = "${main::motd}_$self->{lang}" unless $motd && -e $motd;
138 $motd = $main::motd unless $motd && -e $motd;
139 $self->send_file($motd) if -e $motd;
141 # sort out privilege reduction
142 $self->{priv} = 0 if $line =~ /^(ax|te)/ && !$self->conn->{usedpasswd};
145 $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'user_default', 0);
146 $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'user_default', 0);
147 $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'user_default', 0);
148 $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'user_default', 0) ;
150 # clean up qra locators
151 my $qra = $user->qra;
152 $qra = undef if ($qra && !DXBearing::is_qra($qra));
154 my $lat = $user->lat;
155 my $long = $user->long;
156 $user->qra(DXBearing::lltoqra($lat, $long)) if (defined $lat && defined $long);
160 my $echo = $user->wantecho;
162 $self->send_now('E', "0");
163 $self->send($self->msg('echow'));
164 $self->conn->echo($echo) if $self->conn->can('echo');
167 $self->tell_login('loginu');
169 # do we need to send a forward/opernam?
170 my $lastoper = $user->lastoper || 0;
171 my $homenode = $user->homenode || "";
172 if ($homenode eq $main::mycall && $main::systime >= $lastoper + $DXUser::lastoperinterval) {
173 run_cmd($main::me, "forward/opernam $call");
174 $user->lastoper($main::systime + ((int rand(10)) * 86400));
177 # run a script send the output to the punter
178 my $script = new Script(lc $call) || new Script('user_default');
179 $script->run($self) if $script;
182 my $info = Route::cluster();
183 $self->send("Cluster:$info");
185 # send prompts and things
186 $self->send($self->msg('namee1')) if !$user->name;
187 $self->send($self->msg('qthe1')) if !$user->qth;
188 $self->send($self->msg('qll')) if !$user->qra || (!$user->lat && !$user->long);
189 $self->send($self->msg('hnodee1')) if !$user->qth;
190 $self->send($self->msg('m9')) if DXMsg::for_me($call);
191 $self->lastmsgpoll($main::systime);
196 # This is the normal command prompt driver
205 # save this for them's that need it
206 my $rawline = $cmdline;
208 # remove leading and trailing spaces
209 $cmdline =~ s/^\s*(.*)\s*$/$1/;
211 if ($self->{state} eq 'page') {
212 my $i = $self->{pagelth};
213 my $ref = $self->{pagedata};
216 # abort if we get a line starting in with a
217 if ($cmdline =~ /^a/io) {
222 # send a tranche of data
223 while ($i-- > 0 && @$ref) {
224 my $line = shift @$ref;
225 $line =~ s/\s+$//o; # why am having to do this?
229 # reset state if none or else chuck out an intermediate prompt
231 $tot -= $self->{pagelth};
232 $self->send($self->msg('page', $tot));
234 $self->state('prompt');
236 } elsif ($self->{state} eq 'sysop') {
237 my $passwd = $self->{user}->passwd;
239 my @pw = grep {$_ !~ /\s/} split //, $passwd;
240 my @l = @{$self->{passwd}};
241 my $str = "$pw[$l[0]].*$pw[$l[1]].*$pw[$l[2]].*$pw[$l[3]].*$pw[$l[4]]";
242 if ($cmdline =~ /$str/) {
243 $self->{priv} = $self->{user}->priv;
245 $self->send($self->msg('sorry'));
248 $self->send($self->msg('sorry'));
250 $self->state('prompt');
251 } elsif ($self->{state} eq 'passwd') {
252 my $passwd = $self->{user}->passwd;
253 if ($passwd && $cmdline eq $passwd) {
254 $self->send($self->msg('pw1'));
255 $self->state('passwd1');
257 $self->conn->{echo} = $self->conn->{decho};
258 delete $self->conn->{decho};
259 $self->send($self->msg('sorry'));
260 $self->state('prompt');
262 } elsif ($self->{state} eq 'passwd1') {
263 $self->{passwd} = $cmdline;
264 $self->send($self->msg('pw2'));
265 $self->state('passwd2');
266 } elsif ($self->{state} eq 'passwd2') {
267 if ($cmdline eq $self->{passwd}) {
268 $self->{user}->passwd($cmdline);
269 $self->send($self->msg('pw3'));
271 $self->send($self->msg('pw4'));
273 $self->conn->{echo} = $self->conn->{decho};
274 delete $self->conn->{decho};
275 $self->state('prompt');
276 } elsif ($self->{state} eq 'talk') {
277 if ($cmdline =~ m{^(?:/EX|/ABORT)}i) {
278 for (@{$self->{talklist}}) {
279 $self->send_talks($_, $self->msg('talkend'));
281 $self->state('prompt');
282 delete $self->{talklist};
283 } elsif ($cmdline =~ m|^/+\w+|) {
285 my $sendit = $cmdline =~ s|^/+||;
286 my @in = $self->run_cmd($cmdline);
287 $self->send_ans(@in);
288 if ($sendit && $self->{talklist} && @{$self->{talklist}}) {
289 foreach my $l (@in) {
291 if (@bad = BadWords::check($l)) {
292 $self->badcount(($self->badcount||0) + @bad);
293 Log('DXCommand', "$self->{call} swore: $l");
295 for (@{$self->{talklist}}) {
296 $self->send_talks($_, $l);
301 $self->send($self->talk_prompt);
302 } elsif ($self->{talklist} && @{$self->{talklist}}) {
303 # send what has been said to whoever is in this person's talk list
305 if (@bad = BadWords::check($cmdline)) {
306 $self->badcount(($self->badcount||0) + @bad);
307 Log('DXCommand', "$self->{call} swore: $cmdline");
309 for (@{$self->{talklist}}) {
310 $self->send_talks($_, $rawline);
313 $self->send($self->talk_prompt) if $self->{state} eq 'talk';
316 $self->state('prompt');
318 } elsif (my $func = $self->{func}) {
321 if (ref $self->{edit}) {
322 eval { @ans = $self->{edit}->$func($self, $rawline)};
324 eval { @ans = &{$self->{func}}($self, $rawline) };
327 $self->send_ans("Syserr: on stored func $self->{func}", $@);
328 delete $self->{func};
329 $self->state('prompt');
332 $self->send_ans(@ans);
334 $self->send_ans(run_cmd($self, $cmdline));
337 # check for excessive swearing
338 if ($self->{badcount} && $self->{badcount} >= $maxbadcount) {
339 Log('DXCommand', "$self->{call} logged out for excessive swearing");
344 # send a prompt only if we are in a prompt state
345 $self->prompt() if $self->{state} =~ /^prompt/o;
348 # send out the talk messages taking into account vias and connectivity
351 my ($self, $ent, $line) = @_;
353 my ($to, $via) = $ent =~ /(\S+)>(\S+)/;
354 $to = $ent unless $to;
355 my $call = $via ? $via : $to;
356 my $clref = Route::get($call);
357 my $dxchan = $clref->dxchan if $clref;
359 $dxchan->talk($self->{call}, $to, $via, $line);
361 $self->send($self->msg('disc2', $via ? $via : $to));
362 my @l = grep { $_ ne $ent } @{$self->{talklist}};
364 $self->{talklist} = \@l;
366 delete $self->{talklist};
367 $self->state('prompt');
376 for (@{$self->{talklist}}) {
377 my ($to, $via) = /(\S+)>(\S+)/;
381 return $self->msg('talkprompt', join(',', @call));
385 # send a load of stuff to a command user with page prompting
393 if ($self->{pagelth} && @_ > $self->{pagelth}) {
395 for ($i = $self->{pagelth}; $i-- > 0; ) {
397 $line =~ s/\s+$//o; # why am having to do this?
400 $self->{pagedata} = [ @_ ];
401 $self->state('page');
402 $self->send($self->msg('page', scalar @_));
414 # this is the thing that runs the command, it is done like this for the
415 # benefit of remote command execution
421 my $user = $self->{user};
422 my $call = $self->{call};
427 return () if length $cmdline == 0;
429 # split the command line up into parts, the first part is the command
430 my ($cmd, $args) = split /\s+/, $cmdline, 2;
431 $args = "" unless defined $args;
434 # strip out // on command only
439 dbg("cmd: $cmd") if isdbg('command');
441 # alias it if possible
442 my $acmd = CmdAlias::get_cmd($cmd);
444 ($cmd, $args) = split /\s+/, "$acmd $args", 2;
445 $args = "" unless defined $args;
446 dbg("aliased cmd: $cmd $args") if isdbg('command');
449 # first expand out the entry to a command
450 ($path, $fcmd) = search($main::localcmd, $cmd, "pl");
451 ($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd;
454 dbg("path: $cmd cmd: $fcmd") if isdbg('command');
456 my $package = find_cmd_name($path, $fcmd);
461 dbg("package: $package") if isdbg('command');
462 eval { @ans = &$package($self, $args) };
463 return (DXDebug::shortmess($@)) if $@;
466 dbg("cmd: $cmd not found") if isdbg('command');
467 if (++$self->{errors} > $maxerrors) {
468 $self->send($self->msg('e26'));
472 return ($self->msg('e1'));
479 delete $self->{errors};
481 if (++$self->{errors} > $maxerrors) {
482 $self->send($self->msg('e26'));
487 return map {s/([^\s])\s+$/$1/; $_} @ans;
491 # This is called from inside the main cluster processing loop and is used
492 # for despatching commands that are doing some long processing job
497 my @dxchan = DXChannel->get_all();
500 foreach $dxchan (@dxchan) {
501 next if $dxchan->sort ne 'U';
503 # send a outstanding message prompt if required
504 if ($t >= $dxchan->lastmsgpoll + $msgpolltime) {
505 $dxchan->send($dxchan->msg('m9')) if DXMsg::for_me($dxchan->call);
506 $dxchan->lastmsgpoll($t);
509 # send a prompt if no activity out on this channel
510 if ($t >= $dxchan->t + $main::user_interval) {
511 $dxchan->prompt() if $dxchan->{state} =~ /^prompt/o;
516 while (my ($k, $v) = each %nothereslug) {
517 if ($main::systime >= $v + 300) {
518 delete $nothereslug{$k};
524 # finish up a user context
529 my $call = $self->call;
531 return if $self->{disconnecting}++;
533 delete $self->{senddbg};
535 my $uref = Route::User::get($call);
538 @rout = $main::routeroot->del_user($uref);
539 dbg("B/C PC17 on $main::mycall for: $call") if isdbg('route');
541 # issue a pc17 to everybody interested
542 $main::me->route_pc17($main::mycall, undef, $main::routeroot, $uref);
544 confess "trying to disconnect a non existant user $call";
547 # I was the last node visited
548 $self->user->node($main::mycall);
550 # send info to all logged in thingies
551 $self->tell_login('logoutu');
553 Log('DXCommand', "$call disconnected");
555 $self->SUPER::disconnect;
559 # short cut to output a prompt
565 my $call = $self->call;
566 my $date = cldate($main::systime);
567 my $time = ztime($main::systime);
568 my $prompt = $self->{prompt} || $self->msg('pr');
570 $call = "($call)" unless $self->here;
571 $prompt =~ s/\%C/$call/g;
572 $prompt =~ s/\%D/$date/g;
573 $prompt =~ s/\%T/$time/g;
574 $prompt =~ s/\%M/$main::mycall/g;
576 $self->send($prompt);
579 # broadcast a message to all users [except those mentioned after buffer]
582 my $pkg = shift; # ignored
583 my $s = shift; # the line to be rebroadcast
585 foreach my $dxchan (DXChannel->get_all()) {
586 next unless $dxchan->{sort} eq 'U'; # only interested in user channels
587 next if grep $dxchan == $_, @_;
588 $dxchan->send($s); # send it
592 # gimme all the users
595 return grep {$_->{sort} eq 'U'} DXChannel->get_all();
598 # run a script for this user
602 my $silent = shift || 0;
607 # search for the command in the cache of short->long form commands
612 my ($path, $short_cmd, $suffix) = @_;
615 # commands are lower case
616 $short_cmd = lc $short_cmd;
617 dbg("command: $path $short_cmd\n") if isdbg('command');
619 # do some checking for funny characters
620 return () if $short_cmd =~ /\/$/;
622 # return immediately if we have it
623 ($apath, $acmd) = split ',', $cmd_cache{$short_cmd} if $cmd_cache{$short_cmd};
624 if ($apath && $acmd) {
625 dbg("cached $short_cmd = ($apath, $acmd)\n") if isdbg('command');
626 return ($apath, $acmd);
630 my @parts = split '/', $short_cmd;
637 for ($i = 0; $i < @parts; $i++) {
639 opendir(D, $curdir) or confess "can't open $curdir $!";
643 foreach $l (sort @ls) {
645 if ($i < $#parts) { # we are dealing with directories
646 if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
647 dbg("got dir: $curdir/$l\n") if isdbg('command');
652 } else { # we are dealing with commands
653 @lparts = split /\./, $l;
654 next if $lparts[$#lparts] ne $suffix; # only look for .$suffix files
655 if ($p eq substr($l, 0, length $p)) {
656 pop @lparts; # remove the suffix
657 $l = join '.', @lparts;
658 # chop $dirfn; # remove trailing /
659 $dirfn = "" unless $dirfn;
660 $cmd_cache{$short_cmd} = join(',', ($path, "$dirfn$l")); # cache it
661 dbg("got path: $path cmd: $dirfn$l\n") if isdbg('command');
662 return ($path, "$dirfn$l");
670 # clear the command name cache
676 undef *{$_} unless /cmd_cache/;
677 dbg("Undefining cmd $_") if isdbg('command');
684 # the persistant execution of things from the command directories
687 # This allows perl programs to call functions dynamically
689 # This has been nicked directly from the perlembed pages
692 #require Devel::Symdump;
694 sub valid_package_name {
696 $string =~ s|([^A-Za-z0-9_/])|sprintf("_%2x",unpack("C",$1))|eg;
699 return "cmd_$string";
703 # this bit of magic finds a command in the offered directory
707 my $package = valid_package_name($cmdname);
708 my $filename = "$path/$cmdname.pl";
709 my $mtime = -M $filename;
711 # return if we can't find it
713 unless (defined $mtime) {
714 $errstr = DXM::msg('e1');
718 if(defined $Cache{$package}->{mtime} &&$Cache{$package}->{mtime} <= $mtime) {
719 #we have compiled this subroutine already,
720 #it has not been updated on disk, nothing left to do
721 #print STDERR "already compiled $package->handler\n";
725 my $sub = readfilestr($filename);
727 $errstr = "Syserr: can't open '$filename' $!";
731 #wrap the code into a subroutine inside our unique package
732 my $eval = qq( sub $package { $sub } );
735 my @list = split /\n/, $eval;
738 dbg($_ . "\n") if isdbg('eval');
742 # get rid of any existing sub and try to compile the new one
745 if (exists $Cache{$package}) {
746 dbg("Redefining $package") if isdbg('command');
749 dbg("Defining $package") if isdbg('command');
753 $Cache{$package} = {mtime => $mtime };
762 my ($self, $let, $buf) = @_;
763 if ($self->{state} eq 'prompt' || $self->{state} eq 'talk') {
764 if ($self->{enhanced}) {
765 $self->send_later($let, $buf);
774 # send a talk message here
777 my ($self, $from, $to, $via, $line) = @_;
778 $line =~ s/\\5E/\^/g;
779 $self->local_send('T', "$to de $from: $line") if $self->{talk};
780 Log('talk', $to, $from, $via?$via:$main::mycall, $line);
781 # send a 'not here' message if required
782 unless ($self->{here} && $from ne $to) {
783 my $key = "$to$from";
784 unless (exists $nothereslug{$key}) {
786 if (($ref = Route::get($from)) && ($dxchan = $ref->dxchan)) {
787 my $name = $self->user->name || $to;
788 my $s = $self->user->nothere || $dxchan->msg('nothere', $name);
789 $nothereslug{$key} = $main::systime;
790 $dxchan->talk($to, $from, undef, $s);
807 if (!$self->{ann_talk} && $to ne $self->{call}) {
808 my $call = AnnTalk::is_talk_candidate($_[0], $text);
812 if ($self->{annfilter}) {
813 ($filter, $hops) = $self->{annfilter}->it(@_ );
814 return unless $filter;
817 unless ($self->{ann}) {
818 return if $_[0] ne $main::myalias && $_[0] ne $main::mycall;
820 return if $target eq 'SYSOP' && $self->{priv} < 5;
821 my $buf = "$to$target de $_[0]: $text";
823 $buf .= "\a\a" if $self->{beep};
824 $self->local_send($target eq 'WX' ? 'W' : 'N', $buf);
838 return unless grep uc $_ eq $target, @{$self->{user}->{group}};
840 $text =~ s/^\#\d+ //;
841 my $buf = "$target de $_[0]: $text";
843 $buf .= "\a\a" if $self->{beep};
844 $self->local_send('C', $buf);
851 my $t = ztime($_[2]);
853 my $clth = $self->{consort} eq 'local' ? 29 : 30;
854 my $comment = substr $_[3], 0, $clth;
855 $comment .= ' ' x ($clth - length($comment));
856 if ($self->{user}->wantgrid) {
857 my $ref = DXUser->get_current($_[4]);
859 $loc = $ref->qra || '';
860 $loc = ' ' . substr($loc, 0, 4) if $loc;
864 if ($self->{user}->wantdxitu) {
865 $loc = ' ' . sprintf("%2d", $_[10]) if defined $_[10];
866 $comment = substr($comment, 0, $self->{consort} eq 'local' ? 26 : 27) . ' ' . sprintf("%2d", $_[8]) if defined $_[8];
867 } elsif ($self->{user}->wantdxcq) {
868 $loc = ' ' . sprintf("%2d", $_[11]) if defined $_[11];
869 $comment = substr($comment, 0, $self->{consort} eq 'local' ? 26 : 27) . ' ' . sprintf("%2d", $_[9]) if defined $_[9];
870 } elsif ($self->{user}->wantusstate) {
871 $loc = ' ' . $_[13] if $_[13];
872 $comment = substr($comment, 0, $self->{consort} eq 'local' ? 26 : 27) . ' ' . $_[12] if $_[12];
875 return sprintf "DX de %-7.7s%11.1f %-12.12s %-s $t$loc", "$_[4]:", $_[0], $_[1], $comment;
884 return unless $self->{dx};
888 if ($self->{spotsfilter}) {
889 ($filter, $hops) = $self->{spotsfilter}->it(@_ );
890 return unless $filter;
893 dbg('spot: "' . join('","', @_) . '"') if isdbg('dxspot');
896 if ($self->{ve7cc}) {
897 $buf = VE7CC::dx_spot($self, @_);
899 $buf = $self->format_dx_spot(@_);
900 $buf .= "\a\a" if $self->{beep};
904 $self->local_send('X', $buf);
914 return unless $self->{wwv};
916 if ($self->{wwvfilter}) {
917 ($filter, $hops) = $self->{wwvfilter}->it(@_ );
918 return unless $filter;
921 my $buf = "WWV de $_[6] <$_[1]>: SFI=$_[2], A=$_[3], K=$_[4], $_[5]";
922 $buf .= "\a\a" if $self->{beep};
923 $self->local_send('V', $buf);
933 return unless $self->{wcy};
935 if ($self->{wcyfilter}) {
936 ($filter, $hops) = $self->{wcyfilter}->it(@_ );
937 return unless $filter;
940 my $buf = "WCY de $_[10] <$_[1]> : K=$_[4] expK=$_[5] A=$_[3] R=$_[6] SFI=$_[2] SA=$_[7] GMF=$_[8] Au=$_[9]";
941 $buf .= "\a\a" if $self->{beep};
942 $self->local_send('Y', $buf);
945 # broadcast debug stuff to all interested parties
948 my $s = shift; # the line to be rebroadcast
950 foreach my $dxchan (DXChannel->get_all) {
951 next unless $dxchan->{enhanced} && $dxchan->{senddbg};
952 $dxchan->send_later('L', $s);
962 if ($self->state eq 'enterbody') {
963 my $loc = $self->{loc} || confess "local var gone missing" ;
964 if ($line eq "\032" || $line eq '%1A' || uc $line eq "/EX") {
966 push @out, &{$loc->{endaction}}($self); # like this for < 5.8.0
968 $self->state('prompt');
969 } elsif ($line eq "\031" || uc $line eq "/ABORT" || uc $line eq "/QUIT") {
970 push @out, $self->msg('m10');
971 delete $loc->{lines};
974 $self->state('prompt');
976 push @{$loc->{lines}}, length($line) > 0 ? $line : " ";
977 # i.e. it ain't and end or abort, therefore store the line
980 confess "Invalid state $self->{state}";
985 sub store_startup_script
988 my $loc = $self->{loc} || confess "local var gone missing" ;
990 my $call = $loc->{call} || confess "callsign gone missing";
991 confess "lines array gone missing" unless ref $loc->{lines};
992 my $r = Script::store($call, $loc->{lines});
995 push @out, $self->msg('m19', $call, $r);
997 push @out, $self->msg('m20', $call);
1000 push @out, "error opening startup script $call $!";