X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-new.c;h=e011788da590a74433a526c5fe727e604be7db3e;hp=16b4d0225a649264c4931aba540be2b072842783;hb=0082a55785a5ae64da22fe72af6c0ae928f13c03;hpb=1307868f1e885fe5791a7c63ba33329eef405a80 diff --git a/notmuch-new.c b/notmuch-new.c index 16b4d022..e011788d 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -261,16 +261,22 @@ add_file (notmuch_database_t *notmuch, const char *filename, if (status) goto DONE; - status = notmuch_database_add_message (notmuch, filename, &message); + status = notmuch_database_index_file (notmuch, filename, NULL, &message); switch (status) { /* Success. */ 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). */