5. fix talkmode so that it only does 'via' PC10s when it really needs to.
[spider.git] / cmd / announce.pl
1 #
2 # do an announce message 
3 #
4 # handles announce
5 #         announce full
6 #         announce sysop
7 #
8 # at the moment these keywords are fixed, but I dare say a file containing valid ones
9 # will appear
10 #
11 # Copyright (c) 1998 Dirk Koopman G1TLH
12 #
13 # $Id$
14 #
15 # Modified 13Dec98 Iain Phillips G0RDI
16 #
17
18 my ($self, $line) = @_;
19 my @f = split /\s+/, $line;
20 return (1, $self->msg('e5')) if $self->remotecmd;
21 return (1, $self->msg('e9')) if !@f;
22
23 my $sort = uc $f[0];
24 my @locals = DXCommandmode->get_all();
25 my $to;
26 my $from = $self->call;
27 my $t = ztime(time);
28 my $tonode;
29 my $sysopflag;
30
31 if ($sort eq "FULL") {
32   $line =~ s/^$f[0]\s+//;    # remove it
33   $to = "ALL";
34 } elsif ($sort eq "SYSOP") {
35   $line =~ s/^$f[0]\s+//;     # remove it
36   @locals = map { $_->priv >= 5 ? $_ : () } @locals;
37   $to = "SYSOP";
38   $sysopflag = '*';
39 } elsif ($sort eq "LOCAL") {
40   $line =~ s/^$f[0]\s+//;     # remove it
41   $to = "LOCAL";
42 } else {
43   $to = "LOCAL";
44 }
45
46 # change ^ into : for transmission
47 $line =~ s/\^/:/og;
48
49 return (1, $self->msg('dup')) if AnnTalk::dup($from, $to, $line);
50 Log('ann', $to, $from, $line);
51 DXProt::broadcast_list("To $to de $from <$t>: $line", 'ann', undef, @locals);
52 if ($to ne "LOCAL") {
53   $line =~ s/\^//og;    # remove ^ characters!
54   my $pc = DXProt::pc12($from, $line, $tonode, $sysopflag, 0);
55   DXProt::broadcast_ak1a($pc);
56 }
57
58 return (1, ());