- my $s = $smsg->subject;
- my $h = $ctx->{srch}->subject_path($s);
- if ($ctx->{seen}->{$h}) {
- $s = undef;
+ my @subj = split(/ /, $ctx->{srch}->subject_normalized($smsg->subject));
+
+ # remove common suffixes from the subject if it matches the previous,
+ # so we do not show redundant text at the end.
+ my $prev_subj = $ctx->{prev_subj} || [];
+ $ctx->{prev_subj} = [ @subj ];
+ my $omit = ''; # '"' denotes identical text omitted
+ while (@$prev_subj && @subj && $subj[-1] eq $prev_subj->[-1]) {
+ pop @$prev_subj;
+ pop @subj;
+ $omit ||= '" ';
+ }
+ pop @subj if @subj && $subj[-1] =~ /^re:\s*/i;
+ my $end;
+ if (@subj) {
+ my $subj = join(' ', @subj);
+ $subj = ascii_html($subj);
+ obfuscate_addrs($obfs_ibx, $subj) if $obfs_ibx;
+ $end = "$subj</a> $omit$f\n"