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 497E5431FBD for ; Tue, 2 Mar 2010 02:52:47 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.92 X-Spam-Level: X-Spam-Status: No, score=-1.92 tagged_above=-999 required=5 tests=[AWL=0.679, BAYES_00=-2.599] 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 r+DFvsQxsnM3 for ; Tue, 2 Mar 2010 02:52:46 -0800 (PST) Received: from homiemail-a13.g.dreamhost.com (caiajhbdcahe.dreamhost.com [208.97.132.74]) by olra.theworths.org (Postfix) with ESMTP id A6B61431FAE for ; Tue, 2 Mar 2010 02:52:46 -0800 (PST) Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch [129.132.133.204]) by homiemail-a13.g.dreamhost.com (Postfix) with ESMTPA id 1D25A6A8073; Tue, 2 Mar 2010 02:52:36 -0800 (PST) From: Sebastian Spaeth To: notmuch@notmuchmail.org Date: Tue, 2 Mar 2010 11:52:32 +0100 Message-Id: <1267527153-8364-1-git-send-email-Sebastian@SSpaeth.de> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <87k4twc5dh.fsf@servo.finestructure.net> References: <87k4twc5dh.fsf@servo.finestructure.net> Subject: [notmuch] [PATCH 1/2] 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: Tue, 02 Mar 2010 10:52:47 -0000 Signed-off-by: Sebastian Spaeth --- I actually agree that we should output tags as array, it was just that the get_tags_as_string function was already existing, so that was more convenient. Here comes the second iteration that outputs the tags as json array. notmuch-show.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index 1a1d601..f21914f 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -311,8 +311,10 @@ format_part_json (GMimeObject *part, int *part_count) { 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