Merge branch 'master' into SIMPLEROUTE
[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 || $self->inscript;
21 return (1, $self->msg('e9')) if !@f;
22 return (1, $self->msg('e28')) unless $self->registered;
23
24 my $sort = uc $f[0];
25 my $to = '*';
26 my $from = $self->call;
27 my $t = ztime(time);
28 my $tonode;
29 my $toflag = '*';
30 my $sysopflag;
31 my $via = 'LOCAL';
32
33 if ($sort eq "FULL") {
34   $line =~ s/^$f[0]\s+//;    # remove it
35   $via = $to = "*";
36 } elsif ($sort eq "SYSOP") {
37   $line =~ s/^$f[0]\s+//;     # remove it
38   $to = "SYSOP";
39   $via = $sysopflag = '*';
40 } elsif ($sort eq "LOCAL") {
41   $line =~ s/^$f[0]\s+//;     # remove it
42 }
43
44 # if this is a 'bad spotter' user then ignore it
45 my $nossid = $from;
46 my $drop = 0;
47 $nossid =~ s/-\d+$//;
48 if ($DXProt::badspotter->in($nossid)) {
49         LogDbg('DXCommand', "bad spotter ($self->{call}) made announcement: $line");
50         $drop++;
51 }
52
53 # have they sworn?
54 my @bad;
55 if (@bad = BadWords::check($line)) {
56         $self->badcount(($self->badcount||0) + @bad);
57         LogDbg('DXCommand', "$self->{call} swore: $line (with words:" . join(',', @bad) . ")");
58         $drop++;
59 }
60
61 if ($drop) {
62         Log('ann', $to, $from, "[to $from only] $line");
63         $self->send("To $to de $from: $line");
64         return (1, ());
65 }
66
67 return (1, $self->msg('dup')) if $self->priv < 5 && AnnTalk::dup($from, $toflag, $line);
68 Log('ann', $to, $from, $line);
69 $main::me->normal(DXProt::pc93($to, $from, $via, $line));
70
71 #DXChannel::broadcast_list("To $to de $from ($t): $line\a", 'ann', undef, @locals);
72 #if ($to ne "LOCAL") {
73 #  my $pc = DXProt::pc12($from, $line, $tonode, $sysopflag, 0);
74 #  DXChannel::broadcast_nodes($pc);
75 #}
76
77 return (1, ());