diff options
author | Michal Sojka <sojkam1@fel.cvut.cz> | 2010-10-31 22:29:16 +0100 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-11-10 13:09:31 -0800 |
commit | 088801a14ab1ccf4c65e5bf7b50b3a1172c477d7 (patch) | |
tree | 29f3dd8081ce1d9212080336ba73bd1574080ac2 /lib/notmuch.h | |
parent | b65a783195cb459a316370eb7a956b6029102f2e (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 'lib/notmuch.h')
-rw-r--r-- | lib/notmuch.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/notmuch.h b/lib/notmuch.h index 61c68d65..fe01e732 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -780,6 +780,7 @@ notmuch_message_get_filename (notmuch_message_t *message); /* Message flags */ typedef enum _notmuch_message_flag { NOTMUCH_MESSAGE_FLAG_MATCH, + NOTMUCH_MESSAGE_FLAG_TAGS_INVALID, } notmuch_message_flag_t; /* Get a value of a flag for the email corresponding to 'message'. */ @@ -896,6 +897,12 @@ notmuch_message_remove_tag (notmuch_message_t *message, const char *tag); notmuch_status_t notmuch_message_remove_all_tags (notmuch_message_t *message); +/* Add or remove tags based on the maildir flags in the file name. + */ +notmuch_status_t +notmuch_message_maildir_to_tags (notmuch_message_t *message, + const char *filename); + /* Freeze the current state of 'message' within the database. * * This means that changes to the message state, (via |