From 686951722e2709b548384b19ad300f5c2642d368 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 10 Jun 2020 07:04:10 +0000 Subject: eml: each_part: single part $idx is 1 Instead of counts starting at 0, we start the single-part message at 1 like we do with subparts of a multipart message. This will make it easier to map offsets for "BODY[$SECTION]" when using IMAP FETCH, since $SECTION must contain non-zero numbers according to RFC 3501. This doesn't make any difference for WWW URLs, since single part messages cannot have downloadable attachments. --- lib/PublicInbox/Eml.pm | 2 +- lib/PublicInbox/MsgIter.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox') diff --git a/lib/PublicInbox/Eml.pm b/lib/PublicInbox/Eml.pm index d2bd3915..ec682b91 100644 --- a/lib/PublicInbox/Eml.pm +++ b/lib/PublicInbox/Eml.pm @@ -237,7 +237,7 @@ sub mp_descend ($$) { sub each_part { my ($self, $cb, $arg, $once, $all) = @_; my $p = mp_descend($self, $once // 0) or - return $cb->([$self, 0, 0], $arg); + return $cb->([$self, 0, 1], $arg); $cb->([$self, 0, 0], $arg) if ($all || $self->{-call_cb}); # rare diff --git a/lib/PublicInbox/MsgIter.pm b/lib/PublicInbox/MsgIter.pm index 5ec2a4d9..bb1dfead 100644 --- a/lib/PublicInbox/MsgIter.pm +++ b/lib/PublicInbox/MsgIter.pm @@ -34,7 +34,7 @@ sub em_each_part ($$;$$) { } } } else { - $cb->([$mime, 0, 0], $cb_arg); + $cb->([$mime, 0, 1], $cb_arg); } } -- cgit v1.2.3-24-ge0c7