1 Return-Path: <Sebastian@SSpaeth.de>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id BCB1E49F194
\r
6 for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 04:12:08 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.81 tagged_above=-999 required=5 tests=[AWL=-0.070,
\r
12 BAYES_20=-0.74] autolearn=ham
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id pk0wQQvwPJWp for <notmuch@notmuchmail.org>;
\r
16 Thu, 11 Mar 2010 04:12:08 -0800 (PST)
\r
17 Received: from homiemail-a22.g.dreamhost.com (caiajhbdccac.dreamhost.com
\r
19 by olra.theworths.org (Postfix) with ESMTP id EE2DF49F191
\r
20 for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 04:12:07 -0800 (PST)
\r
21 Received: from localhost.localdomain (unknown [84.55.211.9])
\r
22 by homiemail-a22.g.dreamhost.com (Postfix) with ESMTPA id 3776F1A805F;
\r
23 Thu, 11 Mar 2010 04:11:48 -0800 (PST)
\r
24 From: Sebastian Spaeth <Sebastian@SSpaeth.de>
\r
25 To: notmuch@notmuchmail.org
\r
26 Date: Thu, 11 Mar 2010 13:11:43 +0100
\r
27 Message-Id: <1268309504-4211-1-git-send-email-Sebastian@SSpaeth.de>
\r
28 X-Mailer: git-send-email 1.6.3.3
\r
29 In-Reply-To: <87vdd4zf6p.fsf@SSpaeth.de>
\r
30 References: <87vdd4zf6p.fsf@SSpaeth.de>
\r
31 Subject: [notmuch] [PATCH] notmuch-show: add tags to json output
\r
32 X-BeenThere: notmuch@notmuchmail.org
\r
33 X-Mailman-Version: 2.1.13
\r
35 List-Id: "Use and development of the notmuch mail system."
\r
36 <notmuch.notmuchmail.org>
\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
38 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
40 List-Post: <mailto:notmuch@notmuchmail.org>
\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
44 X-List-Received-Date: Thu, 11 Mar 2010 12:12:08 -0000
\r
46 The previous json patches forgot to add the notmuch tags to the json output. This is inconsistent to the text output so here they are. We just output a 'tags' field that sends notmuch tags as a json array.
\r
48 Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
\r
50 notmuch-show.c | 13 ++++++++++++-
\r
51 1 files changed, 12 insertions(+), 1 deletions(-)
\r
53 diff --git a/notmuch-show.c b/notmuch-show.c
\r
54 index f21914f..bf9e022 100644
\r
55 --- a/notmuch-show.c
\r
56 +++ b/notmuch-show.c
\r
57 @@ -136,13 +136,24 @@ format_message_text (unused (const void *ctx), notmuch_message_t *message, int i
\r
59 format_message_json (const void *ctx, notmuch_message_t *message, unused (int indent))
\r
61 + notmuch_tags_t *tags;
\r
63 void *ctx_quote = talloc_new (ctx);
\r
65 - printf ("\"id\": %s, \"match\": %s, \"filename\": %s",
\r
66 + printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"tags\": [",
\r
67 json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),
\r
68 notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",
\r
69 json_quote_str (ctx_quote, notmuch_message_get_filename (message)));
\r
71 + for (tags = notmuch_message_get_tags (message);
\r
72 + notmuch_tags_valid (tags);
\r
73 + notmuch_tags_move_to_next (tags))
\r
75 + printf("%s%s", first ? "" : ",",
\r
76 + json_quote_str (ctx_quote, notmuch_tags_get (tags)));
\r
80 talloc_free (ctx_quote);
\r