user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 4/4] mda: support a 'filter=scrub' option for external lists
  2015-10-03 11:14  6% [PATCH 0/4] misc updates Eric Wong
@ 2015-10-03 11:14  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2015-10-03 11:14 UTC (permalink / raw)
  To: meta

For list where we are not the primary archival entry point,
defaulting to filter=scrub makes sense since their list
conventions may be more tolerant of HTML and other crap
than we are.
---
 lib/PublicInbox/Config.pm |  2 +-
 public-inbox-mda          | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 315d788..0d73a86 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -61,7 +61,7 @@ sub lookup {
 	defined $pfx or return;
 
 	my %rv;
-	foreach my $k (qw(mainrepo address)) {
+	foreach my $k (qw(mainrepo address filter)) {
 		my $v = $self->{"$pfx.$k"};
 		$rv{$k} = $v if defined $v;
 	}
diff --git a/public-inbox-mda b/public-inbox-mda
index 1a9469b..df8ca38 100755
--- a/public-inbox-mda
+++ b/public-inbox-mda
@@ -38,7 +38,18 @@ if (PublicInbox::MDA->precheck($filter, $dst->{address}) &&
 	$filtered = undef;
 	$filter->simple($msg);
 
-	if (PublicInbox::Filter->run($msg, $filter)) {
+	my $filter_arg;
+	my $fcfg = $dst->{filter};
+	if (!defined $fcfg || $filter eq 'reject') {
+		$filter_arg = $filter;
+	} elsif ($fcfg eq 'scrub') {
+		$filter_arg = undef; # the default for legacy versions
+	} else {
+		warn "publicinbox.$dst->{listname}.filter=$fcfg invalid\n";
+		warn "must be either 'scrub' or 'reject' (the default)\n";
+	}
+
+	if (PublicInbox::Filter->run($msg, $filter_arg)) {
 		# run spamc again on the HTML-free message
 		if (do_spamc($msg, \$filtered)) {
 			$msg = Email::MIME->new(\$filtered);
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/4] misc updates
@ 2015-10-03 11:14  6% Eric Wong
  2015-10-03 11:14  7% ` [PATCH 4/4] mda: support a 'filter=scrub' option for external lists Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2015-10-03 11:14 UTC (permalink / raw)
  To: meta

Some internal cleanups.  This also adds the filter=scrub option
to make us more tolerant of crap email and ease integration with
external lists.

Eric Wong (4):
      nntpd: executable permission
      rename mid_compress to id_compress
      drop Message-IDs longer than 244 bytes
      mda: support a 'filter=scrub' option for external lists

 lib/PublicInbox/Config.pm    |  2 +-
 lib/PublicInbox/MDA.pm       |  2 ++
 lib/PublicInbox/MID.pm       | 19 +++++++------------
 lib/PublicInbox/Search.pm    |  6 +++---
 lib/PublicInbox/SearchIdx.pm |  9 +++++++--
 lib/PublicInbox/View.pm      |  4 ++--
 public-inbox-mda             | 13 ++++++++++++-
 public-inbox-nntpd           |  0
 t/view.t                     | 11 +++++------
 9 files changed, 39 insertions(+), 27 deletions(-)


^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-10-03 11:14  6% [PATCH 0/4] misc updates Eric Wong
2015-10-03 11:14  7% ` [PATCH 4/4] mda: support a 'filter=scrub' option for external lists Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).