]> Sergey Matveev's repositories - public-inbox.git/commitdiff
filter: split out scrub method from delivery
authorEric Wong <e@80x24.org>
Thu, 16 Jun 2016 22:45:26 +0000 (22:45 +0000)
committerEric Wong <e@80x24.org>
Fri, 17 Jun 2016 00:21:53 +0000 (00:21 +0000)
We will scrub for importing archives, so ensure it is usable
outside of the delivery routine.

lib/PublicInbox/Filter/Base.pm
lib/PublicInbox/Filter/Vger.pm

index 0991e8748820e11b8a112728fbca2b6083c925c2..37f1ee7e59ea76d0211f82c42206a6268b792842 100644 (file)
@@ -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;
index 9498081a1dc98617c5b7f0721d69a954f9ffc1aa..2ffed184a238e18624320b7d3fb3102bf98f4deb 100644 (file)
@@ -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;