chiark / gitweb /
stump: fix hideous bug where passlisting someone puts their whole From: line in the...
[modbot-mtm.git] / webstump / scripts / filter.lib.pl
index 8aef45fe54112f53e4d590f157fe4b000849951d..a490c5a40f3ee093d8884e03806b02659e00c6a8 100644 (file)
@@ -44,6 +44,7 @@ print STDERR "DECISION: $newsgroup | $ShortDirectoryName | $decision | $cathow |
 # against the substrings as regexps and substrings as literal substrings.
 #
 # Arguments: address, listname
+
 sub name_is_in_list { # address, listname
   my $listName = pop( @_ );
   my $address = pop( @_ );
@@ -51,20 +52,23 @@ sub name_is_in_list { # address, listname
   my $item = "";
   my $Result = "";
 
-  $address = "\L$address";
-
   open( LIST, &full_config_file_name( $listName ) ) || return "";
 
   while( $item = <LIST> ) {
 
-    chop $item;
+    chomp $item;
 
-    next if $item =~ /^\s*$/;
+    next unless $item =~ /\S/;
+    next if $item =~ /^\s*\#/;
 
-    my $quoted_item = quotemeta( $item );
-
-    if( eval { $address =~ /$item/i; } || $address =~ /$quoted_item/i ) {
-      $Result = $item;
+    if ($listName eq 'good.posters.list') {
+       if( lc $address eq lc $item ) {
+           $Result = $item;
+       }
+    } else {
+       if( eval { $address =~ /$item/i; } ) {
+           $Result = $item;
+       }
     }
   }
 
@@ -73,7 +77,6 @@ sub name_is_in_list { # address, listname
   return $Result;
 }
 
-
 ######################################################################
 # reviews incoming message and decides: approve, reject, keep
 # in queue for human review