[notmuch] [PATCH 1/2] notmuch-show: Do not output (null) when the message body is empty
Sebastian Spaeth
Sebastian at SSpaeth.de
Tue Mar 2 02:52:32 PST 2010
Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
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
More information about the notmuch
mailing list