The new BadWord, all regex, system
[spider.git] / cmd / set / badword.pl
1 #
2 # set list of bad dx callsigns
3 #
4 # Copyright (c) 1998 - Dirk Koopman G1TLH
5 #
6 #
7 #
8 my ($self, $line) = @_;
9 return (1, $self->msg('e5')) if $self->remotecmd;
10 # are we permitted?
11 return (1, $self->msg('e5')) if $self->priv < 6;
12 my @words = split /\s+/, uc $line;
13 my @out;
14 my $count = 0;
15 foreach my $w (@words) {
16         my @in;
17         
18         if (@in = BadWords::check($w)) {
19                 push @out, "BadWord $w already matched by '$in[0]', ignored";
20         } else {
21                 @in = BadWords::add_regex($w);
22                 push @out, "BadWord $w added as '$in[0]'";
23                 $count++;
24         }
25 }
26 if ($count) {
27         BadWords::generate_regex();
28         BadWords::put();
29 }
30 return (1, @out);
31