From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org, notmuch@freelists.org
Subject: [PATCH 2/3] lib: add notmuch_message_has_maildir_flag
Date: Sat, 19 Aug 2017 22:07:26 -0300 [thread overview]
Message-ID: <20170820010727.30117-3-david@tethera.net> (raw)
In-Reply-To: <20170820010727.30117-1-david@tethera.net>
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.
---
lib/message.cc | 7 +++++++
lib/notmuch.h | 8 ++++++++
2 files changed, 15 insertions(+)
diff --git a/lib/message.cc b/lib/message.cc
index 18f830dd..2efddb6c 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 f78b3473..b2c8e929 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -1589,6 +1589,14 @@ notmuch_status_t
notmuch_message_maildir_flags_to_tags (notmuch_message_t *message);
/**
+ * return TRUE if any filename in a maildir has the given 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:
--
2.13.2
next prev parent reply other threads:[~2017-08-20 1:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-20 1:07 fix for maildir synced tags in new.tags David Bremner
2017-08-20 1:07 ` [PATCH 1/3] lib/message: split n_m_maildir_flags_tags, store maildir flags David Bremner
2017-08-20 1:07 ` David Bremner [this message]
2017-08-20 1:07 ` [PATCH 3/3] CLI/new: support maildir synced tags in new.tags David Bremner
2017-08-30 23:30 ` fix for " David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170820010727.30117-3-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@freelists.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).