X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FMIME.pm;h=9077386ac2123fab3c28e57d7e8d65f239e9a48b;hb=0283273a14e1871955f6a9132f4f3f7884ec8a3f;hp=792fffd606116b83e40867ca18d874533e91ef10;hpb=3fc59df0d633a17e0c5e43d633d12e8772c06ec3;p=public-inbox.git diff --git a/lib/PublicInbox/MIME.pm b/lib/PublicInbox/MIME.pm index 792fffd6..9077386a 100644 --- a/lib/PublicInbox/MIME.pm +++ b/lib/PublicInbox/MIME.pm @@ -3,6 +3,9 @@ # # The license for this file differs from the rest of public-inbox. # +# We no longer load this in any of our code outside of maintainer +# tests for compatibility. +# # It monkey patches the "parts_multipart" subroutine with patches # from Matthew Horsfall at: # @@ -23,6 +26,9 @@ package PublicInbox::MIME; use strict; use warnings; use base qw(Email::MIME); +use Email::MIME::ContentType; +use PublicInbox::MsgIter (); +$Email::MIME::ContentType::STRICT_PARAMS = 0; if ($Email::MIME::VERSION <= 1.937) { sub parts_multipart { @@ -37,7 +43,7 @@ sub parts_multipart { return $self->parts_single_part unless $boundary and $self->body_raw =~ /^--\Q$boundary\E\s*$/sm; - $self->{body_raw} = $self->SUPER::body; + $self->{body_raw} = Email::Simple::body($self); # rfc1521 7.2.1 my ($body, $epilogue) = split /^--\Q$boundary\E--\s*$/sm, $self->body_raw, 2; @@ -45,13 +51,13 @@ sub parts_multipart { # Split on boundaries, but keep blank lines after them intact my @bits = split /^--\Q$boundary\E\s*?(?=$self->{mycrlf})/m, ($body || ''); - $self->SUPER::body_set(undef); + Email::Simple::body_set($self, undef); # If there are no headers in the potential MIME part, it's just part of the # body. This is a horrible hack, although it's debatable whether it was # better or worse when it was $self->{body} = shift @bits ... -- rjbs, # 2006-11-27 - $self->SUPER::body_set(shift @bits) if ($bits[0] || '') !~ /.*:.*/; + Email::Simple::body_set($self, shift @bits) if ($bits[0] || '') !~ /.*:.*/; my $bits = @bits; @@ -99,4 +105,6 @@ sub parts_multipart { } } +no warnings 'once'; +*each_part = \&PublicInbox::MsgIter::em_each_part; 1;