X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fdatabase.cc;h=380bbe3daa66e9a878c084b6f1e7fc2b1ace1470;hp=414460d276b31f7df23895d51749540fc4876c47;hb=bb74e9dff80e64734308d5997c756fd96d041235;hpb=67c3bc9db48c9e12d648df4792c706cae723676c diff --git a/lib/database.cc b/lib/database.cc index 414460d2..380bbe3d 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -24,7 +24,6 @@ #include #include -#include #include /* g_free, GPtrArray, GHashTable */ @@ -1643,6 +1642,13 @@ notmuch_database_add_message (notmuch_database_t *notmuch, _notmuch_message_add_filename (message, filename); + /* This is a new message or it has a new filename and as such, + * its tags in database either do not exists or might be out + * of date. We assign the tags later in notmuch new, but until + * then we should not synchronize the tags back to the maildir + * flags (if notmuch is configured to do so). */ + notmuch_message_set_flag(message, NOTMUCH_MESSAGE_FLAG_TAGS_INVALID, TRUE); + /* Is this a newly created message object? */ if (private_status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) { _notmuch_message_add_term (message, "type", "mail"); @@ -1671,7 +1677,8 @@ notmuch_database_add_message (notmuch_database_t *notmuch, DONE: if (message) { - if (ret == NOTMUCH_STATUS_SUCCESS && message_ret) + if ((ret == NOTMUCH_STATUS_SUCCESS || + ret == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) && message_ret) *message_ret = message; else notmuch_message_destroy (message);