Compressed Message-IDs are irreversible and may not be used
at other sites. So avoid compressing Message-IDs we do not
know about so users have a chance of finding the message in
other archives by doing a Message-ID lookup.
- my ($class, $msgid) = @_;
+ my ($class, $msgid, $no_compress) = @_;
$msgid = mid_clean($msgid);
$msgid = mid_clean($msgid);
- $class->new($msgid, mid_compress($msgid));
+ $class->new($msgid, $no_compress ? $msgid : mid_compress($msgid));
if (defined $irt) {
unless (defined $parent_anchor) {
if (defined $irt) {
unless (defined $parent_anchor) {
- my $v = PublicInbox::Hval->new_msgid($irt);
+ my $v = PublicInbox::Hval->new_msgid($irt, 1);
$v = $v->as_href;
$parent_anchor = "${path}$v/";
}
$v = $v->as_href;
$parent_anchor = "${path}$v/";
}
if ($nr <= 1) {
$$dst .= "\n[no followups, yet]\n";
if ($nr <= 1) {
$$dst .= "\n[no followups, yet]\n";
+ return (undef, in_reply_to($cur));
}
my $upfx = $full_pfx ? '' : '../';
$$dst .= "\n\n~$nr messages in thread: ".
"(<a\nhref=\"${upfx}t/#u\">expand</a>)\n";
my $subj = $srch->subject_path($cur->header('Subject'));
}
my $upfx = $full_pfx ? '' : '../';
$$dst .= "\n\n~$nr messages in thread: ".
"(<a\nhref=\"${upfx}t/#u\">expand</a>)\n";
my $subj = $srch->subject_path($cur->header('Subject'));
+ my $parent = in_reply_to($cur);
my $state = {
seen => { $subj => 1 },
srch => $srch,
cur => $mid,
my $state = {
seen => { $subj => 1 },
srch => $srch,
cur => $mid,
+ parent_cmp => $parent ? mid_compress($parent) : '',
+ parent => $parent,
};
for (thread_results(load_results($res))->rootset) {
inline_dump($dst, $state, $upfx, $_, 0);
}
};
for (thread_results(load_results($res))->rootset) {
inline_dump($dst, $state, $upfx, $_, 0);
}
+ ($state->{next_msg}, $state->{parent});
}
sub _parent_headers_nosrch {
}
sub _parent_headers_nosrch {
my $irt = in_reply_to($header_obj);
if (defined $irt) {
my $irt = in_reply_to($header_obj);
if (defined $irt) {
- my $v = PublicInbox::Hval->new_msgid($irt);
+ my $v = PublicInbox::Hval->new_msgid($irt, 1);
my $html = $v->as_html;
my $href = $v->as_href;
$rv .= "In-Reply-To: <";
my $html = $v->as_html;
my $href = $v->as_href;
$rv .= "In-Reply-To: <";
foreach my $ref (@raw_refs) {
next if $seen{$ref};
$seen{$ref} = 1;
foreach my $ref (@raw_refs) {
next if $seen{$ref};
$seen{$ref} = 1;
- push @refs, linkify_ref($ref);
+ push @refs, linkify_ref_nosrch($ref);
my $upfx = $full_pfx ? '../' : '../../';
my $idx = $standalone ? " <a\nhref=\"$upfx\">index</a>" : '';
if ($idx && $srch) {
my $upfx = $full_pfx ? '../' : '../../';
my $idx = $standalone ? " <a\nhref=\"$upfx\">index</a>" : '';
if ($idx && $srch) {
- my $next = thread_inline(\$idx, $ctx, $mime, $full_pfx);
- $irt = in_reply_to($mime->header_obj);
- if (defined $irt) {
- $irt = PublicInbox::Hval->new_msgid($irt);
- $irt = $irt->as_href;
- $irt = "<a\nhref=\"$upfx$irt/\">parent</a> ";
+ my ($next, $p) = thread_inline(\$idx, $ctx, $mime, $full_pfx);
+ if (defined $p) {
+ $p = PublicInbox::Hval->new_oneline($p);
+ $p = $p->as_href;
+ $irt = "<a\nhref=\"$upfx$p/\">parent</a> ";
} else {
$irt = ' ' x length('parent ');
}
} else {
$irt = ' ' x length('parent ');
}
"$irt<a\nhref=\"" . ascii_html($href) . '">reply</a>' . $idx;
}
"$irt<a\nhref=\"" . ascii_html($href) . '">reply</a>' . $idx;
}
-sub linkify_ref {
- my $v = PublicInbox::Hval->new_msgid($_[0]);
+sub linkify_ref_nosrch {
+ my $v = PublicInbox::Hval->new_msgid($_[0], 1);
my $html = $v->as_html;
my $href = $v->as_href;
"<<a\nhref=\"../$href/\">$html</a>>";
my $html = $v->as_html;
my $href = $v->as_href;
"<<a\nhref=\"../$href/\">$html</a>>";
sub inline_dump {
my ($dst, $state, $upfx, $node, $level) = @_;
return unless $node;
sub inline_dump {
my ($dst, $state, $upfx, $node, $level) = @_;
return unless $node;
- return if $state->{stopped};
if (my $mime = $node->message) {
if (my $mime = $node->message) {
+ my $mid = mid_clean($mime->header('Message-ID'));
+ if ($mid eq $state->{parent_cmp}) {
+ $state->{parent} = $mid;
+ }
_inline_header($dst, $state, $upfx, $mime, $level);
}
inline_dump($dst, $state, $upfx, $node->child, $level+1);
_inline_header($dst, $state, $upfx, $mime, $level);
}
inline_dump($dst, $state, $upfx, $node->child, $level+1);