X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FView.pm;h=ddd94e48f730a2a493f913d9a43f3b6fd9dd1ac2;hb=fec19e492eacb10f990091592f423542ab4249bd;hp=d897aeecc3ed3abf6ba2dc71bb9540cbf3ec0bdd;hpb=321fcd4881bc196521466c6698f7c4b4a4bb5360;p=public-inbox.git diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index d897aeec..ddd94e48 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -482,17 +482,6 @@ sub multipart_text_as_html { msg_iter($_[0], \&add_text_body, $_[1], 1); } -sub flush_quote { - my ($s, $l, $quot) = @_; - - my $rv = $l->to_html($$quot); - - # we use a here to allow users to specify their own - # color for quoted text - $$quot = undef; - $$s .= qq() . $rv . '' -} - sub attach_link ($$$$;$) { my ($ctx, $ct, $p, $fn, $err) = @_; my ($part, $depth, @idx) = @$p; @@ -504,9 +493,6 @@ sub attach_link ($$$$;$) { # spotting MUA problems: $ct =~ s/;.*// unless $err; $ct = ascii_html($ct); - my $desc = $part->header('Content-Description'); - $desc = $fn unless defined $desc; - $desc = '' unless defined $desc; my $sfn; if (defined $fn && $fn =~ /\A$PublicInbox::Hval::FN\z/o) { $sfn = $fn; @@ -524,6 +510,7 @@ EOF } $$rv .= "[-- Attachment #$idx: "; my $ts = "Type: $ct, Size: $size bytes"; + my $desc = $part->header('Content-Description') // $fn // ''; $desc = ascii_html($desc); $$rv .= ($desc eq '') ? "$ts --]" : "$desc --]\n[-- $ts --]"; $$rv .= "\n"; @@ -579,7 +566,7 @@ sub add_text_body { # callback for msg_iter # split off quoted and unquoted blocks: my @sections = PublicInbox::MsgIter::split_quotes($s); - $s = ''; + undef $s; # free memory my $rv = $ctx->{obuf}; if (defined($fn) || $depth > 0 || $err) { # badly-encoded message with $err? tell the world about it! @@ -589,14 +576,18 @@ sub add_text_body { # callback for msg_iter my $l = $ctx->{-linkify} //= PublicInbox::Linkify->new; foreach my $cur (@sections) { if ($cur =~ /\A>/) { - flush_quote($rv, $l, \$cur); + # we use a here to allow users to specify + # their own color for quoted text + $$rv .= qq(); + $$rv .= $l->to_html($cur); + $$rv .= ''; } elsif ($diff) { - flush_diff($rv, $ctx, \$cur); + flush_diff($ctx, \$cur); } else { # regular lines, OK $$rv .= $l->to_html($cur); - $cur = undef; } + undef $cur; # free memory } obfuscate_addrs($ibx, $$rv) if $ibx->{obfuscate}; @@ -890,20 +881,20 @@ sub missing_thread { sub dedupe_subject { my ($prev_subj, $subj, $val) = @_; - my $omit = ''; # '"' denotes identical text omitted + my $omit; # '"' denotes identical text omitted my (@prev_pop, @curr_pop); while (@$prev_subj && @$subj && $subj->[-1] eq $prev_subj->[-1]) { push(@prev_pop, pop(@$prev_subj)); push(@curr_pop, pop(@$subj)); - $omit ||= $val; + $omit //= $val; } pop @$subj if @$subj && $subj->[-1] =~ /^re:\s*/i; if (scalar(@curr_pop) == 1) { - $omit = ''; + $omit = undef; push @$prev_subj, @prev_pop; push @$subj, @curr_pop; } - $omit; + $omit // ''; } sub skel_dump { # walk_thread callback