The new BadWord, all regex, system
[spider.git] / cmd / set / badword.pl
index 7df13cff6a0b61cf89de642e8f5a60d95d5c547e..751e4d44624103f1cf194c67f174f35c6449b424 100644 (file)
@@ -6,5 +6,26 @@
 #
 #
 my ($self, $line) = @_;
-return $BadWords::badword->set(8, $self->msg('e6'), $self, $line);
-
+return (1, $self->msg('e5')) if $self->remotecmd;
+# are we permitted?
+return (1, $self->msg('e5')) if $self->priv < 6;
+my @words = split /\s+/, uc $line;
+my @out;
+my $count = 0;
+foreach my $w (@words) {
+       my @in;
+       
+       if (@in = BadWords::check($w)) {
+               push @out, "BadWord $w already matched by '$in[0]', ignored";
+       } else {
+               @in = BadWords::add_regex($w);
+               push @out, "BadWord $w added as '$in[0]'";
+               $count++;
+       }
+}
+if ($count) {
+       BadWords::generate_regex();
+       BadWords::put();
+}
+return (1, @out);
+