[notmuch] [PATCH] notmuch-show: Do not output (null) when the message body is empty
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Mon, 1 Mar 2010 16:12:14 +0000 (17:12 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:18 +0000 (09:36 -0800)
7f/420d225d48a33deb2f4609536479bfcc3c1f64 [new file with mode: 0644]

diff --git a/7f/420d225d48a33deb2f4609536479bfcc3c1f64 b/7f/420d225d48a33deb2f4609536479bfcc3c1f64
new file mode 100644 (file)
index 0000000..a3b5168
--- /dev/null
@@ -0,0 +1,75 @@
+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 DBC45431FC3\r
+       for <notmuch@notmuchmail.org>; Mon,  1 Mar 2010 08:12:26 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.162\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.162 tagged_above=-999 required=5\r
+       tests=[AWL=-0.052, 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 ZqiNiytRWRiK for <notmuch@notmuchmail.org>;\r
+       Mon,  1 Mar 2010 08:12:26 -0800 (PST)\r
+Received: from homiemail-a12.g.dreamhost.com (caiajhbdccah.dreamhost.com\r
+       [208.97.132.207])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4F970431FBD\r
+       for <notmuch@notmuchmail.org>; Mon,  1 Mar 2010 08:12:26 -0800 (PST)\r
+Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch\r
+       [129.132.133.204])\r
+       by homiemail-a12.g.dreamhost.com (Postfix) with ESMTPA id B0DE3714060; \r
+       Mon,  1 Mar 2010 08:12:17 -0800 (PST)\r
+From: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
+To: notmuch@notmuchmail.org\r
+Date: Mon,  1 Mar 2010 17:12:14 +0100\r
+Message-Id: <1267459934-31815-1-git-send-email-Sebastian@SSpaeth.de>\r
+X-Mailer: git-send-email 1.6.3.3\r
+In-Reply-To: <87tyt0owwv.fsf@SSpaeth.de>\r
+References: <87tyt0owwv.fsf@SSpaeth.de>\r
+Subject: [notmuch] [PATCH] notmuch-show: Do not output (null) when the\r
+       message body is empty\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 16:12:27 -0000\r
+\r
+Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
+---\r
+ notmuch-show.c |    8 +++++---\r
+ 1 files changed, 5 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index 0f10797..4c794c4 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -310,10 +310,12 @@ format_part_json (GMimeObject *part, int *part_count)\r
+     if (g_mime_content_type_is_type (content_type, "text", "*") &&\r
+       !g_mime_content_type_is_type (content_type, "text", "html"))\r
+     {\r
+-      show_part_content (part, stream_memory);\r
++        show_part_content (part, stream_memory);\r
+       part_content = g_mime_stream_mem_get_byte_array (GMIME_STREAM_MEM (stream_memory));\r
+-\r
+-      printf (", \"content\": %s", json_quote_str (ctx, (char *) part_content->data));\r
++      if (part_content->data != NULL)\r
++        printf (", \"content\": %s", json_quote_str (ctx, (char *) part_content->data));\r
++      else\r
++        printf (", \"content\": \"\"");\r
+     }\r
\r
+     fputs ("}", stdout);\r
+-- \r
+1.6.3.3\r
+\r