- my $ctx = $self->{ctx} or return;
- my $gz = $self->{gz};
- while (my $smsg = $self->{cb}->()) {
- my $mref = $ctx->{-inbox}->msg_by_smsg($smsg) or next;
- my $h = Email::Simple->new($mref)->header_obj;
- $gz->write(PublicInbox::Mbox::msg_hdr($ctx, $h, $smsg->{mid}));
- $gz->write(PublicInbox::Mbox::msg_body($$mref));
-
- my $bref = $self->{buf};
- if (length($$bref) >= 8192) {
- my $ret = $$bref; # copy :<
- ${$self->{buf}} = '';
- return $ret;
- }
-
- # be fair to other clients on public-inbox-httpd:
- return '';
+ my $cb = $self->{cb} or return;
+ while (my $smsg = $cb->($self)) {
+ my $eml = $self->{ibx}->smsg_eml($smsg) or next;
+ $self->zmore(msg_hdr($self, $eml, $smsg->{mid}));
+ return $self->translate(msg_body($eml));