]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Eml.pm
get rid of unnecessary bytes::length usage
[public-inbox.git] / lib / PublicInbox / Eml.pm
index f7f62e7b26c36be34b26493acc2afad49d6bb470..955d6a96a51c12b549478145afd45491dd5c9e25 100644 (file)
@@ -51,7 +51,9 @@ $MIME_ENC{quotedprint} = $MIME_ENC{'quoted-printable'} = $MIME_ENC{qp};
 $MIME_DEC{quotedprint} = $MIME_DEC{'quoted-printable'} = $MIME_DEC{qp};
 $MIME_ENC{$_} = \&identity_codec for qw(7bit 8bit binary);
 
-my %DECODE_ADDRESS = map { $_ => 1 } qw(From To Cc Sender Reply-To);
+my %DECODE_ADDRESS = map {
+       ($_ => 1, "Resent-$_" => 1)
+} qw(From To Cc Sender Reply-To Bcc);
 my %DECODE_FULL = (
        Subject => 1,
        'Content-Description' => 1,
@@ -234,6 +236,7 @@ sub mp_descend ($$) {
 # $cb - user-supplied callback sub
 # $arg - user-supplied arg (think pthread_create)
 # $once - unref body scalar during iteration
+# $all - used by IMAP server, only
 sub each_part {
        my ($self, $cb, $arg, $once, $all) = @_;
        my $p = mp_descend($self, $once // 0) or
@@ -332,7 +335,7 @@ sub body_set {
 sub body_str_set {
        my ($self, $body_str) = @_;
        my $charset = ct($self)->{attributes}->{charset} or
-               Carp::confess('body_str was given, but no charset is defined');
+               croak('body_str was given, but no charset is defined');
        body_set($self, \(encode($charset, $body_str, Encode::FB_CROAK)));
 }
 
@@ -454,7 +457,7 @@ sub body_str {
                if ($STR_TYPE{$ct->{type}} && $STR_SUBTYPE{$ct->{subtype}}) {
                        return body($self);
                }
-               Carp::confess("can't get body as a string for ",
+               croak("can't get body as a string for ",
                        join("\n\t", header_raw($self, 'Content-Type')));
        }
        decode($charset, body($self), Encode::FB_CROAK);
@@ -481,8 +484,8 @@ sub crlf { $_[0]->{crlf} // "\n" }
 sub warn_ignore {
        my $s = "@_";
        # Email::Address::XS warnings
-       $s =~ /^Argument contains empty address at /
-       || $s =~ /^Element at index [0-9]+ contains /
+       $s =~ /^Argument contains empty /
+       || $s =~ /^Element at index [0-9]+.*? contains /
        # PublicInbox::MsgTime
        || $s =~ /^bogus TZ offset: .+?, ignoring and assuming \+0000/
        || $s =~ /^bad Date: .+? in /