Hi all! First a quick presentation of myself as described in the mailing list subscription message: I am an old mutt user who loved its quick and clean interface. During the last years I have been trapped into gmail because of its great search capabilities and ubiquous web interface. Now with notmuch I got better search capabilities, and I only needed a web interface, so I started writing one for myself:
http://github.com/fherrera/notmuch-web Now the patch :) The attached patch includes tags as headers in the "notmuch show --format=json ..." output. The text output already shows tags in the one-line header, and I needed them to show specific tags for each message in the thread view of the webmail (if not included in the show output, I would need to do a web request per message to know its tags). Thanks! Salu2
From 856a959360ade598d270af1ce7284b1c569589e1 Mon Sep 17 00:00:00 2001 From: Fernando Herrera <fherr...@onirica.com> Date: Sun, 7 Mar 2010 16:17:33 +0100 Subject: [PATCH] Include tags in "notmuch show --format=json ..." --- notmuch-show.c | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index 1a1d601..9920a4c 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -168,23 +168,33 @@ format_headers_text (const void *ctx, notmuch_message_t *message) static void format_headers_json (const void *ctx, notmuch_message_t *message) { + notmuch_tags_t *tags; const char *headers[] = { "Subject", "From", "To", "Cc", "Bcc", "Date" }; const char *name, *value; unsigned int i; - int first_header = 1; + int first_tag = 1; void *ctx_quote = talloc_new (ctx); + printf ("%s: [", json_quote_str (ctx_quote, "tags")); + for (tags = notmuch_message_get_tags (message); + notmuch_tags_has_more (tags); + notmuch_tags_advance (tags)) + { + if (!first_tag) + fputs (", ", stdout); + printf ("%s", json_quote_str (ctx_quote, notmuch_tags_get (tags))); + first_tag = 0; + } + printf ("]"); + for (i = 0; i < ARRAY_SIZE (headers); i++) { name = headers[i]; value = notmuch_message_get_header (message, name); if (value) { - if (!first_header) - fputs (", ", stdout); - first_header = 0; - + fputs (", ", stdout); printf ("%s: %s", json_quote_str (ctx_quote, name), json_quote_str (ctx_quote, value)); -- 1.6.6.1
_______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch