[PATCH 2/4] cli: show: implement --include-text-content for --format=text

Mark Walters markwalters1009 at gmail.com
Sun Jul 22 07:37:57 PDT 2012


---
 notmuch-show.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 35e3f22..6261b6d 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -537,11 +537,15 @@ format_part_text (const void *ctx, mime_node_t *node,
 	if (g_mime_content_type_is_type (content_type, "text", "*") &&
 	    !g_mime_content_type_is_type (content_type, "text", "html"))
 	{
-	    GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
-	    g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
-	    show_text_part_content (node->part, stream_stdout, 0);
-	    g_object_unref(stream_stdout);
+	    if (params->include_text_content) {
+		GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
+		g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
+		show_text_part_content (node->part, stream_stdout, 0);
+		g_object_unref(stream_stdout);
+	    } else {
+		printf ("Text part (not included): %s\n",
+			g_mime_content_type_to_string (content_type));
+	    }
 	} else {
 	    printf ("Non-text part: %s\n",
 		    g_mime_content_type_to_string (content_type));
-- 
1.7.9.1



More information about the notmuch mailing list