1 # Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # Filter for vger.kernel.org list trailer
5 package PublicInbox::Filter::Vger;
6 use base qw(PublicInbox::Filter::Base);
10 my $l0 = qr/-+/; # older messages only had one '-'
12 qr/To unsubscribe from this list: send the line "unsubscribe [\w-]+" in/;
13 my $l2 = qr/the body of a message to majordomo\@vger\.kernel\.org/;
15 qr!More majordomo info at +http://vger\.kernel\.org/majordomo-info\.html!;
17 # only LKML had this, and LKML nowadays has no list trailer since Jan 2016
18 my $l4 = qr!Please read the FAQ at +http://www\.tux\.org/lkml/!;
21 my ($self, $mime) = @_;
22 my $s = $mime->as_string;
24 # the vger appender seems to only work on the raw string,
25 # so in multipart (e.g. GPG-signed) messages, the list trailer
26 # becomes invisible to MIME-aware email clients.
27 if ($s =~ s/$l0\n$l1\n$l2\n$l3\n(?:$l4\n)?\n*\z//os) {
28 $mime = PublicInbox::Eml->new(\$s);
34 my ($self, $mime) = @_;