Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / b0 / 4d2e29426654f39054a763f4cc785ccac0221c
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
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.76\r
10 X-Spam-Level: \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
36 Precedence: list\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
47 \r
48 When adding new messages, if they have the 'S' (seen) flag, do not add\r
49 them to the 'unread' tag.\r
50 ---\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
55 \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
62  }\r
63  \r
64 +notmuch_bool_t\r
65 +notmuch_message_md_flag (notmuch_message_t *message,\r
66 +                        const char flag)\r
67 +{\r
68 +    const char *filename;\r
69 +    const char *p;\r
70 +\r
71 +    filename = notmuch_message_get_filename (message);\r
72 +\r
73 +    p = strstr (filename, ":2,");\r
74 +    if (p == NULL) {\r
75 +        /* Not a valid maildir filename */\r
76 +        return FALSE;\r
77 +    }\r
78 +\r
79 +    for (p += 3; *p != '\0'; p++) {\r
80 +        if (*p == flag) {\r
81 +            return TRUE;\r
82 +        }\r
83 +    }\r
84 +\r
85 +    return FALSE;\r
86 +}\r
87 +\r
88 +\r
89  time_t\r
90  notmuch_message_get_date (notmuch_message_t *message)\r
91  {\r
92 diff --git a/lib/notmuch.h b/lib/notmuch.h\r
93 index 15c9db4..db9e917 100644\r
94 --- a/lib/notmuch.h\r
95 +++ b/lib/notmuch.h\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
99  \r
100 +/* See if a given maildir flag is set, based on the message's filename. */\r
101 +notmuch_bool_t\r
102 +notmuch_message_md_flag (notmuch_message_t *message,\r
103 +                        const char flag);\r
104 +\r
105  /* Get the date of 'message' as a time_t value.\r
106   *\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
114  {\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
119  }\r
120  \r
121  static void\r
122 -- \r
123 1.7.0\r
124 \r