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