aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@mit.edu>2011-02-06 04:17:49 -0500
committerGravatar David Bremner <bremner@debian.org>2011-09-23 21:50:39 -0400
commite4379c43e21ff69dcdb66064fe3de83ae0642fc0 (patch)
treebbe39a2c1d31b2f40821f2ad2c7cc6a59bed6b74 /lib
parente59cc0031fbf84f49e32dedb9927f427d2c49309 (diff)
lib: Indicate if there are more filenames after removal.
Make _notmuch_message_remove_filename return NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID if the message has more filenames and fix callers to handle this.
Diffstat (limited to 'lib')
-rw-r--r--lib/message.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/message.cc b/lib/message.cc
index 424081f1..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
@@ -590,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;
@@ -1282,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;
}