1 Return-Path: <stefan@datenfreihafen.org>
2 X-Original-To: notmuch@notmuchmail.org
3 Delivered-To: notmuch@notmuchmail.org
4 Received: from localhost (localhost [127.0.0.1])
5 by olra.theworths.org (Postfix) with ESMTP id 055BC431FBF
6 for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 16:11:31 -0800 (PST)
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
8 Received: from olra.theworths.org ([127.0.0.1])
9 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
10 with ESMTP id Vz+mNzdau2Gh for <notmuch@notmuchmail.org>;
11 Sat, 21 Nov 2009 16:11:30 -0800 (PST)
12 Received: from sirius.lasnet.de (sirius.lasnet.de [78.47.116.19])
13 by olra.theworths.org (Postfix) with ESMTP id CFD61431FAE
14 for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 16:11:29 -0800 (PST)
15 Received: from p5b034af6.dip.t-dialin.net ([91.3.74.246] helo=excalibur)
16 by sirius.lasnet.de with esmtpsa
17 (Cipher TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63 #1)
18 id 1NC032-0000td-2v by authid <stefan@sostec.de> with cram_md5;
19 Sun, 22 Nov 2009 01:11:28 +0100
20 Received: from stefan by excalibur with local (Exim 4.69)
21 (envelope-from <stefan@excalibur.local>)
22 id 1NC031-0001Dm-H7; Sun, 22 Nov 2009 01:11:23 +0100
23 From: Stefan Schmidt <stefan@datenfreihafen.org>
24 To: notmuch@notmuchmail.org
25 Date: Sun, 22 Nov 2009 01:11:01 +0100
26 Message-Id: <1258848661-4660-2-git-send-email-stefan@datenfreihafen.org>
27 X-Mailer: git-send-email 1.6.5.3
28 In-Reply-To: <1258848661-4660-1-git-send-email-stefan@datenfreihafen.org>
29 References: <yes> <1258848661-4660-1-git-send-email-stefan@datenfreihafen.org>
30 Subject: [notmuch] [PATCH 2/2] notmuch-new: Tag mails not as unread when the
31 seen flag in the maildir is set.
32 X-BeenThere: notmuch@notmuchmail.org
33 X-Mailman-Version: 2.1.12
35 List-Id: "Use and development of the notmuch mail system."
36 <notmuch.notmuchmail.org>
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
38 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
40 List-Post: <mailto:notmuch@notmuchmail.org>
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
43 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
44 X-List-Received-Date: Sun, 22 Nov 2009 00:11:31 -0000
46 With the new notmuch_message_get_flags() function we can get the information if
47 a message was already flagged as seen in maildir by another mailer or tool. This
48 gives a more realistic picture instead of flagging all as unread.
50 Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
53 notmuch-new.c | 16 +++++++++++++++-
54 2 files changed, 16 insertions(+), 2 deletions(-)
56 diff --git a/Makefile b/Makefile
57 index 3fedcf1..dfcfc70 100644
61 # Default FLAGS, (can be overridden by user such as "make CFLAGS=-O2")
62 WARN_FLAGS=-Wall -Wextra -Wmissing-declarations -Wwrite-strings -Wswitch-enum
66 # Additional flags that we will append to whatever the user set.
67 # These aren't intended for the user to manipulate.
68 diff --git a/notmuch-new.c b/notmuch-new.c
69 index bc35b4e..ef4429d 100644
72 @@ -41,8 +41,22 @@ handle_sigint (unused (int sig))
74 tag_inbox_and_unread (notmuch_message_t *message)
76 - notmuch_message_add_tag (message, "inbox");
80 + buf = notmuch_message_get_flags (message);
81 + for (i = 0; i < strlen (buf); i++) {
82 + /* If the S flag is set the message can be tagged as read */
83 + if (buf[i] == 'S') {
84 + notmuch_message_add_tag (message, "read");
89 notmuch_message_add_tag (message, "unread");
92 + notmuch_message_add_tag (message, "inbox");