X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fbadword.pl;h=33abbc05f2bc8ba4d36cbe08f13bec1a030ad1b1;hb=6311e8b178d0aeee984865fbd0446885c85b2f53;hp=a8ef5c571508cbc9bccbeeea50d149a473b24294;hpb=6ec22e78a4a344ce675645fabf18b2a1971f364a;p=spider.git diff --git a/cmd/show/badword.pl b/cmd/show/badword.pl index a8ef5c57..33abbc05 100644 --- a/cmd/show/badword.pl +++ b/cmd/show/badword.pl @@ -5,9 +5,47 @@ # # # + my ($self, $line) = @_; return (1, $self->msg('e5')) if $self->remotecmd; # are we permitted? return (1, $self->msg('e5')) if $self->priv < 6; -return $BadWords::badword->show(1, $self); + +my @out; +my @l; +my $count = 0; +my @words = BadWords::check($line); +my $cand; +my $w; + +push @out, "Words: " . join ',', @words; + +if ($line =~ /^\s*full/i || @words) { + foreach $w (BadWords::list_regex(1)) { + ++$count; + if ($line =~ /^\s*full/) { + push @out, $w; + } elsif (@words) { + ($cand) = split /\s+/, $w; + #push @out, "cand: $cand"; + push @out, $w if grep {$cand eq $_} @words; + } + } +} +else { + foreach my $w (BadWords::list_regex()) { + ++$count; + if (@l >= 5) { + push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l; + @l = (); + } + push @l, $w; + } + push @l, "" while @l < 5; + push @out, sprintf "%-12s %-12s %-12s %-12s %-12s", @l; +} + +push @out, "$count BadWords"; + +return (1, @out);