]> git.notmuchmail.org Git - notmuch/commitdiff
lib: Treat messages in new/ as maildir messages with no flags set
authorAustin Clements <amdragon@MIT.EDU>
Sat, 9 Jun 2012 19:14:17 +0000 (15:14 -0400)
committerDavid Bremner <bremner@debian.org>
Sun, 10 Jun 2012 23:14:56 +0000 (20:14 -0300)
Previously, notmuch new only synchronized maildir flags to tags for
files with a maildir "info" part.  Since messages in new/ don't have
an info part, notmuch would ignore them for flag-to-tag
synchronization.

This patch makes notmuch consider messages in new/ to be legitimate
maildir messages that simply have no maildir flags set.  The most
visible effect of this is that such messages now automatically get the
unread tag.

lib/message.cc
test/maildir-sync

index bbac2ffaf87da987b1c7f05244ce1caf801831c1..978de066d4185ee991794bfad1f50140dd9424d6 100644 (file)
@@ -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
index 6360fd20e27d03d9eb865375fd864d6e87a42e09..01348d37d215e999bcb19f57ba32fdbae9a51eb8 100755 (executable)
@@ -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'