* [PATCH 1/2] filter: split out scrub method from delivery
@ 2016-06-17 0:41 7% ` Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-06-17 0:41 UTC (permalink / raw)
To: meta
We will scrub for importing archives, so ensure it is usable
outside of the delivery routine.
---
lib/PublicInbox/Filter/Base.pm | 9 ++++++++-
lib/PublicInbox/Filter/Vger.pm | 7 ++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/Filter/Base.pm b/lib/PublicInbox/Filter/Base.pm
index 0991e87..37f1ee7 100644
--- a/lib/PublicInbox/Filter/Base.pm
+++ b/lib/PublicInbox/Filter/Base.pm
@@ -62,6 +62,13 @@ sub reject ($$) {
sub err ($) { $_[0]->{err} }
+# by default, scrub is a no-op, see PublicInbox::Filter::Vger::scrub
+# for an example of the override
+sub scrub {
+ my ($self, $mime) = @_;
+ $self->ACCEPT($mime);
+}
+
# for MDA
sub delivery {
my ($self, $mime) = @_;
@@ -94,7 +101,7 @@ sub delivery {
push @r, 'Rejected suffixes(s): '.join(', ', sort keys %sfx);
}
- @r ? $self->reject(join("\n", @r)) : $self->ACCEPT;
+ @r ? $self->reject(join("\n", @r)) : $self->scrub($mime);
}
1;
diff --git a/lib/PublicInbox/Filter/Vger.pm b/lib/PublicInbox/Filter/Vger.pm
index 9498081..2ffed18 100644
--- a/lib/PublicInbox/Filter/Vger.pm
+++ b/lib/PublicInbox/Filter/Vger.pm
@@ -17,7 +17,7 @@ my $l3 =
# only LKML had this, and LKML nowadays has no list trailer since Jan 2016
my $l4 = qr!Please read the FAQ at +http://www\.tux\.org/lkml/!;
-sub delivery {
+sub scrub {
my ($self, $mime) = @_;
my $s = $mime->as_string;
@@ -30,4 +30,9 @@ sub delivery {
$self->ACCEPT($mime);
}
+sub delivery {
+ my ($self, $mime) = @_;
+ $self->scrub($mime);
+}
+
1;
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-06-17 0:41 [PATCH 0/2] introduce public-inbox-watch Eric Wong
2016-06-17 0:41 7% ` [PATCH 1/2] filter: split out scrub method from delivery 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).