1998-09-28 15:32:01 +00:00
|
|
|
#
|
|
|
|
# do an announce message
|
|
|
|
#
|
|
|
|
# handles announce
|
|
|
|
# announce full
|
|
|
|
# announce sysop
|
|
|
|
#
|
|
|
|
# at the moment these keywords are fixed, but I dare say a file containing valid ones
|
|
|
|
# will appear
|
|
|
|
#
|
|
|
|
# Copyright (c) 1998 Dirk Koopman G1TLH
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
1998-12-13 22:38:04 +00:00
|
|
|
# Modified 13Dec98 Iain Phillips G0RDI
|
|
|
|
#
|
1998-09-28 15:32:01 +00:00
|
|
|
|
|
|
|
my ($self, $line) = @_;
|
|
|
|
my @f = split /\s+/, $line;
|
2005-01-15 22:03:46 +00:00
|
|
|
return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
|
1998-12-03 23:35:58 +00:00
|
|
|
return (1, $self->msg('e9')) if !@f;
|
2001-10-24 20:47:07 +00:00
|
|
|
return (1, $self->msg('e28')) unless $self->registered;
|
1998-12-03 23:35:58 +00:00
|
|
|
|
1998-09-28 15:32:01 +00:00
|
|
|
my $sort = uc $f[0];
|
|
|
|
my @locals = DXCommandmode->get_all();
|
|
|
|
my $to;
|
|
|
|
my $from = $self->call;
|
|
|
|
my $t = ztime(time);
|
|
|
|
my $tonode;
|
2000-11-29 23:17:19 +00:00
|
|
|
my $toflag = '*';
|
1998-09-28 15:32:01 +00:00
|
|
|
my $sysopflag;
|
|
|
|
|
|
|
|
if ($sort eq "FULL") {
|
|
|
|
$line =~ s/^$f[0]\s+//; # remove it
|
2000-12-05 15:41:36 +00:00
|
|
|
$to = "ALL";
|
1998-09-28 15:32:01 +00:00
|
|
|
} elsif ($sort eq "SYSOP") {
|
|
|
|
$line =~ s/^$f[0]\s+//; # remove it
|
|
|
|
@locals = map { $_->priv >= 5 ? $_ : () } @locals;
|
2000-12-05 15:41:36 +00:00
|
|
|
$to = "SYSOP";
|
1998-09-28 15:32:01 +00:00
|
|
|
$sysopflag = '*';
|
1998-12-13 22:38:04 +00:00
|
|
|
} elsif ($sort eq "LOCAL") {
|
|
|
|
$line =~ s/^$f[0]\s+//; # remove it
|
2000-12-05 15:41:36 +00:00
|
|
|
$to = "LOCAL";
|
1998-12-13 22:38:04 +00:00
|
|
|
} else {
|
2000-12-05 15:41:36 +00:00
|
|
|
$to = "LOCAL";
|
1998-09-28 15:32:01 +00:00
|
|
|
}
|
|
|
|
|
1999-01-03 16:26:57 +00:00
|
|
|
# change ^ into : for transmission
|
|
|
|
$line =~ s/\^/:/og;
|
|
|
|
|
2006-01-11 20:21:50 +00:00
|
|
|
# if this is a 'bad spotter' user then ignore it
|
|
|
|
my $nossid = $from;
|
|
|
|
my $drop = 0;
|
|
|
|
$nossid =~ s/-\d+$//;
|
|
|
|
if ($DXProt::badspotter->in($nossid)) {
|
|
|
|
LogDbg('DXCommand', "bad spotter ($from) announcement: $line");
|
|
|
|
$drop++;
|
|
|
|
}
|
|
|
|
|
|
|
|
# have they sworn?
|
2000-09-02 15:28:14 +00:00
|
|
|
my @bad;
|
|
|
|
if (@bad = BadWords::check($line)) {
|
2001-10-01 23:18:50 +00:00
|
|
|
$self->badcount(($self->badcount||0) + @bad);
|
2006-01-07 16:53:03 +00:00
|
|
|
LogDbg('DXCommand', "$self->{call} swore: $line (with words:" . join(',', @bad) . ")");
|
2006-01-11 20:21:50 +00:00
|
|
|
$drop++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($drop) {
|
2001-10-09 14:03:31 +00:00
|
|
|
Log('ann', $to, $from, "[to $from only] $line");
|
|
|
|
$self->send("To $to de $from <$t>: $line");
|
|
|
|
return (1, ());
|
2000-09-02 15:28:14 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 14:06:59 +00:00
|
|
|
return (1, $self->msg('dup')) if $self->priv < 5 && AnnTalk::dup($from, $toflag, $line);
|
1998-11-29 15:14:48 +00:00
|
|
|
Log('ann', $to, $from, $line);
|
2001-12-30 13:15:40 +00:00
|
|
|
DXChannel::broadcast_list("To $to de $from ($t): $line\a", 'ann', undef, @locals);
|
2000-12-05 15:41:36 +00:00
|
|
|
if ($to ne "LOCAL") {
|
1998-09-28 21:49:56 +00:00
|
|
|
my $pc = DXProt::pc12($from, $line, $tonode, $sysopflag, 0);
|
2001-09-20 14:13:11 +00:00
|
|
|
DXChannel::broadcast_nodes($pc);
|
1998-09-28 15:32:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (1, ());
|