[notmuch] [PATCH] notmuch-show: add tags to json output
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Mon, 1 Mar 2010 15:39:06 +0000 (16:39 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:18 +0000 (09:36 -0800)
94/ff4dda500b52da97d69b055055c35c7c55a13b [new file with mode: 0644]

diff --git a/94/ff4dda500b52da97d69b055055c35c7c55a13b b/94/ff4dda500b52da97d69b055055c35c7c55a13b
new file mode 100644 (file)
index 0000000..9147434
--- /dev/null
@@ -0,0 +1,74 @@
+Return-Path: <Sebastian@SSpaeth.de>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 39F4F431FC3\r
+       for <notmuch@notmuchmail.org>; Mon,  1 Mar 2010 07:39:19 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.139\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.139 tagged_above=-999 required=5\r
+       tests=[AWL=-0.029, BAYES_05=-1.11] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 94nOTcI0vkFM for <notmuch@notmuchmail.org>;\r
+       Mon,  1 Mar 2010 07:39:18 -0800 (PST)\r
+Received: from homiemail-a17.g.dreamhost.com (caiajhbdcaib.dreamhost.com\r
+       [208.97.132.81])\r
+       by olra.theworths.org (Postfix) with ESMTP id A32C4431FBD\r
+       for <notmuch@notmuchmail.org>; Mon,  1 Mar 2010 07:39:18 -0800 (PST)\r
+Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch\r
+       [129.132.133.204])\r
+       by homiemail-a17.g.dreamhost.com (Postfix) with ESMTPA id E54BC7A8069; \r
+       Mon,  1 Mar 2010 07:39:09 -0800 (PST)\r
+From: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
+To: notmuch@notmuchmail.org\r
+Date: Mon,  1 Mar 2010 16:39:06 +0100\r
+Message-Id: <1267457946-30347-1-git-send-email-Sebastian@SSpaeth.de>\r
+X-Mailer: git-send-email 1.6.3.3\r
+In-Reply-To: <87r5o49kow.fsf@SSpaeth.de>\r
+References: <87r5o49kow.fsf@SSpaeth.de>\r
+Subject: [notmuch] [PATCH] notmuch-show: add tags to json output\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 01 Mar 2010 15:39:19 -0000\r
+\r
+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 a space delimited list of json-encoded notmuch tags.\r
+\r
+Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
+---\r
+ notmuch-show.c |    5 +++--\r
+ 1 files changed, 3 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index 1a1d601..0f10797 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -138,10 +138,11 @@ format_message_json (const void *ctx, notmuch_message_t *message, unused (int in\r
+ {\r
+     void *ctx_quote = talloc_new (ctx);\r
\r
+-    printf ("\"id\": %s, \"match\": %s, \"filename\": %s",\r
++    printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"tags\": %s",\r
+           json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),\r
+           notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",\r
+-          json_quote_str (ctx_quote, notmuch_message_get_filename (message)));\r
++          json_quote_str (ctx_quote, notmuch_message_get_filename (message)),\r
++          json_quote_str (ctx_quote, _get_tags_as_string (ctx_quote, message)));\r
\r
+     talloc_free (ctx_quote);\r
+ }\r
+-- \r
+1.6.3.3\r
+\r