mega-merge of major parts of mojo
[spider.git] / cmd / wx.pl
1 #
2 # do an wx message, this is identical to the announce except that it does WX
3 # instead
4 #
5 # handles wx
6 #         wx full
7 #         wx sysop
8 #
9 # at the moment these keywords are fixed, but I dare say a file containing valid ones
10 # will appear
11 #
12 # Copyright (c) 1998 Dirk Koopman G1TLH
13 #
14 #
15 #
16
17 my ($self, $line) = @_;
18 my @f = split /\s+/, $line;
19 my $sort = uc $f[0];
20 my $to;
21 my $from = $self->call;
22 my $t = ztime(time);
23 my $tonode;
24 my $via;
25 return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
26 return (1, $self->msg('e28')) unless $self->isregistered;
27
28 if ($sort eq "FULL") {
29   $line =~ s/^$f[0]\s+//;    # remove it
30 } else {
31   $via = "LOCAL";
32 }
33 $to = 'WX';
34
35 # if this is a 'bad spotter' user then ignore it
36 my $nossid = $from;
37 my $drop = 0;
38 $nossid =~ s/-\d+$//;
39 if ($DXProt::badspotter->in($nossid)) {
40         LogDbg('DXCommand', "bad spotter ($self->{call}) made announcement: $line");
41         $drop++;
42 }
43
44 # have they sworn?
45 my @bad;
46 if (@bad = BadWords::check($line)) {
47         $self->badcount(($self->badcount||0) + @bad);
48         LogDbg('DXCommand', "$self->{call} swore: $line (with words:" . join(',', @bad) . ")");
49         $drop++;
50 }
51
52 if ($drop) {
53         Log('ann', $to, $from, "[to $from only] $line");
54         $self->send("WX de $from: $line");
55         return (1, ());
56 }
57
58 Log('ann', $via ? $via : '*', $from, $line);
59 $main::me->normal(DXProt::pc93($to, $from, $via, $line));
60
61 #DXChannel::broadcast_list("WX de $from <$t>: $line", 'wx', undef, @locals);
62 #if ($to ne "LOCAL") {
63 #  $line =~ s/\^//og;    # remove ^ characters!
64 #  my $pc = DXProt::pc12($from, $line, $tonode, $sysopflag, 1);
65 #  DXChannel::broadcast_nodes($pc, $main::me);
66 #}
67
68 return (1, ());