]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Filter/Vger.pm
replace most uses of PublicInbox::MIME with Eml
[public-inbox.git] / lib / PublicInbox / Filter / Vger.pm
index 9498081a1dc98617c5b7f0721d69a954f9ffc1aa..2c73738d82cc89a6ed1a19ae8537f0b265d868eb 100644 (file)
@@ -1,11 +1,11 @@
-# Copyright (C) 2016 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # Filter for vger.kernel.org list trailer
 package PublicInbox::Filter::Vger;
 use base qw(PublicInbox::Filter::Base);
 use strict;
-use warnings;
+use PublicInbox::Eml;
 
 my $l0 = qr/-+/; # older messages only had one '-'
 my $l1 =
@@ -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;
 
@@ -25,9 +25,14 @@ sub delivery {
        # so in multipart (e.g. GPG-signed) messages, the list trailer
        # becomes invisible to MIME-aware email clients.
        if ($s =~ s/$l0\n$l1\n$l2\n$l3\n($l4\n)?\z//os) {
-               $mime = Email::MIME->new(\$s);
+               $mime = PublicInbox::Eml->new(\$s);
        }
        $self->ACCEPT($mime);
 }
 
+sub delivery {
+       my ($self, $mime) = @_;
+       $self->scrub($mime);
+}
+
 1;