aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-new.c
diff options
context:
space:
mode:
authorGravatar Michal Sojka <sojkam1@fel.cvut.cz>2010-10-31 22:29:16 +0100
committerGravatar Carl Worth <cworth@cworth.org>2010-11-10 13:09:31 -0800
commit088801a14ab1ccf4c65e5bf7b50b3a1172c477d7 (patch)
tree29f3dd8081ce1d9212080336ba73bd1574080ac2 /notmuch-new.c
parentb65a783195cb459a316370eb7a956b6029102f2e (diff)
Maildir synchronization
This patch allows bi-directional synchronization between maildir flags and certain tags. The flag-to-tag mapping is defined by flag2tag array. The synchronization works this way: 1) Whenever notmuch new is executed, the following happens: o New messages are tagged with configured new_tags. o For new or renamed messages with maildir info present in the file name, the tags defined in flag2tag are either added or removed depending on the flags from the file name. 2) Whenever notmuch tag (or notmuch restore) is executed, a new set of flags based on the tags is constructed for every message and a new file name is prepared based on the old file name but with the new flags. If the flags differs and the old message was in 'new' directory then this is replaced with 'cur' in the new file name. If the new and old file names differ, the file is renamed and notmuch database is updated accordingly. The rename happens before the database is updated. In case of crash between rename and database update, the next run of notmuch new brings the database in sync with the mail store again.
Diffstat (limited to 'notmuch-new.c')
-rw-r--r--notmuch-new.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/notmuch-new.c b/notmuch-new.c
index 8818728f..ed3f944f 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -410,10 +410,11 @@ add_files_recursive (notmuch_database_t *notmuch,
state->added_messages++;
for (tag=state->new_tags; *tag != NULL; tag++)
notmuch_message_add_tag (message, *tag);
+ notmuch_message_maildir_to_tags (message, next);
break;
/* Non-fatal issues (go on to next file) */
case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:
- /* Stay silent on this one. */
+ notmuch_message_maildir_to_tags (message, next);
break;
case NOTMUCH_STATUS_FILE_NOT_EMAIL:
fprintf (stderr, "Note: Ignoring non-mail file: %s\n",