unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Michal Sojka <sojkam1@fel.cvut.cz>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] Include 'unread' tag only to mails in new
Date: Sun, 21 Nov 2010 00:27:40 +0100	[thread overview]
Message-ID: <1290295660-1508-2-git-send-email-sojkam1@fel.cvut.cz> (raw)
In-Reply-To: <87pqtzk254.fsf@wsheee.2x.cz>

Ruben's previous patch fixed the problem that he experienced, but it
also caused the test "Removing info from filename leaves tags unchanged"
to fail. This is an attempt to make all tests to pass.

The Ruben's change is restricted to be only effective in 'new' directory.
---
 lib/message.cc |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/message.cc b/lib/message.cc
index 996c1df..e769bf5 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -905,6 +905,7 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)
     char *combined_flags = talloc_strdup (message, "");
     unsigned i;
     int seen_maildir_info = 0;
+    const char *dir;
 
     for (filenames = notmuch_message_get_filenames (message);
 	 notmuch_filenames_valid (filenames);
@@ -912,13 +913,17 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)
     {
 	filename = notmuch_filenames_get (filenames);
 
-	if (! _filename_is_in_maildir(filename))
+	dir = _filename_is_in_maildir(filename);
+	if (! dir)
 	    continue;
-	seen_maildir_info = 1;
+
+	if (STRNCMP_LITERAL (dir, "new/") == 0)
+	    seen_maildir_info = 1;
 
 	flags = strstr (filename, ":2,");
 	if (! flags)
 	    continue;
+	seen_maildir_info = 1;
 
 	flags += 3;
 
-- 
1.7.1.90.g94d6d4

  parent reply	other threads:[~2010-11-20 23:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 13:04 Maildir-flags synchronization now on master branch Carl Worth
2010-11-11 14:11 ` Kristoffer Ström
2010-11-11 22:38   ` Carl Worth
2010-11-12  0:43 ` Carl Worth
2010-11-12  1:43   ` Dirk Hohndel
2010-11-18 15:37 ` Ruben Pollan
2010-11-19 15:41   ` [PATCH] Including 'unread' tag to mails without maildir flags meskio
2010-11-20 23:26     ` Michal Sojka
2010-11-20 23:27       ` [PATCH 1/2] test: Add test for messages without maildir info in new Michal Sojka
2010-11-20 23:27       ` Michal Sojka [this message]
2010-11-22 10:43         ` [PATCH 2/2] Include 'unread' tag only to mails " Ruben Pollan
2010-11-20 23:54       ` [PATCH] Additional maildir-sync test Michal Sojka
2010-11-22 10:41         ` Ruben

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1290295660-1508-2-git-send-email-sojkam1@fel.cvut.cz \
    --to=sojkam1@fel.cvut.cz \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).