[PATCH 2/2] Include 'unread' tag only to mails in new

Michal Sojka sojkam1 at fel.cvut.cz
Sat Nov 20 15:27:40 PST 2010


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



More information about the notmuch mailing list