From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id E87916DE111A for ; Sat, 19 Aug 2017 18:07:46 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.011, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Kq6w6_rSsZ6I for ; Sat, 19 Aug 2017 18:07:45 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id B1B866DE1105 for ; Sat, 19 Aug 2017 18:07:45 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1djEex-0004LE-RS; Sat, 19 Aug 2017 21:04:11 -0400 Received: (nullmailer pid 30246 invoked by uid 1000); Sun, 20 Aug 2017 01:07:40 -0000 From: David Bremner 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 Message-Id: <20170820010727.30117-3-david@tethera.net> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170820010727.30117-1-david@tethera.net> References: <20170820010727.30117-1-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 01:07:47 -0000 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