From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id DED93429E34 for ; Thu, 17 Feb 2011 23:59:35 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JEzmBm1BMElj for ; Thu, 17 Feb 2011 23:59:35 -0800 (PST) Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU [18.7.68.35]) by olra.theworths.org (Postfix) with ESMTP id 80B83429E35 for ; Thu, 17 Feb 2011 23:59:27 -0800 (PST) X-AuditID: 12074423-b7bd0ae000000a00-c3-4d5e26df9711 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-6.mit.edu (Symantec Brightmail Gateway) with SMTP id 7C.BE.02560.FD62E5D4; Fri, 18 Feb 2011 02:59:27 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id p1I7xQEx007704; Fri, 18 Feb 2011 02:59:26 -0500 Received: from drake.mit.edu (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p1I7xP56001540 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Fri, 18 Feb 2011 02:59:26 -0500 (EST) Received: from amthrax by drake.mit.edu with local (Exim 4.72) (envelope-from ) id 1PqLFN-0008LH-L6; Fri, 18 Feb 2011 02:59:25 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 05/10] lib: Indicate if there are more filenames after removal. Date: Fri, 18 Feb 2011 02:58:55 -0500 Message-Id: <1298015940-31986-6-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1298015940-31986-1-git-send-email-amdragon@mit.edu> References: <1298015940-31986-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: AAAAAA== Cc: amdragon@mit.edu X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Feb 2011 07:59:36 -0000 Make _notmuch_message_remove_filename return NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID if the message has more filenames and fix callers to handle this. --- lib/message.cc | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 06747fe..635f5cf 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -480,6 +480,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 @@ -547,6 +550,10 @@ _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. */ + if (status == NOTMUCH_STATUS_SUCCESS) + status = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID; + direntry = (*i).c_str (); direntry += direntry_prefix_len; @@ -1235,7 +1242,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; } -- 1.7.2.3