Re: [PATCH v2 5/7] Introduce _notmuch_message_has_term()

Subject: Re: [PATCH v2 5/7] Introduce _notmuch_message_has_term()

Date: Tue, 05 Apr 2016 23:04:57 -0300

To: Daniel Kahn Gillmor, Notmuch Mail

Cc:

From: David Bremner


Daniel Kahn Gillmor <dkg@fifthhorseman.net> 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.


Thread: