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.
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
}
}
} else {
- $cb->([$mime, 0, 0], $cb_arg);
+ $cb->([$mime, 0, 1], $cb_arg);
}
}
is(scalar(@tmp), 1, 'got one part even w/o boundary');
is($tmp[0]->[0]->[0]->body, "hello world\n", 'body preserved');
is($tmp[0]->[0]->[1], 0, '$depth is zero');
- is($tmp[0]->[0]->[2], 0, '@idx is zero');
+ is($tmp[0]->[0]->[2], 1, '@idx is one');
}
# I guess the following only worked in PI::M because of a happy accident