X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fset%2Fbadword.pl;h=751e4d44624103f1cf194c67f174f35c6449b424;hb=606b9690c7bb9e293cb4a03507f0280eea05d9ce;hp=2879388f4f921aa1574d78ae88545ef1b37b4282;hpb=6ec22e78a4a344ce675645fabf18b2a1971f364a;p=spider.git diff --git a/cmd/set/badword.pl b/cmd/set/badword.pl index 2879388f..751e4d44 100644 --- a/cmd/set/badword.pl +++ b/cmd/set/badword.pl @@ -9,6 +9,23 @@ my ($self, $line) = @_; return (1, $self->msg('e5')) if $self->remotecmd; # are we permitted? return (1, $self->msg('e5')) if $self->priv < 6; -$line = join(' ', map {s|[/-]\d+$||; $_} split(/\s+/, $line)); -return $BadWords::badword->set(8, $self->msg('e6'), $self, $line); - +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); +