From: Sebastian Spaeth Date: Mon, 1 Mar 2010 16:12:14 +0000 (+0100) Subject: [notmuch] [PATCH] notmuch-show: Do not output (null) when the message body is empty X-Git-Url: http://git.tremily.us/?p=notmuch-archives.git;a=commitdiff_plain;h=b0f15533eb71f918dae54dc1ab207e09091575cc [notmuch] [PATCH] notmuch-show: Do not output (null) when the message body is empty --- diff --git a/7f/420d225d48a33deb2f4609536479bfcc3c1f64 b/7f/420d225d48a33deb2f4609536479bfcc3c1f64 new file mode 100644 index 000000000..a3b51680f --- /dev/null +++ b/7f/420d225d48a33deb2f4609536479bfcc3c1f64 @@ -0,0 +1,75 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id DBC45431FC3 + for ; Mon, 1 Mar 2010 08:12:26 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.162 +X-Spam-Level: +X-Spam-Status: No, score=-1.162 tagged_above=-999 required=5 + tests=[AWL=-0.052, BAYES_05=-1.11] autolearn=ham +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ZqiNiytRWRiK for ; + Mon, 1 Mar 2010 08:12:26 -0800 (PST) +Received: from homiemail-a12.g.dreamhost.com (caiajhbdccah.dreamhost.com + [208.97.132.207]) + by olra.theworths.org (Postfix) with ESMTP id 4F970431FBD + for ; Mon, 1 Mar 2010 08:12:26 -0800 (PST) +Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch + [129.132.133.204]) + by homiemail-a12.g.dreamhost.com (Postfix) with ESMTPA id B0DE3714060; + Mon, 1 Mar 2010 08:12:17 -0800 (PST) +From: Sebastian Spaeth +To: notmuch@notmuchmail.org +Date: Mon, 1 Mar 2010 17:12:14 +0100 +Message-Id: <1267459934-31815-1-git-send-email-Sebastian@SSpaeth.de> +X-Mailer: git-send-email 1.6.3.3 +In-Reply-To: <87tyt0owwv.fsf@SSpaeth.de> +References: <87tyt0owwv.fsf@SSpaeth.de> +Subject: [notmuch] [PATCH] notmuch-show: Do not output (null) when the + message body is empty +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 01 Mar 2010 16:12:27 -0000 + +Signed-off-by: Sebastian Spaeth +--- + notmuch-show.c | 8 +++++--- + 1 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/notmuch-show.c b/notmuch-show.c +index 0f10797..4c794c4 100644 +--- a/notmuch-show.c ++++ b/notmuch-show.c +@@ -310,10 +310,12 @@ format_part_json (GMimeObject *part, int *part_count) + if (g_mime_content_type_is_type (content_type, "text", "*") && + !g_mime_content_type_is_type (content_type, "text", "html")) + { +- show_part_content (part, stream_memory); ++ show_part_content (part, stream_memory); + part_content = g_mime_stream_mem_get_byte_array (GMIME_STREAM_MEM (stream_memory)); +- +- printf (", \"content\": %s", json_quote_str (ctx, (char *) part_content->data)); ++ if (part_content->data != NULL) ++ printf (", \"content\": %s", json_quote_str (ctx, (char *) part_content->data)); ++ else ++ printf (", \"content\": \"\""); + } + + fputs ("}", stdout); +-- +1.6.3.3 +