Thread View: news.software.nntp
1 messages
1 total messages
Started by Joe St Sauver
Wed, 01 Apr 1998 00:00
An alternative to regex based filtering
Author: Joe St Sauver
Date: Wed, 01 Apr 1998 00:00
Date: Wed, 01 Apr 1998 00:00
36 lines
1916 bytes
1916 bytes
If you are currently using Clean Feed for filtering and have a large-ish
locally augmented list of $badguys, or if you are shunning a number of sites
via ME entries in your newsfeeds file, the following perl code may be faster
than a large regex for you (or then again, maybe not). Anyhow:
[above sub filter_art]
open (INPUT, "/news/path-headers.txt") ||
die "can not open /news/path-headers.txt\n";
while (<INPUT>) { chop; $ptoken{$_}=1; } close (INPUT);
open (INPUT, "/news/tokens.txt") ||
die "can not open /news/tokens.txt\n";
while (<INPUT>) { chop; $token{$_}=1; } close (INPUT);
[within sub filter_art]
@pathtokens = (split(/[\!]+/o,$hdr{'Path'}));
foreach $word (@pathtokens)
{return "Unwanted-Path: $word\n" if $ptoken{($word)}; }
@testtokens = (split(/[ \t\@\!\.\"\'\_]+/o,lc($hdr{'From'})));
foreach $word (@testtokens)
{return "Unwanted-From: $word\n" if $token{($word)}; }
Regards,
Joe
Disclaimer: no warranties express or implied, this code is only provided
for illustration/conceptual discussion purposes and would require extensive
modification and embellishment before it could possibly be fast or stable
enough to use in a production environment, etc., etc., etc.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads