1 Return-Path: <pioto@pioto.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 olra.theworths.org (Postfix) with ESMTP id 51789431FBF
\r
6 for <notmuch@notmuchmail.org>; Fri, 26 Feb 2010 11:49:09 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.76 tagged_above=-999 required=5 tests=[AWL=-0.575,
\r
12 BAYES_40=-0.185] autolearn=ham
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id yyXrB9B6EJYY for <notmuch@notmuchmail.org>;
\r
16 Fri, 26 Feb 2010 11:49:08 -0800 (PST)
\r
17 Received: from everglades.pioto.org (everglades.pioto.org [207.192.69.249])
\r
18 by olra.theworths.org (Postfix) with ESMTP id B250F431FAE
\r
19 for <notmuch@notmuchmail.org>; Fri, 26 Feb 2010 11:49:08 -0800 (PST)
\r
20 Received: from aether.pioto.org (pool-96-236-149-110.pitbpa.fios.verizon.net
\r
21 [96.236.149.110]) (Authenticated sender: pioto)
\r
22 by everglades.pioto.org (Postfix) with ESMTPA id DA64B1603FC;
\r
23 Fri, 26 Feb 2010 14:49:03 -0500 (EST)
\r
24 Received: by aether.pioto.org (Postfix, from userid 1000)
\r
25 id 6E84B60344; Fri, 26 Feb 2010 14:49:56 -0500 (EST)
\r
26 From: Mike Kelly <pioto@pioto.org>
\r
27 To: notmuch@notmuchmail.org
\r
28 Date: Fri, 26 Feb 2010 14:49:26 -0500
\r
29 Message-Id: <1267213767-31255-2-git-send-email-pioto@pioto.org>
\r
30 X-Mailer: git-send-email 1.7.0
\r
31 In-Reply-To: <1267213767-31255-1-git-send-email-pioto@pioto.org>
\r
32 References: <1267213767-31255-1-git-send-email-pioto@pioto.org>
\r
33 Subject: [notmuch] [PATCH 1/2] Initial support for maildir flags.
\r
34 X-BeenThere: notmuch@notmuchmail.org
\r
35 X-Mailman-Version: 2.1.13
\r
37 List-Id: "Use and development of the notmuch mail system."
\r
38 <notmuch.notmuchmail.org>
\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
42 List-Post: <mailto:notmuch@notmuchmail.org>
\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
46 X-List-Received-Date: Fri, 26 Feb 2010 19:49:09 -0000
\r
48 When adding new messages, if they have the 'S' (seen) flag, do not add
\r
49 them to the 'unread' tag.
\r
51 lib/message.cc | 25 +++++++++++++++++++++++++
\r
52 lib/notmuch.h | 5 +++++
\r
53 notmuch-new.c | 3 ++-
\r
54 3 files changed, 32 insertions(+), 1 deletions(-)
\r
56 diff --git a/lib/message.cc b/lib/message.cc
\r
57 index f0e905b..61c9cc3 100644
\r
58 --- a/lib/message.cc
\r
59 +++ b/lib/message.cc
\r
60 @@ -516,6 +516,31 @@ notmuch_message_set_flag (notmuch_message_t *message,
\r
61 message->flags &= ~(1 << flag);
\r
65 +notmuch_message_md_flag (notmuch_message_t *message,
\r
68 + const char *filename;
\r
71 + filename = notmuch_message_get_filename (message);
\r
73 + p = strstr (filename, ":2,");
\r
75 + /* Not a valid maildir filename */
\r
79 + for (p += 3; *p != '\0'; p++) {
\r
90 notmuch_message_get_date (notmuch_message_t *message)
\r
92 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
93 index 15c9db4..db9e917 100644
\r
96 @@ -753,6 +753,11 @@ void
\r
97 notmuch_message_set_flag (notmuch_message_t *message,
\r
98 notmuch_message_flag_t flag, notmuch_bool_t value);
\r
100 +/* See if a given maildir flag is set, based on the message's filename. */
\r
102 +notmuch_message_md_flag (notmuch_message_t *message,
\r
103 + const char flag);
\r
105 /* Get the date of 'message' as a time_t value.
\r
107 * For the original textual representation of the Date header from the
\r
108 diff --git a/notmuch-new.c b/notmuch-new.c
\r
109 index b740ee2..6d62f3f 100644
\r
110 --- a/notmuch-new.c
\r
111 +++ b/notmuch-new.c
\r
112 @@ -97,7 +97,8 @@ static void
\r
113 tag_inbox_and_unread (notmuch_message_t *message)
\r
115 notmuch_message_add_tag (message, "inbox");
\r
116 - notmuch_message_add_tag (message, "unread");
\r
117 + if (! notmuch_message_md_flag(message, 'S'))
\r
118 + notmuch_message_add_tag (message, "unread");
\r