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