X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Fshow%2Fbadword.pl;h=0f6703b7c352570e44aad3bb94ea0695d36b808d;hb=refs%2Fheads%2Fstaging;hp=a2b4ce86cbf690aed4cbdbfa7daf187181ef1d02;hpb=3cdd57e7baf63341fdcba6b764f304291ed0dbb2;p=spider.git diff --git a/cmd/show/badword.pl b/cmd/show/badword.pl index a2b4ce86..0f6703b7 100644 --- a/cmd/show/badword.pl +++ b/cmd/show/badword.pl @@ -1,14 +1,51 @@ # # show list of bad dx callsigns # -# Copyright (c) 1998 - Dirk Koopman G1TLH +# Copyright (c) 2023 - Dirk Koopman G1TLH # # # + 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->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);