use PublicInbox::Linkify;
use PublicInbox::MID qw/id_compress mid_escape mids mids_for_index references/;
use PublicInbox::MsgIter;
use PublicInbox::Linkify;
use PublicInbox::MID qw/id_compress mid_escape mids mids_for_index references/;
use PublicInbox::MsgIter;
# $more cannot be true w/o $smsg being defined:
my $upfx = $more ? '../'.mid_escape($ctx->{smsg}->mid).'/' : '';
$ctx->{tip} .
# $more cannot be true w/o $smsg being defined:
my $upfx = $more ? '../'.mid_escape($ctx->{smsg}->mid).'/' : '';
$ctx->{tip} .
} elsif ($more && @$more) {
++$ctx->{end_nr};
msg_html_more($ctx, $more, $nr);
} elsif ($more && @$more) {
++$ctx->{end_nr};
msg_html_more($ctx, $more, $nr);
'<pre>' . html_footer($hdr, 1, $ctx) .
'</pre>' . msg_reply($ctx, $hdr)
};
'<pre>' . html_footer($hdr, 1, $ctx) .
'</pre>' . msg_reply($ctx, $hdr)
};
my ($ctx, $mime, $more, $smsg) = @_;
my $ibx = $ctx->{-inbox};
$ctx->{-obfs_ibx} = $ibx->{obfuscate} ? $ibx : undef;
my ($ctx, $mime, $more, $smsg) = @_;
my $ibx = $ctx->{-inbox};
$ctx->{-obfs_ibx} = $ibx->{obfuscate} ? $ibx : undef;
- $ctx->{tip} = _msg_html_prepare($mime->header_obj, $ctx, $more, 0);
+ my $hdr = $ctx->{hdr} = $mime->header_obj;
+ $ctx->{tip} = _msg_html_prepare($hdr, $ctx, $more, 0);
my $next = $ibx->over->next_by_mid($mid, \$id, \$prev);
@$more = $next ? ($id, $prev, $next) : ();
if ($smsg) {
my $next = $ibx->over->next_by_mid($mid, \$id, \$prev);
@$more = $next ? ($id, $prev, $next) : ();
if ($smsg) {
_msg_html_prepare($mime->header_obj, $ctx, $more, $nr) .
multipart_text_as_html($mime, $upfx, $ctx) .
'</pre><hr>'
_msg_html_prepare($mime->header_obj, $ctx, $more, $nr) .
multipart_text_as_html($mime, $upfx, $ctx) .
'</pre><hr>'
- my $ibx = $ctx->{-inbox};
- msg_iter($mime, sub { $rv .= add_text_body($mhref, $ctx, $_[0]) });
+ $ctx->{mhref} = $mhref;
+ $ctx->{rv} = \$rv;
+ msg_iter($mime, \&add_text_body, $ctx);
+ delete $ctx->{rv};
- my ($mime, $upfx, $ctx) = @_;
- my $rv = "";
+ my ($mime, $mhref, $ctx) = @_;
+ $ctx->{mhref} = $mhref;
+ $ctx->{rv} = \(my $rv = '');
- msg_iter($mime, sub { $rv .= add_text_body($upfx, $ctx, $_[0]) });
- $rv;
+ msg_iter($mime, \&add_text_body, $ctx);
+ ${delete $ctx->{rv}};
- my ($upfx, $ct, $p, $fn, $err) = @_;
+ my ($ctx, $ct, $p, $fn, $err) = @_;
my ($part, $depth, @idx) = @$p;
my $nl = $idx[-1] > 1 ? "\n" : '';
my $idx = join('.', @idx);
my ($part, $depth, @idx) = @$p;
my $nl = $idx[-1] > 1 ? "\n" : '';
my $idx = join('.', @idx);
my $ts = "Type: $ct, Size: $size bytes";
$desc = ascii_html($desc);
my $ts = "Type: $ct, Size: $size bytes";
$desc = ascii_html($desc);
# $p - from msg_iter: [ Email::MIME, depth, @idx ]
my ($part, $depth, @idx) = @$p;
my $ct = $part->content_type || 'text/plain';
my $fn = $part->filename;
my ($s, $err) = msg_part_text($part, $ct);
# $p - from msg_iter: [ Email::MIME, depth, @idx ]
my ($part, $depth, @idx) = @$p;
my $ct = $part->content_type || 'text/plain';
my $fn = $part->filename;
my ($s, $err) = msg_part_text($part, $ct);
-
- return attach_link($upfx, $ct, $p, $fn) unless defined $s;
+ return attach_link($ctx, $ct, $p, $fn) unless defined $s;
# makes no difference to browsers, and don't screw up filename
# link generation in diffs with the extra '%0D'
# makes no difference to browsers, and don't screw up filename
# link generation in diffs with the extra '%0D'
# split off quoted and unquoted blocks:
my @sections = split(/((?:^>[^\n]*\n)+)/sm, $s);
$s = '';
# split off quoted and unquoted blocks:
my @sections = split(/((?:^>[^\n]*\n)+)/sm, $s);
$s = '';
if (defined($fn) || $depth > 0 || $err) {
# badly-encoded message with $err? tell the world about it!
if (defined($fn) || $depth > 0 || $err) {
# badly-encoded message with $err? tell the world about it!
- $s .= attach_link($upfx, $ct, $p, $fn, $err);
- $s .= "\n";
+ attach_link($ctx, $ct, $p, $fn, $err);
+ $$rv .= "\n";