1 Return-Path: <igor.contato@gmail.com>
\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 102026DE021D
\r
6 for <notmuch@notmuchmail.org>; Wed, 25 Nov 2015 18:16:54 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.801 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001,
\r
14 SPF_PASS=-0.001] autolearn=disabled
\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 MsVd5ov0_EZP for <notmuch@notmuchmail.org>;
\r
18 Wed, 25 Nov 2015 18:16:50 -0800 (PST)
\r
19 Received: from mail-qg0-f41.google.com (mail-qg0-f41.google.com
\r
21 by arlo.cworth.org (Postfix) with ESMTPS id 49A1E6DE18F2
\r
22 for <notmuch@notmuchmail.org>; Wed, 25 Nov 2015 18:16:50 -0800 (PST)
\r
23 Received: by qgea14 with SMTP id a14so45748138qge.0
\r
24 for <notmuch@notmuchmail.org>; Wed, 25 Nov 2015 18:16:49 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:cc:subject:date:message-id:in-reply-to:references;
\r
27 bh=/XitwozIVezmpJjXOJchGJm9LBEPzSd28ook1esCBOg=;
\r
28 b=T/52MbLPS0TDBoJsJ1sV3QcVOz6B+6EbridfKQYTwfDlNGo3iGH3UM4D9thR7UEDCu
\r
29 xwGLzYUEFQ9T5blknpbQNEcVVMYoTuk3/Y3fX8yjYhgJBl3UtjIj/Z8cu/wNK2J0sEKE
\r
30 MbHuFgArcgrSGAvx6ICxnLA+ZfiZcnx3B+bXaZpYDIKXRCOCkBOIwBcjCasgcKsn7UuW
\r
31 kNkZ5ChD8iL6aMnxxnX+mSrx0NwiIYwgh3u8+zP6jXzeYVxbwxOoLvlpYU0j/2Is5BdR
\r
32 sHsFKOOf+3I52rIC4lgsl7217+S7hHqa7FrwGaQcH+eaXxSv4b3zgC9bObWMQ9Ow2S+p
\r
34 X-Received: by 10.140.105.101 with SMTP id b92mr34664504qgf.5.1448504209256;
\r
35 Wed, 25 Nov 2015 18:16:49 -0800 (PST)
\r
36 Received: from arch-laptop.localdomain ([200.195.16.216])
\r
37 by smtp.gmail.com with ESMTPSA id h206sm1566011qhc.43.2015.11.25.18.16.47
\r
38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
\r
39 Wed, 25 Nov 2015 18:16:48 -0800 (PST)
\r
40 From: Igor Almeida <igor.contato@gmail.com>
\r
41 To: notmuch@notmuchmail.org
\r
42 Subject: [PATCH/RFC 1/3] David Bremner's patch for custom maildir flags
\r
43 Date: Wed, 25 Nov 2015 23:16:29 -0300
\r
44 Message-Id: <1448504191-30974-2-git-send-email-igor.contato@gmail.com>
\r
45 X-Mailer: git-send-email 2.5.3
\r
46 In-Reply-To: <1448504191-30974-1-git-send-email-igor.contato@gmail.com>
\r
47 References: <1448504191-30974-1-git-send-email-igor.contato@gmail.com>
\r
48 X-BeenThere: notmuch@notmuchmail.org
\r
49 X-Mailman-Version: 2.1.20
\r
51 List-Id: "Use and development of the notmuch mail system."
\r
52 <notmuch.notmuchmail.org>
\r
53 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
56 List-Post: <mailto:notmuch@notmuchmail.org>
\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
58 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
60 X-List-Received-Date: Thu, 26 Nov 2015 02:16:54 -0000
\r
63 lib/database.cc | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
64 lib/notmuch.h | 18 +++++++++++++++++
\r
65 2 files changed, 79 insertions(+)
\r
67 diff --git a/lib/database.cc b/lib/database.cc
\r
68 index 3b342f1..592cbcc 100644
\r
69 --- a/lib/database.cc
\r
70 +++ b/lib/database.cc
\r
71 @@ -1329,6 +1329,67 @@ notmuch_database_get_version (notmuch_database_t *notmuch)
\r
76 +notmuch_database_get_maildir_keyword (notmuch_database_t *notmuch,
\r
77 + int index, const char **tag)
\r
79 + string tag_string;
\r
83 + if (!notmuch || !tag)
\r
84 + return NOTMUCH_STATUS_NULL_POINTER;
\r
86 + if (index < 0 || index > ('z' - 'a'))
\r
87 + return NOTMUCH_STATUS_UNSUPPORTED_OPERATION;
\r
89 + key = talloc_asprintf(notmuch, "maildir_keyword_%c", 'a' + index);
\r
91 + return NOTMUCH_STATUS_OUT_OF_MEMORY;
\r
94 + tag_string = notmuch->xapian_db->get_metadata (key);
\r
95 + if (tag_string.empty ())
\r
96 + return NOTMUCH_STATUS_SUCCESS;
\r
98 + str = tag_string.c_str ();
\r
99 + if (str == NULL || *str == '\0')
\r
100 + return NOTMUCH_STATUS_SUCCESS;
\r
104 + return NOTMUCH_STATUS_SUCCESS;
\r
108 +notmuch_database_set_maildir_keyword (notmuch_database_t *notmuch,
\r
109 + int index, const char *tag)
\r
111 + string tag_string;
\r
113 + notmuch_status_t ret;
\r
114 + Xapian::WritableDatabase *db;
\r
116 + if (!notmuch || !tag)
\r
117 + return NOTMUCH_STATUS_NULL_POINTER;
\r
119 + ret = _notmuch_database_ensure_writable (notmuch);
\r
123 + if (index < 0 || index > ('z' - 'a'))
\r
124 + return NOTMUCH_STATUS_UNSUPPORTED_OPERATION;
\r
126 + key = talloc_asprintf(notmuch, "maildir_keyword_%c", 'a' + index);
\r
128 + return NOTMUCH_STATUS_OUT_OF_MEMORY;
\r
130 + db = static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db);
\r
131 + db->set_metadata (key, tag);
\r
133 + return NOTMUCH_STATUS_SUCCESS;
\r
137 notmuch_database_needs_upgrade (notmuch_database_t *notmuch)
\r
139 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
140 index 310a8b8..779a5ea 100644
\r
141 --- a/lib/notmuch.h
\r
142 +++ b/lib/notmuch.h
\r
143 @@ -674,6 +674,24 @@ notmuch_tags_t *
\r
144 notmuch_database_get_all_tags (notmuch_database_t *db);
\r
147 + * Return the tag corresponding to a maildir keyword.
\r
151 +notmuch_database_get_maildir_keyword(notmuch_database_t *db,
\r
152 + int index, const char **tag);
\r
155 + * Set the tag corresponding to a maildir keyword.
\r
157 + * Note that no messages have their tags modified by this call.
\r
161 +notmuch_database_set_maildir_keyword(notmuch_database_t *db,
\r
162 + int index, const char *tag);
\r
165 * Create a new query for 'database'.
\r
167 * Here, 'database' should be an open database, (see
\r