| Submitter | Fernando Herrera |
|---|---|
| Date | 2010-03-08 13:08:54 |
| Message ID | <121988a31003080508w313aee57g8d1b3dd048bbe375@mail.gmail.com> |
| Download | mbox | patch |
| Permalink | /patch/415/ |
| State | New |
| Headers | show |
Comments
On Mon, 8 Mar 2010 14:08:54 +0100, Fernando Herrera <fherrera@onirica.com> wrote: > 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). Hi, Fernando. I think a patch to fix this issue has already been submitted to the list: http://patchwork.notmuchmail.org/patch/406/ jamie.
On 2010-03-08, Sebastian Spaeth wrote: > On Mon, 8 Mar 2010 14:08:54 +0100, Fernando Herrera <fherrera@onirica.com> wrote: > > 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). > > Hi, Fernando. I think a patch to fix this issue has already been > submitted to the list: > > http://patchwork.notmuchmail.org/patch/406/ Hehe, and now the notmuch way to refer to the patch in mail id: 1267527153-8364-2-git-send-email-Sebastian@SSpaeth.de :-). Fernando's and my patch look remarkably similar (great minds think alike). And it would be nice to integrate either patch quickly, as this blocks my work on a notmuch web frontend. (well, it works with my local, patched notmuch but not with everyone's elses notmuch). spaetz
Patch
From 856a959360ade598d270af1ce7284b1c569589e1 Mon Sep 17 00:00:00 2001 From: Fernando Herrera <fherrera@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