[PATCH 08/11] cli: add thread recipients to search output

Michal Sojka sojkam1 at fel.cvut.cz
Fri Aug 31 14:00:40 PDT 2012


On Mon, Aug 20 2012, Jameson Graef Rollins wrote:
> This adds a "--include-recipients" option to notmuch search.  With
> structured output formats (e.g. json), a new recipients field will be
> included that holds recipients of the thread.  Matched and non-matched
> recipients are delineated as with authors.
>
> As mentioned in the previous patch for the underlying lib functions,
> the need for the option is because message recipients are not stored
> in the database and therefore retrieving them adds a significant
> overhead.  If they were included, this option would not be necessary.
> ---
>  lib/notmuch.h    |    6 +++++-
>  lib/query.cc     |    5 +++--
>  notmuch-search.c |   14 +++++++++++---
>  notmuch-show.c   |    2 +-
>  test/json        |    1 -
>  5 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/lib/notmuch.h b/lib/notmuch.h
> index f9e71c1..8eb455e 100644
> --- a/lib/notmuch.h
> +++ b/lib/notmuch.h
> @@ -642,6 +642,9 @@ notmuch_threads_valid (notmuch_threads_t *threads);
>  
>  /* Get the current thread from 'threads' as a notmuch_thread_t.
>   *
> + * If the include_recipients flag is TRUE, thread recipients will be
> + * included in the returned thread object.
> + *
>   * Note: The returned thread belongs to 'threads' and has a lifetime
>   * identical to it (and the query to which it belongs).
>   *
> @@ -652,7 +655,8 @@ notmuch_threads_valid (notmuch_threads_t *threads);
>   * NULL.
>   */
>  notmuch_thread_t *
> -notmuch_threads_get (notmuch_threads_t *threads);
> +notmuch_threads_get (notmuch_threads_t *threads,
> +		     notmuch_bool_t include_recipients);

What about adding a new function notmuch_threds_get_with_recipients() to
not break public API? It would also make the sources more readable.

-M.


More information about the notmuch mailing list