+# /$INBOX/$MSGID/d/ endpoint
+sub diff_msg {
+ my ($ctx) = @_;
+ require PublicInbox::MailDiff;
+ my $ibx = $ctx->{ibx};
+ my $over = $ibx->over or return no_over_html($ctx);
+ my ($id, $prev);
+ my $md = bless { ctx => $ctx }, 'PublicInbox::MailDiff';
+ my $next_arg = $md->{next_arg} = [ $ctx->{mid}, \$id, \$prev ];
+ my $smsg = $md->{smsg} = $over->next_by_mid(@$next_arg) or
+ return; # undef == 404
+ $ctx->{-t_max} = $smsg->{ts};
+ $ctx->{-upfx} = '../../';
+ $ctx->{-apfx} = '//'; # fail on to_attr()
+ $ctx->{-linkify} = PublicInbox::Linkify->new;
+ my $mid = ascii_html($smsg->{mid});
+ $ctx->{-title_html} = "diff for duplicates of <$mid>";
+ PublicInbox::WwwStream::html_init($ctx);
+ print { $ctx->{zfh} } '<pre>diff for duplicates of <<a href="../">',
+ $mid, "</a>>\n\n";
+ sub {
+ $ctx->attach($_[0]->([200, delete $ctx->{-res_hdr}]));
+ $md->begin_mail_diff;
+ };
+}
+