[PATCH 4/4] lib: Treat messages in new/ as maildir messages with no flags set
Austin Clements
amdragon at MIT.EDU
Sun Jun 3 09:57:36 PDT 2012
This fixes the broken test added a few patches ago by synchronizing
the tags of messages in new/, even if they have no "info" part. See
the test patch for rationale.
---
lib/message.cc | 20 +++++++++++++-------
test/maildir-sync | 1 -
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/lib/message.cc b/lib/message.cc
index bbac2ff..978de06 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -1090,13 +1090,19 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message)
continue;
flags = strstr (filename, ":2,");
- if (! flags)
- continue;
-
- seen_maildir_info = 1;
- flags += 3;
-
- combined_flags = talloc_strdup_append (combined_flags, flags);
+ if (flags) {
+ seen_maildir_info = 1;
+ flags += 3;
+ combined_flags = talloc_strdup_append (combined_flags, flags);
+ } else if (STRNCMP_LITERAL (dir, "new/") == 0) {
+ /* Messages are delivered to new/ with no "info" part, but
+ * they effectively have default maildir flags. According
+ * to the spec, we should ignore the info part for
+ * messages in new/, but some MUAs (mutt) can set maildir
+ * flags on messages in new/, so we're liberal in what we
+ * accept. */
+ seen_maildir_info = 1;
+ }
}
/* If none of the filenames have any maildir info field (not even
diff --git a/test/maildir-sync b/test/maildir-sync
index 6360fd2..01348d3 100755
--- a/test/maildir-sync
+++ b/test/maildir-sync
@@ -167,7 +167,6 @@ notmuch tag +unread +draft -flagged subject:"Non-compliant maildir info"
test_expect_equal "$(cd $MAIL_DIR/cur/; ls non-compliant*)" "non-compliant-maildir-info:2,These-are-not-flags-in-ASCII-order-donottouch"
test_begin_subtest "Files in new/ get default synchronized tags"
-test_subtest_known_broken
OLDCONFIG=$(notmuch config get new.tags)
notmuch config set new.tags test
add_message [subject]='"File in new/"' [dir]=new [filename]='file-in-new'
--
1.7.10
More information about the notmuch
mailing list