]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/OverIdx.pm
update copyrights for 2021
[public-inbox.git] / lib / PublicInbox / OverIdx.pm
index dcc2cff34a42128116374669d037384a96f407aa..0a4eb39e0a9d112260eb417c035846c5bac5e7e4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2018-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 # for XOVER, OVER in NNTP, and feeds/homepage/threads in PSGI
@@ -284,6 +284,8 @@ sub add_overview {
        $smsg->{lines} = $eml->body_raw =~ tr!\n!\n!;
        my $mids = mids_for_index($eml);
        my $refs = parse_references($smsg, $eml, $mids);
+       $mids->[0] //= $smsg->{mid} //= $eml->{-lei_fake_mid};
+       $smsg->{mid} //= '';
        my $subj = $smsg->{subject};
        my $xpath;
        if ($subj ne '') {
@@ -688,4 +690,14 @@ DELETE FROM eidxq WHERE docid = ?
 
 }
 
+sub blob_exists {
+       my ($self, $oidhex) = @_;
+       my $sth = $self->dbh->prepare_cached(<<'', undef, 1);
+SELECT COUNT(*) FROM xref3 WHERE oidbin = ?
+
+       $sth->bind_param(1, pack('H*', $oidhex), SQL_BLOB);
+       $sth->execute;
+       $sth->fetchrow_array;
+}
+
 1;