Re: [PATCH v2 5/7] Introduce _notmuch_message_has_term()
authorDavid Bremner <david@tethera.net>
Wed, 6 Apr 2016 02:04:57 +0000 (23:04 +2100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:21:30 +0000 (16:21 -0700)
cd/9b1c06fd0fa7437f1a457c4b2a1e5e963eaa5f [new file with mode: 0644]

diff --git a/cd/9b1c06fd0fa7437f1a457c4b2a1e5e963eaa5f b/cd/9b1c06fd0fa7437f1a457c4b2a1e5e963eaa5f
new file mode 100644 (file)
index 0000000..436535f
--- /dev/null
@@ -0,0 +1,85 @@
+Return-Path: <david@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id D2C246DE0243\r
+ for <notmuch@notmuchmail.org>; Tue,  5 Apr 2016 19:05:07 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.02\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.009,\r
+  SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id VKNs-ji5hHFV for <notmuch@notmuchmail.org>;\r
+ Tue,  5 Apr 2016 19:04:59 -0700 (PDT)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 6196F6DE01F7\r
+ for <notmuch@notmuchmail.org>; Tue,  5 Apr 2016 19:04:59 -0700 (PDT)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <david@tethera.net>)\r
+ id 1ancqa-0005cN-Jm; Tue, 05 Apr 2016 22:05:32 -0400\r
+Received: (nullmailer pid 22295 invoked by uid 1000);\r
+ Wed, 06 Apr 2016 02:04:57 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,\r
+ Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH v2 5/7] Introduce _notmuch_message_has_term()\r
+In-Reply-To: <1459606541-23889-5-git-send-email-dkg@fifthhorseman.net>\r
+References: <1459445693-3900-1-git-send-email-dkg@fifthhorseman.net>\r
+ <1459606541-23889-1-git-send-email-dkg@fifthhorseman.net>\r
+ <1459606541-23889-5-git-send-email-dkg@fifthhorseman.net>\r
+User-Agent: Notmuch/0.21+74~g6c60fb1 (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 05 Apr 2016 23:04:57 -0300\r
+Message-ID: <87pou3fq5y.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 06 Apr 2016 02:05:08 -0000\r
+\r
+Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:\r
+\r
+> It can be useful to easily tell if a given message has a given term\r
+> associated with it.\r
+> ---\r
+>  lib/message.cc        | 49 +++++++++++++++++++++++++++++++++++++++++++++++++\r
+>  lib/notmuch-private.h | 13 +++++++++++++\r
+>  2 files changed, 62 insertions(+)\r
+>\r
+> diff --git a/lib/message.cc b/lib/message.cc\r
+> index e414e9c..fab70fd 100644\r
+> --- a/lib/message.cc\r
+> +++ b/lib/message.cc\r
+> @@ -1216,6 +1216,55 @@ _notmuch_message_remove_term (notmuch_message_t *message,\r
+>      return NOTMUCH_PRIVATE_STATUS_SUCCESS;\r
+>  }\r
+>  \r
+> +notmuch_bool_t\r
+> +_notmuch_message_has_term (notmuch_message_t *message,\r
+> +                       const char *prefix_name,\r
+> +                       const char *value)\r
+> +{\r
+> +    notmuch_bool_t out;\r
+> +    notmuch_private_status_t st =\r
+> +    _notmuch_message_has_term_st (message, prefix_name, value, &out);\r
+> +    if (st)\r
+> +    return FALSE;\r
+> +    return out;\r
+> +}\r
+\r
+I second Tomi's unease with providing this interface; not having it\r
+would also allow dropping the _st from the other function.\r
+\r