make the badspotter log slightly more obvious
[spider.git] / cmd / announce.pl
index a7edb6c076cab7d84bcdd5cd78fb39138bd4258c..6bad4af39449d256c7c023751e9c803181dc8c8b 100644 (file)
@@ -17,8 +17,9 @@
 
 my ($self, $line) = @_;
 my @f = split /\s+/, $line;
-return (1, $self->msg('e5')) if $self->remotecmd;
+return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
 return (1, $self->msg('e9')) if !@f;
+return (1, $self->msg('e28')) unless $self->registered;
 
 my $sort = uc $f[0];
 my @locals = DXCommandmode->get_all();
@@ -31,33 +32,51 @@ my $sysopflag;
 
 if ($sort eq "FULL") {
   $line =~ s/^$f[0]\s+//;    # remove it
-  $to = "All";
+  $to = "ALL";
 } elsif ($sort eq "SYSOP") {
   $line =~ s/^$f[0]\s+//;     # remove it
   @locals = map { $_->priv >= 5 ? $_ : () } @locals;
-  $to = "Sysop";
+  $to = "SYSOP";
   $sysopflag = '*';
 } elsif ($sort eq "LOCAL") {
   $line =~ s/^$f[0]\s+//;     # remove it
-  $to = "Local";
+  $to = "LOCAL";
 } else {
-  $to = "Local";
+  $to = "LOCAL";
 }
 
 # change ^ into : for transmission
 $line =~ s/\^/:/og;
 
+# 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) made announcement: $line");
+       $drop++;
+}
+
+# have they sworn?
 my @bad;
 if (@bad = BadWords::check($line)) {
-       return (1, $self->msg('e17', @bad));
+       $self->badcount(($self->badcount||0) + @bad);
+       LogDbg('DXCommand', "$self->{call} swore: $line (with words:" . join(',', @bad) . ")");
+       $drop++;
+}
+
+if ($drop) {
+       Log('ann', $to, $from, "[to $from only] $line");
+       $self->send("To $to de $from <$t>: $line");
+       return (1, ());
 }
 
-return (1, $self->msg('dup')) if AnnTalk::dup($from, $toflag, $line);
+return (1, $self->msg('dup')) if $self->priv < 5 && AnnTalk::dup($from, $toflag, $line);
 Log('ann', $to, $from, $line);
-DXProt::broadcast_list("To $to de $from <$t>: $line", 'ann', undef, @locals);
-if ($to ne "Local") {
+DXChannel::broadcast_list("To $to de $from ($t): $line\a", 'ann', undef, @locals);
+if ($to ne "LOCAL") {
   my $pc = DXProt::pc12($from, $line, $tonode, $sysopflag, 0);
-  DXProt::broadcast_ak1a($pc);
+  DXChannel::broadcast_nodes($pc);
 }
 
 return (1, ());