Преглед изворни кода

Fix really old bug with foulwords - was only applying the wordbreak settings to the first and last words in the list of foulwords. Now applies it to each word.

sbingner пре 23 година
родитељ
комит
3ca1a1016c
3 измењених фајлова са 8 додато и 2 уклоњено
  1. 3 0
      docs/Changelog
  2. 4 1
      modules/Pisg.pm
  3. 1 1
      modules/Pisg/Parser/Logfile.pm

+ 3 - 0
docs/Changelog

@@ -8,6 +8,9 @@ pisg (x.xx)
      it as <set foo="you">. Will now NOT work with mis-matched quotes... which
      it probably never should have. EG: <set foo="bar'>)
    * Fix bug in xchat format - was not recognizing joins
+   * Fix really old bug with foulwords - was only applying the wordbreak settings
+     to the first and last words in the list of foulwords.  Now applies it to
+     each word.
 
 
 pisg (0.46) - Tue Feb, 11th 2003

+ 4 - 1
modules/Pisg.pm

@@ -271,7 +271,10 @@ sub init_words
 {
     my $self = shift;
     $self->{cfg}->{foulwords} =~ s/(^\s+|\s+$)//g;
-    $self->{cfg}->{foulwords} =~ s/\s+/|/g;
+    my $foultemp = $self->{cfg}->{foulwords};
+    $self->{cfg}->{foulwords} =~ s/\s+/|\b/g;
+    $self->{cfg}->{foulwords} = '\b' . $self->{cfg}->{foulwords} . '|' . $foultemp . '\b';
+    $self->{cfg}->{foulwords} =~ s/\s+/\b|/g;
     foreach (split(/\s+/, $self->{cfg}->{ignorewords})) {
         $self->{cfg}->{ignoreword}{$_} = 1;
     }

+ 1 - 1
modules/Pisg/Parser/Logfile.pm

@@ -299,7 +299,7 @@ sub _parse_file
                         }
                     }
 
-                    if (my @foul = $saying =~ /(\b$self->{cfg}->{foulwords}|$self->{cfg}->{foulwords}\b)/io) {
+                    if (my @foul = $saying =~ /($self->{cfg}->{foulwords})/io) {
                         $stats->{foul}{$nick} += scalar @foul;
                         push @{ $lines->{foullines}{$nick} }, $line;
                     }