-# public functions: (unstable)
-
-sub msg_html {
- my ($ctx, $mime, $more, $smsg) = @_;
- my $hdr = $mime->header_obj;
- my $ibx = $ctx->{-inbox};
- $ctx->{-obfs_ibx} = $ibx->{obfuscate} ? $ibx : undef;
- my $tip = _msg_html_prepare($hdr, $ctx, $more, 0);
- my $end = 2;
- PublicInbox::WwwStream->response($ctx, 200, sub {
- my ($nr, undef) = @_;
- if ($nr == 1) {
- # $more cannot be true w/o $smsg being defined:
- my $upfx = $more ? '../'.mid_escape($smsg->mid).'/' : '';
- $tip . multipart_text_as_html($mime, $upfx, $ctx) .
- '</pre><hr>'
- } elsif ($more && @$more) {
- ++$end;
- msg_html_more($ctx, $more, $nr);
- } elsif ($nr == $end) {
- # fake an EOF if generating the footer fails;
- # we want to at least show the message if something
- # here crashes:
- eval {
- '<pre>' . html_footer($hdr, 1, $ctx) .
- '</pre>' . msg_reply($ctx, $hdr)
- };
- } else {
- undef
+sub msg_page_i {
+ my ($ctx, $eml) = @_;
+ if ($eml) { # called by WwwStream::async_eml or getline
+ my $smsg = $ctx->{smsg};
+ my $over = $ctx->{ibx}->over;
+ $ctx->{smsg} = $over ? $over->next_by_mid(@{$ctx->{next_arg}})
+ : $ctx->gone('over');
+ $ctx->{mhref} = ($ctx->{nr} || $ctx->{smsg}) ?
+ "../${\mid_href($smsg->{mid})}/" : '';
+ my $obuf = $ctx->{obuf} = _msg_page_prepare_obuf($eml, $ctx);
+ if (length($$obuf)) {
+ multipart_text_as_html($eml, $ctx);
+ $$obuf .= '</pre><hr>';