From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CD9971FAEF; Thu, 29 Mar 2018 10:28:31 +0000 (UTC) From: "Eric Wong (Contractor, The Linux Foundation)" To: meta@public-inbox.org Cc: "Eric Wong (Contractor, The Linux Foundation)" Subject: [PATCH 12/14] mbox: avoid extracting Message-ID for linkification Date: Thu, 29 Mar 2018 10:28:17 +0000 Message-Id: <20180329102819.15234-13-e@80x24.org> In-Reply-To: <20180329102819.15234-1-e@80x24.org> References: <20180329102819.15234-1-e@80x24.org> List-Id: We can avoid a small amount of overhead and use the "preferred" Message-ID based on what is in the SearchMsg object. --- lib/PublicInbox/Mbox.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm index 381bcad..1b68f02 100644 --- a/lib/PublicInbox/Mbox.pm +++ b/lib/PublicInbox/Mbox.pm @@ -92,7 +92,7 @@ sub emit_raw { } sub msg_str { - my ($ctx, $simple) = @_; # Email::Simple object + my ($ctx, $simple, $mid) = @_; # Email::Simple object my $header_obj = $simple->header_obj; # drop potentially confusing headers, ssoma already should've dropped @@ -102,7 +102,7 @@ sub msg_str { } my $ibx = $ctx->{-inbox}; my $base = $ibx->base_url($ctx->{env}); - my $mid = mid_clean($header_obj->header('Message-ID')); + $mid = $ctx->{mid} unless defined $mid; $mid = mid_escape($mid); my @append = ( 'Archived-At', "<$base$mid/>", @@ -225,7 +225,8 @@ sub getline { while (defined(my $smsg = shift @{$self->{msgs}})) { my $msg = eval { $ibx->msg_by_smsg($smsg) } or next; $msg = Email::Simple->new($msg); - $gz->write(PublicInbox::Mbox::msg_str($ctx, $msg)); + $gz->write(PublicInbox::Mbox::msg_str($ctx, $msg, + $smsg->mid)); # use subject of first message as subject if (my $hdr = delete $self->{hdr}) { -- EW