add word seletion to list/badword
authorDirk Koopman <djk@tobit.co.uk>
Wed, 23 Nov 2022 16:20:30 +0000 (16:20 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Wed, 23 Nov 2022 16:20:30 +0000 (16:20 +0000)
cmd/Commands_en.hlp
cmd/show/badword.pl

index 3bef48cd754d7a1dadcffbe5f6d4ca681b35ad4c..ee148a08155c5ed2231dce582afbea1297911393 100644 (file)
@@ -2179,12 +2179,16 @@ for more information.
 
 === 6^SHOW/BADWORD^Show all the bad words in the system
 === 6^SHOW/BADWORD full^Show all badwords with their Regex
+=== 6^SHOW/BADWORD <word> ...^Show all badwords with their Regex
 Display all the bad words in the system, see SET/BADWORD
 for more information.
 
 The first form shows all the base words that are stored in a simple list.
 
-The second form show each word with its associated perl regex.
+The second form list all words with their associated perl regex.
+
+The third form shows just the regexes for the words asked for. If no
+answer for a word is given then it is not defined.
 
 === 0^SHOW/BANDS [band|region names]^Show the list of bands and regions
 Display the bands and regions (collections of bands) known to
index 947f70a4dd78e87d7758beef62ee516c9bcec86f..33abbc05f2bc8ba4d36cbe08f13bec1a030ad1b1 100644 (file)
@@ -5,18 +5,31 @@
 #
 #
 #
+
 my ($self, $line) = @_;
 return (1, $self->msg('e5')) if $self->remotecmd;
 # are we permitted?
 return (1, $self->msg('e5')) if $self->priv < 6;
+
 my @out;
 my @l;
 my $count = 0;
+my @words = BadWords::check($line);
+my $cand;
+my $w;
 
-if ($line =~ /^\s*full/i) {
-       foreach my $w (BadWords::list_regex(1)) {
+push @out, "Words: " . join ',', @words; 
+
+if ($line =~ /^\s*full/i || @words) {
+       foreach $w (BadWords::list_regex(1)) {
                ++$count;
-               push @out, $w; 
+               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 {