[PATCH v2 5/7] Introduce _notmuch_message_has_term()

David Bremner david at tethera.net
Tue Apr 5 19:04:57 PDT 2016


Daniel Kahn Gillmor <dkg at 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.



More information about the notmuch mailing list