- my $mid = mid_clean($hdr->header_raw('Message-ID'));
-
- my $uuid = mid2path($mid);
- $uuid =~ tr!/!!d;
- my $h = '[a-f0-9]';
- my (@uuid5) = ($uuid =~ m!\A($h{8})($h{4})($h{4})($h{4})($h{12})!o);
- $uuid = 'urn:uuid:' . join('-', @uuid5);
-
- $mid = PublicInbox::Hval->new_msgid($mid);
- my $href = $ctx->{feed_base_url} . $mid->{href}. '/';
-
- my $date = $hdr->header('Date');
- my @t = eval { strptime($date) } if defined $date;
- @t = gmtime(time) unless scalar @t;
+ my $mid = $smsg->mid;
+ my $irt = PublicInbox::View::in_reply_to($hdr);
+ my $uuid = mid2uuid($mid);
+ my $base = $ctx->{feed_base_url};
+ if (defined $irt) {
+ my $irt_uuid = mid2uuid($irt);
+ $irt = mid_escape($irt);
+ $irt = qq(<thr:in-reply-to\nref="$irt_uuid"\n).
+ qq(href="$base$irt/"/>);
+ } else {
+ $irt = '';
+ }
+ my $href = $base . mid_escape($mid) . '/';
+ my $t = msg_timestamp($hdr);
+ my @t = gmtime(defined $t ? $t : time);