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