From 7346d1f8129457eee2e602b36e27435141533049 Mon Sep 17 00:00:00 2001 From: minima Date: Mon, 1 Oct 2001 14:30:18 +0000 Subject: [PATCH] Try each badword with an S on the end as well and also check for 'f.u c' type things as well (this only works for a few wellknown english ones). --- Changes | 2 ++ perl/BadWords.pm | 24 +++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index ed8b541b..470a8ece 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,8 @@ 2. change the looping protoection for PC16/17/19/21 and also be more rigorous in who we accept which PC16/17/21's from. 3. fix MAJOR disconnect bug introduced accidentally in the NP work. +4. Try each badword with an S on the end as well and also check for 'f.u c' +type things as well (this only works for a few wellknown english ones). 30Sep01======================================================================= 1. made some small bug fixes in rspf checking and also messages. 23Sep01======================================================================= diff --git a/perl/BadWords.pm b/perl/BadWords.pm index e7d1169e..81e7ec90 100644 --- a/perl/BadWords.pm +++ b/perl/BadWords.pm @@ -56,7 +56,29 @@ sub load # check the text against the badwords list sub check { - return grep { $badword->in($_) } split(/\b/, lc shift); + my $s = uc shift; + + for (split(/\s+/, $s)) { + s/[^\w]//g; + return $_ if $badword->in($_); + s/\'?S$//; + return $_ if $badword->in($_); + } + + # look for a few of the common ones with spaces and stuff + if ($s =~ /F[\s\W]*U[\s\W]*C[\s\W]*K/) { + return "FUCK"; + } elsif ($s =~ /C[\s\W]*U[\s\W]*N[\s\W]*T/) { + return "CUNT"; + } elsif ($s =~ /W[\s\W]*A[\s\W]*N[\s\W]*K/) { + return "WANK"; + } elsif ($s =~ /C[\s\W]*[0O][\s\W]*C[\s\W]*K/) { + return "COCK"; + } elsif ($s =~ /S[\s\W]*H[\s\W]*[I1][\s\W]*T/) { + return "SHIT"; + } + + return undef; } 1; -- 2.43.0