]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-new.c
CLI/new: support maildir synced tags in new.tags
[notmuch] / notmuch-new.c
index a4829327ddddc2e79e35d6b22faff2ec4351dea2..e011788da590a74433a526c5fe727e604be7db3e 100644 (file)
@@ -267,10 +267,16 @@ add_file (notmuch_database_t *notmuch, const char *filename,
     case NOTMUCH_STATUS_SUCCESS:
        state->added_messages++;
        notmuch_message_freeze (message);
-       for (tag = state->new_tags; *tag != NULL; tag++)
-           notmuch_message_add_tag (message, *tag);
        if (state->synchronize_flags)
            notmuch_message_maildir_flags_to_tags (message);
+
+       for (tag = state->new_tags; *tag != NULL; tag++) {
+           if (strcmp ("unread", *tag) !=0 ||
+               !notmuch_message_has_maildir_flag (message, 'S')) {
+               notmuch_message_add_tag (message, *tag);
+           }
+       }
+
        notmuch_message_thaw (message);
        break;
     /* Non-fatal issues (go on to next file). */