]> git.notmuchmail.org Git - notmuch/blobdiff - lib/message.cc
lib: enforce that n_message_reindex takes headers from first file
[notmuch] / lib / message.cc
index 75f36bdda55fc193e71c91741c42c6d74fa47508..0e3b5a4f1510722729d60e73322baf2d529219bc 100644 (file)
@@ -1560,6 +1560,13 @@ _ensure_maildir_flags (notmuch_message_t *message, notmuch_bool_t force)
        message->maildir_flags = combined_flags;
 }
 
+notmuch_bool_t
+notmuch_message_has_maildir_flag (notmuch_message_t *message, char flag)
+{
+    _ensure_maildir_flags (message, FALSE);
+    return message->maildir_flags && (strchr (message->maildir_flags, flag) != NULL);
+}
+
 notmuch_status_t
 notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)
 {
@@ -2027,7 +2034,9 @@ notmuch_message_reindex (notmuch_message_t *message,
            thread_id = orig_thread_id;
 
        _notmuch_message_add_term (message, "thread", thread_id);
-       _notmuch_message_set_header_values (message, date, from, subject);
+       /* Take header values only from first filename */
+       if (found == 0)
+           _notmuch_message_set_header_values (message, date, from, subject);
 
        ret = _notmuch_message_index_file (message, message_file);