-# Copyright (C) 2015 all contributors <meta@public-inbox.org>
-# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
+# Copyright (C) 2015-2018 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# based on notmuch, but with no concept of folders, files or flags
#
# Indexes mail with Xapian and our (SQLite-based) ::Msgmap for use
# last References should be IRT, but some mail clients do things
# out of order, so trust IRT over References iff IRT exists
- my @refs = ($hdr->header_raw('References'),
- $hdr->header_raw('In-Reply-To'));
- @refs = ((join(' ', @refs)) =~ /<([^>]+)>/g);
+ my @refs = (($hdr->header_raw('References') || '') =~ /<([^>]+)>/g);
+ push(@refs, (($hdr->header_raw('In-Reply-To') || '') =~ /<([^>]+)>/g));
my $tid;
if (@refs) {
sub index_mm {
my ($self, $mime) = @_;
- $self->{mm}->mid_insert(mid_clean(mid_mime($mime)));
+ my $mid = mid_clean(mid_mime($mime));
+ my $mm = $self->{mm};
+ my $num = $mm->mid_insert($mid);
+
+ # fallback to num_for since filters like RubyLang set the number
+ defined $num ? $num : $mm->num_for($mid);
}
sub unindex_mm {