6258acb4a104b8186efd36935ed3de0cb390f7f2
[spider.git] / perl / DXCommandmode.pm
1 #!/usr/bin/perl
2 #
3 # This module impliments the user facing command mode for a dx cluster
4 #
5 # Copyright (c) 1998 Dirk Koopman G1TLH
6 #
7 # $Id$
8
9
10 package DXCommandmode;
11
12 use POSIX;
13
14 @ISA = qw(DXChannel);
15
16 use DXUtil;
17 use DXChannel;
18 use DXUser;
19 use DXVars;
20 use DXDebug;
21 use DXM;
22 use DXLog;
23 use DXLogPrint;
24 use DXBearing;
25 use CmdAlias;
26 use Filter;
27 use Minimuf;
28 use DXDb;
29 use AnnTalk;
30 use WCY;
31 use Sun;
32 use Internet;
33
34 use strict;
35 use vars qw(%Cache %cmd_cache $errstr %aliases $scriptbase $maxerrors %nothereslug);
36
37 %Cache = ();                                    # cache of dynamically loaded routine's mod times
38 %cmd_cache = ();                                # cache of short names
39 $errstr = ();                                   # error string from eval
40 %aliases = ();                                  # aliases for (parts of) commands
41 $scriptbase = "$main::root/scripts"; # the place where all users start scripts go
42 $maxerrors = 20;                                # the maximum number of concurrent errors allowed before disconnection
43
44 #
45 # obtain a new connection this is derived from dxchannel
46 #
47
48 sub new 
49 {
50         my $self = DXChannel::alloc(@_);
51
52         # routing, this must go out here to prevent race condx
53         my $pkg = shift;
54         my $call = shift;
55         my @rout = $main::routeroot->add_user($call, Route::here(1));
56         DXProt::route_pc16($DXProt::me, $main::routeroot, @rout) if @rout;
57
58         return $self;
59 }
60
61 # this is how a a connection starts, you get a hello message and the motd with
62 # possibly some other messages asking you to set various things up if you are
63 # new (or nearly new and slacking) user.
64
65 sub start
66
67         my ($self, $line, $sort) = @_;
68         my $user = $self->{user};
69         my $call = $self->{call};
70         my $name = $user->{name};
71         
72         $self->{name} = $name ? $name : $call;
73         $self->send($self->msg('l2',$self->{name}));
74         $self->send_file($main::motd) if (-e $main::motd);
75         $self->state('prompt');         # a bit of room for further expansion, passwords etc
76         $self->{priv} = $user->priv || 0;
77         $self->{lang} = $user->lang || $main::lang || 'en';
78         $self->{pagelth} = $user->pagelth || 20;
79         $self->{priv} = 0 if $line =~ /^(ax|te)/; # set the connection priv to 0 - can be upgraded later
80         $self->{consort} = $line;       # save the connection type
81         
82         # set some necessary flags on the user if they are connecting
83         $self->{beep} = $user->wantbeep;
84         $self->{ann} = $user->wantann;
85         $self->{wwv} = $user->wantwwv;
86         $self->{wcy} = $user->wantwcy;
87         $self->{talk} = $user->wanttalk;
88         $self->{wx} = $user->wantwx;
89         $self->{dx} = $user->wantdx;
90         $self->{logininfo} = $user->wantlogininfo;
91         $self->{here} = 1;
92
93         # get the filters
94         $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'user_default', 0);
95         $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'user_default', 0);
96         $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'user_default', 0);
97         $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'user_default', 0) ;
98
99         # clean up qra locators
100         my $qra = $user->qra;
101         $qra = undef if ($qra && !DXBearing::is_qra($qra));
102         unless ($qra) {
103                 my $lat = $user->lat;
104                 my $long = $user->long;
105                 $user->qra(DXBearing::lltoqra($lat, $long)) if (defined $lat && defined $long);  
106         }
107
108         Log('DXCommand', "$call connected");
109
110         # send prompts and things
111         my $info = Route::cluster();
112         $self->send("Cluster:$info");
113         $self->send($self->msg('namee1')) if !$user->name;
114         $self->send($self->msg('qthe1')) if !$user->qth;
115         $self->send($self->msg('qll')) if !$user->qra || (!$user->lat && !$user->long);
116         $self->send($self->msg('hnodee1')) if !$user->qth;
117         $self->send($self->msg('m9')) if DXMsg::for_me($call);
118         $self->prompt;
119
120         # decide on echo
121         if (!$user->wantecho) {
122                 $self->send_now('E', "0");
123                 $self->send($self->msg('echow'));
124         }
125         
126         $self->tell_login('loginu');
127         
128         # do we need to send a forward/opernam?
129         my $lastoper = $user->lastoper || 0;
130         my $homenode = $user->homenode || ""; 
131         if ($homenode eq $main::mycall && $lastoper + $DXUser::lastoperinterval < $main::systime) {
132                 run_cmd($DXProt::me, "forward/opernam $call");
133                 $user->lastoper($main::systime);
134         }
135 }
136
137 #
138 # This is the normal command prompt driver
139 #
140
141 sub normal
142 {
143         my $self = shift;
144         my $cmdline = shift;
145         my @ans;
146         
147         # remove leading and trailing spaces
148         $cmdline =~ s/^\s*(.*)\s*$/$1/;
149         
150         if ($self->{state} eq 'page') {
151                 my $i = $self->{pagelth};
152                 my $ref = $self->{pagedata};
153                 my $tot = @$ref;
154                 
155                 # abort if we get a line starting in with a
156                 if ($cmdline =~ /^a/io) {
157                         undef $ref;
158                         $i = 0;
159                 }
160         
161                 # send a tranche of data
162                 while ($i-- > 0 && @$ref) {
163                         my $line = shift @$ref;
164                         $line =~ s/\s+$//o;     # why am having to do this? 
165                         $self->send($line);
166                 }
167                 
168                 # reset state if none or else chuck out an intermediate prompt
169                 if ($ref && @$ref) {
170                         $tot -= $self->{pagelth};
171                         $self->send($self->msg('page', $tot));
172                 } else {
173                         $self->state('prompt');
174                 }
175         } elsif ($self->{state} eq 'sysop') {
176                 my $passwd = $self->{user}->passwd;
177                 my @pw = split / */, $passwd;
178                 if ($passwd) {
179                         my @l = @{$self->{passwd}};
180                         my $str = "$pw[$l[0]].*$pw[$l[1]].*$pw[$l[2]].*$pw[$l[3]].*$pw[$l[4]]";
181                         if ($cmdline =~ /$str/) {
182                                 $self->{priv} = $self->{user}->priv;
183                         } else {
184                                 $self->send($self->msg('sorry'));
185                         }
186                 } else {
187                         $self->send($self->msg('sorry'));
188                 }
189                 delete $self->{passwd};
190                 $self->state('prompt');
191         } elsif ($self->{state} eq 'talk') {
192                 if ($cmdline =~ m{^(?:/EX|/ABORT)}i) {
193                         for (@{$self->{talklist}}) {
194                                 $self->send_talks($_,  $self->msg('talkend'));
195                         }
196                         $self->state('prompt');
197                         delete $self->{talklist};
198                 } elsif ($cmdline =~ m(^/\w+)) {
199                         $cmdline =~ s(^/)();
200                         $self->send_ans(run_cmd($self, $cmdline));
201                         $self->send($self->talk_prompt);
202                 } elsif ($self->{talklist} && @{$self->{talklist}}) {
203                         # send what has been said to whoever is in this person's talk list
204                         for (@{$self->{talklist}}) {
205                                 $self->send_talks($_, $cmdline);
206                         }
207                         $self->send($self->talk_prompt) if $self->{state} eq 'talk';
208                 } else {
209                         # for safety
210                         $self->state('prompt');
211                 }
212         } else {
213                 $self->send_ans(run_cmd($self, $cmdline));
214         } 
215         
216         # send a prompt only if we are in a prompt state
217         $self->prompt() if $self->{state} =~ /^prompt/o;
218 }
219
220 # send out the talk messages taking into account vias and connectivity
221 sub send_talks
222 {
223         my ($self, $ent, $line) = @_;
224         
225         my ($to, $via) = $ent =~ /(\S+)>(\S+)/;
226         $to = $ent unless $to;
227         my $call = $via ? $via : $to;
228         my $clref = Route::get($call);
229         my $dxchan = $clref->dxchan if $clref;
230         if ($dxchan) {
231                 $dxchan->talk($self->{call}, $to, $via, $line);
232         } else {
233                 $self->send($self->msg('disc2', $via ? $via : $to));
234                 my @l = grep { $_ ne $ent } @{$self->{talklist}};
235                 if (@l) {
236                         $self->{talklist} = \@l;
237                 } else {
238                         delete $self->{talklist};
239                         $self->state('prompt');
240                 }
241         }
242 }
243
244 sub talk_prompt
245 {
246         my $self = shift;
247         my @call;
248         for (@{$self->{talklist}}) {
249                 my ($to, $via) = /(\S+)>(\S+)/;
250                 $to = $_ unless $to;
251                 push @call, $to;
252         }
253         return $self->msg('talkprompt', join(',', @call));
254 }
255
256 #
257 # send a load of stuff to a command user with page prompting
258 # and stuff
259 #
260
261 sub send_ans
262 {
263         my $self = shift;
264         
265         if ($self->{pagelth} && @_ > $self->{pagelth}) {
266                 my $i;
267                 for ($i = $self->{pagelth}; $i-- > 0; ) {
268                         my $line = shift @_;
269                         $line =~ s/\s+$//o;     # why am having to do this? 
270                         $self->send($line);
271                 }
272                 $self->{pagedata} =  [ @_ ];
273                 $self->state('page');
274                 $self->send($self->msg('page', scalar @_));
275         } else {
276                 for (@_) {
277                         if (defined $_) {
278                                 $self->send($_);
279                         } else {
280                                 $self->send('');
281                         }
282                 }
283         } 
284 }
285
286 # this is the thing that runs the command, it is done like this for the 
287 # benefit of remote command execution
288 #
289
290 sub run_cmd
291 {
292         my $self = shift;
293         my $user = $self->{user};
294         my $call = $self->{call};
295         my $cmdline = shift;
296         my @ans;
297         
298         if ($self->{func}) {
299                 my $c = qq{ \@ans = $self->{func}(\$self, \$cmdline) };
300                 dbg("stored func cmd = $c\n") if isdbg('eval');
301                 eval  $c;
302                 if ($@) {
303                         return ("Syserr: Eval err $errstr on stored func $self->{func}", $@);
304                 }
305         } else {
306
307                 return () if length $cmdline == 0;
308                 
309                 # strip out //
310                 $cmdline =~ s|//|/|og;
311                 
312                 # split the command line up into parts, the first part is the command
313                 my ($cmd, $args) = split /\s+/, $cmdline, 2;
314                 $args = "" unless defined $args;
315                 
316                 if ($cmd) {
317                         
318                         my ($path, $fcmd);
319                         
320                         dbg("cmd: $cmd") if isdbg('command');
321                         
322                         # alias it if possible
323                         my $acmd = CmdAlias::get_cmd($cmd);
324                         if ($acmd) {
325                                 ($cmd, $args) = split /\s+/, "$acmd $args", 2;
326                                 $args = "" unless defined $args;
327                                 dbg("aliased cmd: $cmd $args") if isdbg('command');
328                         }
329                         
330                         # first expand out the entry to a command
331                         ($path, $fcmd) = search($main::localcmd, $cmd, "pl");
332                         ($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd;
333
334                         if ($path && $cmd) {
335                                 dbg("path: $cmd cmd: $fcmd") if isdbg('command');
336                         
337                                 my $package = find_cmd_name($path, $fcmd);
338                                 @ans = (0) if !$package ;
339                                 
340                                 if ($package) {
341                                         dbg("package: $package") if isdbg('command');
342                                         my $c;
343                                         unless (exists $Cache{$package}->{'sub'}) {
344                                                 $c = eval $Cache{$package}->{'eval'};
345                                                 if ($@) {
346                                                         return DXDebug::shortmess($@);
347                                                 }
348                                                 $Cache{$package}->{'sub'} = $c;
349                                         }
350                                         $c = $Cache{$package}->{'sub'};
351                                         eval {
352                                                 @ans = &{$c}($self, $args);
353                                     };
354                                         
355                                         if ($@) {
356                                                 #cluck($@);
357                                                 return (DXDebug::shortmess($@));
358                                         };
359                                 }
360                         } else {
361                                 dbg("cmd: $cmd not found") if isdbg('command');
362                                 if (++$self->{errors} > $maxerrors) {
363                                         $self->send($self->msg('e26'));
364                                         $self->disconnect;
365                                         return ();
366                                 } else {
367                                         return ($self->msg('e1'));
368                                 }
369                         }
370                 }
371         }
372         
373         my $ok = shift @ans;
374         if ($ok) {
375                 delete $self->{errors};
376         } else {
377                 if (++$self->{errors} > $maxerrors) {
378                         $self->send($self->msg('e26'));
379                         $self->disconnect;
380                         return ();
381                 }
382         }
383         return (@ans);
384 }
385
386 #
387 # This is called from inside the main cluster processing loop and is used
388 # for despatching commands that are doing some long processing job
389 #
390 sub process
391 {
392         my $t = time;
393         my @dxchan = DXChannel->get_all();
394         my $dxchan;
395         
396         foreach $dxchan (@dxchan) {
397                 next if $dxchan->sort ne 'U';  
398                 
399                 # send a prompt if no activity out on this channel
400                 if ($t >= $dxchan->t + $main::user_interval) {
401                         $dxchan->prompt() if $dxchan->{state} =~ /^prompt/o;
402                         $dxchan->t($t);
403                 }
404         }
405
406         while (my ($k, $v) = each %nothereslug) {
407                 if ($main::systime >= $v + 300) {
408                         delete $nothereslug{$k};
409                 }
410         }
411 }
412
413 #
414 # finish up a user context
415 #
416 sub disconnect
417 {
418         my $self = shift;
419         my $call = $self->call;
420         delete $self->{senddbg};
421
422         my @rout = $main::routeroot->del_user($call);
423         dbg("B/C PC17 on $main::mycall for: $call") if isdbg('route');
424
425         # issue a pc17 to everybody interested
426         DXProt::route_pc17($DXProt::me, $main::routeroot, @rout) if @rout;
427
428         # I was the last node visited
429     $self->user->node($main::mycall);
430                 
431         # send info to all logged in thingies
432         $self->tell_login('logoutu');
433
434         Log('DXCommand', "$call disconnected");
435
436         $self->SUPER::disconnect;
437 }
438
439 #
440 # short cut to output a prompt
441 #
442
443 sub prompt
444 {
445         my $self = shift;
446         $self->send($self->msg($self->here ? 'pr' : 'pr2', $self->call, cldate($main::systime), ztime($main::systime)));
447 }
448
449 # broadcast a message to all users [except those mentioned after buffer]
450 sub broadcast
451 {
452         my $pkg = shift;                        # ignored
453         my $s = shift;                          # the line to be rebroadcast
454         
455     foreach my $dxchan (DXChannel->get_all()) {
456                 next unless $dxchan->{sort} eq 'U'; # only interested in user channels  
457                 next if grep $dxchan == $_, @_;
458                 $dxchan->send($s);                      # send it
459         }
460 }
461
462 # gimme all the users
463 sub get_all
464 {
465         return grep {$_->{sort} eq 'U'} DXChannel->get_all();
466 }
467
468 # run a script for this user
469 sub run_script
470 {
471         my $self = shift;
472         my $silent = shift || 0;
473         
474 }
475
476 #
477 # search for the command in the cache of short->long form commands
478 #
479
480 sub search
481 {
482         my ($path, $short_cmd, $suffix) = @_;
483         my ($apath, $acmd);
484         
485         # commands are lower case
486         $short_cmd = lc $short_cmd;
487         dbg("command: $path $short_cmd\n") if isdbg('command');
488
489         # do some checking for funny characters
490         return () if $short_cmd =~ /\/$/;
491
492         # return immediately if we have it
493         ($apath, $acmd) = split ',', $cmd_cache{$short_cmd} if $cmd_cache{$short_cmd};
494         if ($apath && $acmd) {
495                 dbg("cached $short_cmd = ($apath, $acmd)\n") if isdbg('command');
496                 return ($apath, $acmd);
497         }
498         
499         # if not guess
500         my @parts = split '/', $short_cmd;
501         my $dirfn;
502         my $curdir = $path;
503         my $p;
504         my $i;
505         my @lparts;
506         
507         for ($i = 0; $i < @parts; $i++) {
508                 my  $p = $parts[$i];
509                 opendir(D, $curdir) or confess "can't open $curdir $!";
510                 my @ls = readdir D;
511                 closedir D;
512                 my $l;
513                 foreach $l (sort @ls) {
514                         next if $l =~ /^\./;
515                         if ($i < $#parts) {             # we are dealing with directories
516                                 if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
517                                         dbg("got dir: $curdir/$l\n") if isdbg('command');
518                                         $dirfn .= "$l/";
519                                         $curdir .= "/$l";
520                                         last;
521                                 }
522                         } else {                        # we are dealing with commands
523                                 @lparts = split /\./, $l;                  
524                                 next if $lparts[$#lparts] ne $suffix;        # only look for .$suffix files
525                                 if ($p eq substr($l, 0, length $p)) {
526                                         pop @lparts; #  remove the suffix
527                                         $l = join '.', @lparts;
528                                         #                 chop $dirfn;               # remove trailing /
529                                         $dirfn = "" unless $dirfn;
530                                         $cmd_cache{"$short_cmd"} = join(',', ($path, "$dirfn$l")); # cache it
531                                         dbg("got path: $path cmd: $dirfn$l\n") if isdbg('command');
532                                         return ($path, "$dirfn$l"); 
533                                 }
534                         }
535                 }
536         }
537         return ();  
538 }  
539
540 # clear the command name cache
541 sub clear_cmd_cache
542 {
543         %cmd_cache = ();
544 }
545
546 #
547 # the persistant execution of things from the command directories
548 #
549 #
550 # This allows perl programs to call functions dynamically
551
552 # This has been nicked directly from the perlembed pages
553 #
554
555 #require Devel::Symdump;  
556
557 sub valid_package_name {
558         my($string) = @_;
559         $string =~ s/([^A-Za-z0-9\/])/sprintf("_%2x",unpack("C",$1))/eg;
560         
561         #second pass only for words starting with a digit
562         $string =~ s|/(\d)|sprintf("/_%2x",unpack("C",$1))|eg;
563         
564         #Dress it up as a real package name
565         $string =~ s/\//_/og;
566         return $string;
567 }
568
569 # find a cmd reference
570 # this is really for use in user written stubs
571 #
572 # use the result as a symbolic reference:-
573 #
574 # no strict 'refs';
575 # @out = &$r($self, $line);
576 #
577 sub find_cmd_ref
578 {
579         my $cmd = shift;
580         my $r;
581         
582         if ($cmd) {
583                 
584                 # first expand out the entry to a command
585                 my ($path, $fcmd) = search($main::localcmd, $cmd, "pl");
586                 ($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd;
587                 
588                 # make sure it is loaded
589                 $r = find_cmd_name($path, $fcmd);
590         }
591         return $r;
592 }
593
594
595 # this bit of magic finds a command in the offered directory
596 sub find_cmd_name {
597         my $path = shift;
598         my $cmdname = shift;
599         my $package = valid_package_name($cmdname);
600         my $filename = "$path/$cmdname.pl";
601         my $mtime = -M $filename;
602         
603         # return if we can't find it
604         $errstr = undef;
605         unless (defined $mtime) {
606                 $errstr = DXM::msg('e1');
607                 return undef;
608         }
609         
610         if(defined $Cache{$package}->{mtime} &&$Cache{$package}->{mtime} <= $mtime) {
611                 #we have compiled this subroutine already,
612                 #it has not been updated on disk, nothing left to do
613                 #print STDERR "already compiled $package->handler\n";
614                 ;
615         } else {
616
617                 my $sub = readfilestr($filename);
618                 unless ($sub) {
619                         $errstr = "Syserr: can't open '$filename' $!";
620                         return undef;
621                 };
622                 
623                 #wrap the code into a subroutine inside our unique package
624                 my $eval = qq( sub { $sub } );
625                 
626                 if (isdbg('eval')) {
627                         my @list = split /\n/, $eval;
628                         my $line;
629                         for (@list) {
630                                 dbg($_ . "\n") if isdbg('eval');
631                         }
632                 }
633                 
634                 $Cache{$package} = {mtime => $mtime, 'eval' => $eval };
635         }
636
637         return $package;
638 }
639
640 sub local_send
641 {
642         my ($self, $let, $buf) = @_;
643         if ($self->{state} eq 'prompt' || $self->{state} eq 'talk') {
644                 if ($self->{enhanced}) {
645                         $self->send_later($let, $buf);
646                 } else {
647                         $self->send($buf);
648                 }
649         } else {
650                 $self->delay($buf);
651         }
652 }
653
654 # send a talk message here
655 sub talk
656 {
657         my ($self, $from, $to, $via, $line) = @_;
658         $line =~ s/\\5E/\^/g;
659         $self->local_send('T', "$to de $from: $line") if $self->{talk};
660         Log('talk', $to, $from, $main::mycall, $line);
661         # send a 'not here' message if required
662         unless ($self->{here} && $from ne $to) {
663                 my $key = "$to$from";
664                 unless (exists $nothereslug{$key}) {
665                         my ($ref, $dxchan);
666                         if (($ref = Route::get($from)) && ($dxchan = $ref->dxchan)) {
667                                 my $name = $self->user->name || $to;
668                                 my $s = $self->user->nothere || $dxchan->msg('nothere', $name);
669                                 $nothereslug{$key} = $main::systime;
670                                 $dxchan->talk($to, $from, undef, $s);
671                         }
672                 }
673         }
674 }
675
676 # send an announce
677 sub announce
678 {
679         my $self = shift;
680         my $line = shift;
681         my $isolate = shift;
682         my $to = shift;
683         my $target = shift;
684         my $text = shift;
685         my ($filter, $hops);
686
687         if ($self->{annfilter}) {
688                 ($filter, $hops) = $self->{annfilter}->it(@_ );
689                 return unless $filter;
690         }
691
692         unless ($self->{ann}) {
693                 return if $_[0] ne $main::myalias && $_[0] ne $main::mycall;
694         }
695         return if $target eq 'SYSOP' && $self->{priv} < 5;
696         my $buf = "$to$target de $_[0]: $text";
697         $buf =~ s/\%5E/^/g;
698         $buf .= "\a\a" if $self->{beep};
699         $self->local_send($target eq 'WX' ? 'W' : 'N', $buf);
700 }
701
702 # send a dx spot
703 sub dx_spot
704 {
705         my $self = shift;
706         my $line = shift;
707         my $isolate = shift;
708         my ($filter, $hops);
709
710         return unless $self->{dx};
711         
712         if ($self->{spotsfilter}) {
713                 ($filter, $hops) = $self->{spotsfilter}->it(@_ );
714                 return unless $filter;
715         }
716
717         my $buf = Spot::formatb($self->{user}->wantgrid, $_[0], $_[1], $_[2], $_[3], $_[4]);
718         $buf .= "\a\a" if $self->{beep};
719         $buf =~ s/\%5E/^/g;
720         $self->local_send('X', $buf);
721 }
722
723 sub wwv
724 {
725         my $self = shift;
726         my $line = shift;
727         my $isolate = shift;
728         my ($filter, $hops);
729
730         return unless $self->{wwv};
731         
732         if ($self->{wwvfilter}) {
733                 ($filter, $hops) = $self->{wwvfilter}->it(@_ );
734                 return unless $filter;
735         }
736
737         my $buf = "WWV de $_[6] <$_[1]>:   SFI=$_[2], A=$_[3], K=$_[4], $_[5]";
738         $buf .= "\a\a" if $self->{beep};
739         $self->local_send('V', $buf);
740 }
741
742 sub wcy
743 {
744         my $self = shift;
745         my $line = shift;
746         my $isolate = shift;
747         my ($filter, $hops);
748
749         return unless $self->{wcy};
750         
751         if ($self->{wcyfilter}) {
752                 ($filter, $hops) = $self->{wcyfilter}->it(@_ );
753                 return unless $filter;
754         }
755
756         my $buf = "WCY de $_[10] <$_[1]> : K=$_[4] expK=$_[5] A=$_[3] R=$_[6] SFI=$_[2] SA=$_[7] GMF=$_[8] Au=$_[9]";
757         $buf .= "\a\a" if $self->{beep};
758         $self->local_send('Y', $buf);
759 }
760
761 # broadcast debug stuff to all interested parties
762 sub broadcast_debug
763 {
764         my $s = shift;                          # the line to be rebroadcast
765         
766         foreach my $dxchan (DXChannel->get_all) {
767                 next unless $dxchan->{enhanced} && $dxchan->{senddbg};
768                 $dxchan->send_later('L', $s);
769         }
770 }
771
772
773 1;
774 __END__