X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Fdatabase.cc;h=553c9f823588d22f7ac96d162d2399fd63febc02;hb=1376a90db622b71e0997fca52c50ccf34faeed22;hp=7d09119cecddf54a94e34b8f2a9948ee203fbb85;hpb=6ca6c089e9df7affe6bee0392197509a24ab2546;p=notmuch diff --git a/lib/database.cc b/lib/database.cc index 7d09119c..553c9f82 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -843,7 +843,6 @@ notmuch_database_get_directory_mtime (notmuch_database_t *notmuch, notmuch_private_status_t status; const char *db_path = NULL; time_t ret = 0; - void *local = talloc_new (notmuch); db_path = directory_db_path (path); @@ -1188,23 +1187,24 @@ notmuch_database_add_message (notmuch_database_t *notmuch, goto DONE; } + _notmuch_message_add_filename (message, filename); + /* Is this a newly created message object? */ if (private_status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) { - _notmuch_message_set_filename (message, filename); _notmuch_message_add_term (message, "type", "mail"); - } else { - ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID; - goto DONE; - } - ret = _notmuch_database_link_message (notmuch, message, message_file); - if (ret) - goto DONE; + ret = _notmuch_database_link_message (notmuch, message, + message_file); + if (ret) + goto DONE; - date = notmuch_message_file_get_header (message_file, "date"); - _notmuch_message_set_date (message, date); + date = notmuch_message_file_get_header (message_file, "date"); + _notmuch_message_set_date (message, date); - _notmuch_message_index_file (message, filename); + _notmuch_message_index_file (message, filename); + } else { + ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID; + } _notmuch_message_sync (message); } catch (const Xapian::Error &error) {