1 Return-Path: <jani@nikula.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id E6E976DE0C3A
\r
6 for <notmuch@notmuchmail.org>; Fri, 25 Sep 2015 13:49:20 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
10 X-Spam-Score: -0.528
\r
12 X-Spam-Status: No, score=-0.528 tagged_above=-999 required=5 tests=[AWL=0.192,
\r
13 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]
\r
15 Received: from arlo.cworth.org ([127.0.0.1])
\r
16 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id Sl77b-x0hywe for <notmuch@notmuchmail.org>;
\r
18 Fri, 25 Sep 2015 13:49:19 -0700 (PDT)
\r
19 Received: from mail-la0-f42.google.com (mail-la0-f42.google.com
\r
21 by arlo.cworth.org (Postfix) with ESMTPS id B5E316DE0C4A
\r
22 for <notmuch@notmuchmail.org>; Fri, 25 Sep 2015 13:49:11 -0700 (PDT)
\r
23 Received: by lacrr8 with SMTP id rr8so31609443lac.2
\r
24 for <notmuch@notmuchmail.org>; Fri, 25 Sep 2015 13:49:09 -0700 (PDT)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=1e100.net; s=20130820;
\r
27 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
28 :references:in-reply-to:references;
\r
29 bh=Hcd2BBXwMAtYuvsaAjNHAvemmryBrHYnZB4BlAjuSIE=;
\r
30 b=G9WdYX/Yzmb9MY/XWpsgeP8k6lfOKp/dMlvNLNRSbNVgwzmMhqyxvCJK0i/EiRfSvX
\r
31 173RkzeyBG4k+Ua27Bn0ikifPiGq6IEsuiEhuJXCkMotm4F6WMehs+pusmRetBM++IPi
\r
32 RnRf/fHt8uafbAO2D7X03jn7r1BHRi5LEaOJwisabNcNKTfvVOizFTZyiV4rnL6Awhb4
\r
33 if2nr5ttOZft9UOsC0/Jh0896I/GtVfV9U3p1PbD/7LQs+els7nSpvtBzxcokaXEspwb
\r
34 d3zDmjWuj2s5JDE4mYrUzinCbls2XqwK289CyeVgQzHLxjGxU5XmyUYZeehM4Cb3/lXk
\r
37 ALoCoQnEGX/B39Bko27qzAynzjieMMJ6qXHirr5YqmLquB37hZM3eZd4PXJfdr3HxL0lu8Pnmspx
\r
38 X-Received: by 10.25.210.206 with SMTP id j197mr1488122lfg.86.1443214149081;
\r
39 Fri, 25 Sep 2015 13:49:09 -0700 (PDT)
\r
40 Received: from localhost (mobile-access-bcee63-221.dhcp.inet.fi.
\r
42 by smtp.gmail.com with ESMTPSA id a140sm599484lfb.35.2015.09.25.13.49.08
\r
43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
44 Fri, 25 Sep 2015 13:49:08 -0700 (PDT)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: notmuch@notmuchmail.org
\r
47 Subject: [PATCH 2/3] lib: add interface to delete directory documents
\r
48 Date: Fri, 25 Sep 2015 23:48:45 +0300
\r
50 <a9303b1bb200dc529b3bdfa35dc8f9f7e603a06f.1443213654.git.jani@nikula.org>
\r
51 X-Mailer: git-send-email 2.1.4
\r
52 In-Reply-To: <cover.1443213654.git.jani@nikula.org>
\r
53 References: <cover.1443213654.git.jani@nikula.org>
\r
54 In-Reply-To: <cover.1443213654.git.jani@nikula.org>
\r
55 References: <cover.1443213654.git.jani@nikula.org>
\r
56 X-BeenThere: notmuch@notmuchmail.org
\r
57 X-Mailman-Version: 2.1.18
\r
59 List-Id: "Use and development of the notmuch mail system."
\r
60 <notmuch.notmuchmail.org>
\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
64 List-Post: <mailto:notmuch@notmuchmail.org>
\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
68 X-List-Received-Date: Fri, 25 Sep 2015 20:49:21 -0000
\r
72 commit acd66cdec075312944e527febd46382e54d99367
\r
73 Author: Jani Nikula <jani@nikula.org>
\r
74 Date: Sat Sep 5 12:35:31 2015 +0300
\r
76 cli: reset db directory mtime upon directory removal
\r
78 we don't have an interface to delete directory documents, and they're
\r
79 left behind. Add the interface.
\r
81 XXX: Should this also remove the files under it, or assume that's been
\r
82 done by the caller? Should this incorporate some or all of the
\r
83 functionality of _remove_directory() in notmuch-new.c?
\r
85 lib/directory.cc | 18 ++++++++++++++++++
\r
86 lib/notmuch.h | 7 +++++++
\r
87 2 files changed, 25 insertions(+)
\r
89 diff --git a/lib/directory.cc b/lib/directory.cc
\r
90 index b836ea2812c8..f23b71769aef 100644
\r
91 --- a/lib/directory.cc
\r
92 +++ b/lib/directory.cc
\r
93 @@ -281,6 +281,24 @@ notmuch_directory_get_child_directories (notmuch_directory_t *directory)
\r
94 return child_directories;
\r
98 +notmuch_directory_delete (notmuch_directory_t *directory)
\r
100 + notmuch_status_t status;
\r
101 + Xapian::WritableDatabase *db;
\r
103 + status = _notmuch_database_ensure_writable (directory->notmuch);
\r
107 + db = static_cast <Xapian::WritableDatabase *> (directory->notmuch->xapian_db);
\r
108 + db->delete_document (directory->document_id);
\r
110 + notmuch_directory_destroy (directory);
\r
112 + return NOTMUCH_STATUS_SUCCESS;
\r
116 notmuch_directory_destroy (notmuch_directory_t *directory)
\r
118 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
119 index 87756838d072..1feda4521e4d 100644
\r
120 --- a/lib/notmuch.h
\r
121 +++ b/lib/notmuch.h
\r
122 @@ -1720,6 +1720,13 @@ notmuch_filenames_t *
\r
123 notmuch_directory_get_child_directories (notmuch_directory_t *directory);
\r
126 + * Delete directory document from the database, and destroy the
\r
127 + * notmuch_directory_t object.
\r
130 +notmuch_directory_delete (notmuch_directory_t *directory);
\r
133 * Destroy a notmuch_directory_t object.
\r