X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fmessage.cc;h=20b77580227b8c94a1b12b1a9e3cac050a2236ce;hp=2a4954dd59ce1d9c72fc0e2685459b730e79f699;hb=e4379c43e21ff69dcdb66064fe3de83ae0642fc0;hpb=d77c7cefe45d132bd38aa5bfd4dd2f7a624b090b diff --git a/lib/message.cc b/lib/message.cc index 2a4954dd..20b77580 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -501,6 +501,9 @@ _notmuch_message_add_filename (notmuch_message_t *message, * This change will not be reflected in the database until the next * call to _notmuch_message_sync. * + * If this message still has other filenames, returns + * NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID. + * * Note: This function does not remove a document from the database, * even if the specified filename is the only filename for this * message. For that functionality, see @@ -531,6 +534,8 @@ _notmuch_message_remove_filename (notmuch_message_t *message, "file-direntry", direntry); status = COERCE_STATUS (private_status, "Unexpected error from _notmuch_message_remove_term"); + if (status) + return status; /* Re-synchronize "folder:" terms for this message. This requires: * 1. removing all "folder:" terms @@ -588,6 +593,9 @@ _notmuch_message_remove_filename (notmuch_message_t *message, if (strncmp ((*i).c_str (), direntry_prefix, direntry_prefix_len)) break; + /* Indicate that there are filenames remaining. */ + status = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID; + direntry = (*i).c_str (); direntry += direntry_prefix_len; @@ -862,7 +870,7 @@ _notmuch_message_add_term (notmuch_message_t *message, /* Parse 'text' and add a term to 'message' for each parsed word. Each * term will be added both prefixed (if prefix_name is not NULL) and - * also unprefixed). */ + * also non-prefixed). */ notmuch_private_status_t _notmuch_message_gen_terms (notmuch_message_t *message, const char *prefix_name, @@ -1280,7 +1288,8 @@ notmuch_message_tags_to_maildir_flags (notmuch_message_t *message) new_status = _notmuch_message_remove_filename (message, filename); /* Hold on to only the first error. */ - if (! status && new_status) { + if (! status && new_status + && new_status != NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) { status = new_status; continue; }