]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/V2Writable.pm
filter/rubylang: fix SQLite DB lifetime problems
[public-inbox.git] / lib / PublicInbox / V2Writable.pm
index 07319646b1c1efd6a955cde6ad549eab6db5357e..93babed5511ab513866295346673195a6827c002 100644 (file)
@@ -163,6 +163,19 @@ sub num_for {
                        return if $existing;
                }
 
+               # AltId may pre-populate article numbers (e.g. X-Mail-Count
+               # or NNTP article number), use that article number if it's
+               # not in Over.
+               my $altid = $self->{-inbox}->{altid};
+               if ($altid && grep(/:file=msgmap\.sqlite3\z/, @$altid)) {
+                       my $num = $self->{mm}->num_for($mid);
+
+                       if (defined $num && !$self->{over}->get_art($num)) {
+                               $$mid0 = $mid;
+                               return $num;
+                       }
+               }
+
                # very unlikely:
                warn "<$mid> reused for mismatched content\n";