1 Return-Path: <bart@jukie.net>
\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 olra.theworths.org (Postfix) with ESMTP id BD926431FC2
\r
6 for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 20:55:20 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 Received: from olra.theworths.org ([127.0.0.1])
\r
9 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
10 with ESMTP id cXCnpuGYmDE3 for <notmuch@notmuchmail.org>;
\r
11 Tue, 24 Nov 2009 20:55:18 -0800 (PST)
\r
12 Received: from tau.jukie.net (tau.jukie.net [216.239.93.128])
\r
13 by olra.theworths.org (Postfix) with ESMTP id 67DE7431FBC
\r
14 for <notmuch@notmuchmail.org>; Tue, 24 Nov 2009 20:55:18 -0800 (PST)
\r
15 Received: from localhost.localdomain (oxygen.jukie.net [10.10.10.8])
\r
16 by tau.jukie.net (Postfix) with ESMTP id D1993C00F84;
\r
17 Tue, 24 Nov 2009 23:55:17 -0500 (EST)
\r
18 From: Bart Trojanowski <bart@jukie.net>
\r
19 To: notmuch@notmuchmail.org
\r
20 Date: Tue, 24 Nov 2009 23:54:33 -0500
\r
21 Message-Id: <1259124875-28212-2-git-send-email-bart@jukie.net>
\r
22 X-Mailer: git-send-email 1.6.4.4.2.gc2f148
\r
23 In-Reply-To: <1259124875-28212-1-git-send-email-bart@jukie.net>
\r
24 References: <1259124875-28212-1-git-send-email-bart@jukie.net>
\r
25 Cc: Bart Trojanowski <bart@jukie.net>
\r
26 Subject: [notmuch] [PATCH 1/3] message: add flags to notmuch_message_t
\r
27 X-BeenThere: notmuch@notmuchmail.org
\r
28 X-Mailman-Version: 2.1.12
\r
30 List-Id: "Use and development of the notmuch mail system."
\r
31 <notmuch.notmuchmail.org>
\r
32 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
33 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
34 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
35 List-Post: <mailto:notmuch@notmuchmail.org>
\r
36 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
37 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
38 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
39 X-List-Received-Date: Wed, 25 Nov 2009 04:55:21 -0000
\r
41 This patch allows for different flags, internal to notmuch, to be set on a
\r
42 message object. The patch does not define any such flags, just the
\r
43 facilities to manage these flags.
\r
45 Signed-off-by: Bart Trojanowski <bart@jukie.net>
\r
47 lib/message.cc | 19 +++++++++++++++++++
\r
48 lib/notmuch.h | 14 ++++++++++++++
\r
49 2 files changed, 33 insertions(+), 0 deletions(-)
\r
51 diff --git a/lib/message.cc b/lib/message.cc
\r
52 index 1e325e2..e0834f1 100644
\r
53 --- a/lib/message.cc
\r
54 +++ b/lib/message.cc
\r
55 @@ -37,6 +37,7 @@ struct _notmuch_message {
\r
57 notmuch_message_file_t *message_file;
\r
58 notmuch_message_list_t *replies;
\r
59 + unsigned long flags;
\r
61 Xapian::Document doc;
\r
63 @@ -108,6 +109,7 @@ _notmuch_message_create (const void *talloc_owner,
\r
64 message->doc_id = doc_id;
\r
66 message->frozen = 0;
\r
67 + message->flags = 0;
\r
69 /* Each of these will be lazily created as needed. */
\r
70 message->message_id = NULL;
\r
71 @@ -445,6 +447,23 @@ notmuch_message_get_filename (notmuch_message_t *message)
\r
72 return message->filename;
\r
76 +notmuch_message_get_flag (notmuch_message_t *message,
\r
77 + notmuch_message_flag_t flag)
\r
79 + return message->flags & (1 << flag);
\r
83 +notmuch_message_set_flag (notmuch_message_t *message,
\r
84 + notmuch_message_flag_t flag, notmuch_bool_t enable)
\r
87 + message->flags |= (1 << flag);
\r
89 + message->flags &= ~(1 << flag);
\r
93 notmuch_message_get_date (notmuch_message_t *message)
\r
95 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
96 index 8bba442..c232c58 100644
\r
99 @@ -684,6 +684,20 @@ notmuch_message_get_replies (notmuch_message_t *message);
\r
101 notmuch_message_get_filename (notmuch_message_t *message);
\r
103 +/* Message flags */
\r
104 +typedef enum _notmuch_message_flag {
\r
105 +} notmuch_message_flag_t;
\r
107 +/* Get a value of a flag for the email corresponding to 'message'. */
\r
109 +notmuch_message_get_flag (notmuch_message_t *message,
\r
110 + notmuch_message_flag_t flag);
\r
112 +/* Set a value of a flag for the email corresponding to 'message'. */
\r
114 +notmuch_message_set_flag (notmuch_message_t *message,
\r
115 + notmuch_message_flag_t flag, notmuch_bool_t value);
\r
117 /* Get the date of 'message' as a time_t value.
\r
119 * For the original textual representation of the Date header from the
\r