X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~webstump/git?p=modbot-mtm.git;a=blobdiff_plain;f=webstump%2Fscripts%2Ffilter.lib.pl;h=a490c5a40f3ee093d8884e03806b02659e00c6a8;hp=8aef45fe54112f53e4d590f157fe4b000849951d;hb=e34b76824b88b3240efc0509ebcd110a26687ab0;hpb=8d19917103cd5b8185056a6ebfe951a45535c3ea diff --git a/webstump/scripts/filter.lib.pl b/webstump/scripts/filter.lib.pl index 8aef45f..a490c5a 100644 --- a/webstump/scripts/filter.lib.pl +++ b/webstump/scripts/filter.lib.pl @@ -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 = ) { - 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