diff options
| author | David Bremner <david@tethera.net> | 2017-08-19 22:07:26 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2017-08-29 21:56:21 -0300 |
| commit | 0a40ea4b48357c69de6456a305f75b7bda649c9d (patch) | |
| tree | 62ab00f970a01f0fb783f70d780a5d75a5fbeeae /lib | |
| parent | 8a8fb39b0c0199f224f4477cbcab2d7a578fee0f (diff) | |
lib: add notmuch_message_has_maildir_flag
I considered a higher level interface where the caller passes a tag
name rather than a flag character, but the role of the "unread" tag is
particularly confusing with such an interface.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/message.cc | 7 | ||||
| -rw-r--r-- | lib/notmuch.h | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/message.cc b/lib/message.cc index 75f36bdd..63d67cfe 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -1560,6 +1560,13 @@ _ensure_maildir_flags (notmuch_message_t *message, notmuch_bool_t force) message->maildir_flags = combined_flags; } +notmuch_bool_t +notmuch_message_has_maildir_flag (notmuch_message_t *message, char flag) +{ + _ensure_maildir_flags (message, FALSE); + return message->maildir_flags && (strchr (message->maildir_flags, flag) != NULL); +} + notmuch_status_t notmuch_message_maildir_flags_to_tags (notmuch_message_t *message) { diff --git a/lib/notmuch.h b/lib/notmuch.h index e025bc1f..66ecb5fc 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -1613,6 +1613,14 @@ notmuch_status_t notmuch_message_maildir_flags_to_tags (notmuch_message_t *message); /** + * return TRUE if any filename of 'message' has maildir flag 'flag', + * FALSE otherwise. + * + */ +notmuch_bool_t +notmuch_message_has_maildir_flag (notmuch_message_t *message, char flag); + +/** * Rename message filename(s) to encode tags as maildir flags. * * Specifically, for each filename corresponding to this message: |
