]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: remove multipart_text_as_html
authorEric Wong <e@80x24.org>
Sat, 10 Sep 2022 08:17:05 +0000 (08:17 +0000)
committerEric Wong <e@80x24.org>
Sat, 10 Sep 2022 19:50:35 +0000 (19:50 +0000)
It seems like a pointless wrapper function that's not saving us
a whole lot.  Drop some direct {obuf} manipulation while we're
at it.

lib/PublicInbox/View.pm
lib/PublicInbox/WwwAtomStream.pm

index 37b484ae297ddff988ef7be93a16e502e2fdce23..0b67d92f9f4643576823a1eefb010c022a2e4ca9 100644 (file)
@@ -39,8 +39,8 @@ sub msg_page_i {
                $ctx->{mhref} = ($ctx->{nr} || $ctx->{smsg}) ?
                                "../${\mid_href($smsg->{mid})}/" : '';
                if (_msg_page_prepare_obuf($eml, $ctx)) {
-                       multipart_text_as_html($eml, $ctx);
-                       ${$ctx->{obuf}} .= '</pre><hr>';
+                       $eml->each_part(\&add_text_body, $ctx, 1);
+                       $ctx->zmore('</pre><hr>');
                }
                html_footer($ctx, $ctx->{first_hdr}) if !$ctx->{smsg};
                delete($ctx->{obuf}) // \'';
@@ -57,8 +57,8 @@ sub no_over_html ($) {
        $ctx->{mhref} = '';
        PublicInbox::WwwStream::init($ctx);
        if (_msg_page_prepare_obuf($eml, $ctx)) { # sets {-title_html}
-               multipart_text_as_html($eml, $ctx);
-               ${$ctx->{obuf}} .= '</pre><hr>';
+               $eml->each_part(\&add_text_body, $ctx, 1);
+               $ctx->zmore('</pre><hr>');
        }
        html_footer($ctx, $eml);
        $ctx->html_done;
@@ -506,13 +506,6 @@ sub thread_html_i { # PublicInbox::WwwStream::getline callback
        }
 }
 
-sub multipart_text_as_html {
-       # ($mime, $ctx) = @_; # each_part may do "$_[0] = undef"
-
-       # scan through all parts, looking for displayable text
-       $_[0]->each_part(\&add_text_body, $_[1], 1);
-}
-
 sub submsg_hdr ($$) {
        my ($ctx, $eml) = @_;
        my $obfs_ibx = $ctx->{-obfs_ibx};
index 906b292a703d1c14cf2e26bd9d844b13748168b5..09c79a8a1cba1ebbcab244fe853eadb7829a2362 100644 (file)
@@ -157,9 +157,8 @@ sub feed_entry {
        $ctx->{obuf} = \$s;
        $ctx->{mhref} = $href;
        $ctx->{changed_href} = "${href}#related";
-       PublicInbox::View::multipart_text_as_html($eml, $ctx);
-       delete $ctx->{obuf};
-       $s .= '</pre></div></content></entry>';
+       $eml->each_part(\&PublicInbox::View::add_text_body, $ctx, 1);
+       '</pre></div></content></entry>';
 }
 
 sub feed_updated {