Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id E0113429E2A for ; Thu, 17 Feb 2011 23:59:34 -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 htri53iIIwwO for ; Thu, 17 Feb 2011 23:59:34 -0800 (PST) Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU [18.7.68.37]) by olra.theworths.org (Postfix) with ESMTP id 1AB66429E34 for ; Thu, 17 Feb 2011 23:59:26 -0800 (PST) X-AuditID: 12074425-b7c98ae000000a04-36-4d5e26de92aa Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-8.mit.edu (Symantec Brightmail Gateway) with SMTP id 23.D7.02564.ED62E5D4; Fri, 18 Feb 2011 02:59:26 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id p1I7xPs7027138; Fri, 18 Feb 2011 02:59:25 -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 p1I7xOUe001537 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Fri, 18 Feb 2011 02:59:25 -0500 (EST) Received: from amthrax by drake.mit.edu with local (Exim 4.72) (envelope-from ) id 1PqLFM-0008LE-MG; Fri, 18 Feb 2011 02:59:24 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 04/10] lib: Make _notmuch_message_sync capable of deleting a message. Date: Fri, 18 Feb 2011 02:58:54 -0500 Message-Id: <1298015940-31986-5-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:35 -0000 --- lib/message.cc | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 0590f76..06747fe 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -29,6 +29,7 @@ struct _notmuch_message { notmuch_database_t *notmuch; Xapian::docid doc_id; int frozen; + notmuch_bool_t deleted; char *message_id; char *thread_id; char *in_reply_to; @@ -96,6 +97,7 @@ _notmuch_message_create_for_document (const void *talloc_owner, message->doc_id = doc_id; message->frozen = 0; + message->deleted = FALSE; message->flags = 0; /* Each of these will be lazily created as needed. */ @@ -765,7 +767,10 @@ _notmuch_message_sync (notmuch_message_t *message) return; db = static_cast (message->notmuch->xapian_db); - db->replace_document (message->doc_id, message->doc); + if (message->deleted) + db->delete_document (message->doc_id); + else + db->replace_document (message->doc_id, message->doc); } /* Ensure that 'message' is not holding any file object open. Future -- 1.7.2.3