aboutsummaryrefslogtreecommitdiff
path: root/notmuch-new.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2017-08-19 22:07:27 -0300
committerDavid Bremner <david@tethera.net>2017-08-29 21:57:38 -0300
commit0082a55785a5ae64da22fe72af6c0ae928f13c03 (patch)
treed617879b55bae0291f468c87f4634622339f72ab /notmuch-new.c
parent0a40ea4b48357c69de6456a305f75b7bda649c9d (diff)
CLI/new: support maildir synced tags in new.tags
We reorder reading maildir flags to avoid overwriting 'new.tags'. The inverted status of 'unread' means the maildir flag needs to be checked a second time. I backpedalled here on the idea of supporting 'new.tags' without 'unread' in the presence of maildir syncing. For files in 'new/', it seems quite natural to tag them as 'unread'.
Diffstat (limited to 'notmuch-new.c')
-rw-r--r--notmuch-new.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/notmuch-new.c b/notmuch-new.c
index a4829327..e011788d 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -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). */