From 282bdd431bd6079f390f4c3f4423b7a524dac526 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 22 Jul 2012 15:37:57 +0100 Subject: [PATCH] [PATCH 2/4] cli: show: implement --include-text-content for --format=text --- f3/a8a2782f75a5f4e57ee4a2bdddfc4dc365cc6c | 94 +++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 f3/a8a2782f75a5f4e57ee4a2bdddfc4dc365cc6c diff --git a/f3/a8a2782f75a5f4e57ee4a2bdddfc4dc365cc6c b/f3/a8a2782f75a5f4e57ee4a2bdddfc4dc365cc6c new file mode 100644 index 000000000..42b7c11dd --- /dev/null +++ b/f3/a8a2782f75a5f4e57ee4a2bdddfc4dc365cc6c @@ -0,0 +1,94 @@ +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 C0712431FBF + for ; Sun, 22 Jul 2012 07:38:16 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +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 AHn5qU65+sgx for ; + Sun, 22 Jul 2012 07:38:15 -0700 (PDT) +Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com + [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 8E56D431FC9 + for ; Sun, 22 Jul 2012 07:38:12 -0700 (PDT) +Received: by wibhq4 with SMTP id hq4so1563921wib.2 + for ; Sun, 22 Jul 2012 07:38:10 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=P9dJc6Kay0QjkSUAsLliRbt89YsJ/5H1sV2x72Xq5hs=; + b=or/iZib6cThKiOfbQAoyYscO52d008xT+6OfCDvMKmQyDcFeVatS8tHPVqfkpWvpL/ + tlg8ulmRbny2NC2KWpUN0aa0lrDQrqfmQdFNYjdHEktHeq1pAnIxUc8TxfjOBq87Grz9 + dhSQfkNrveFIM1yF0wk/cjQEZt0f9HR9coWaa+XjfLPEF2TBKAigt5fS1+aA2D7H68Go + OdcqffUXNmd2WysQy/OR0tKswOdLfU2HWCQTfQ9No226BMhhAmH4l9gJgviTKmwOkxlV + 6RYEhwzSz52G13pZDhM2313yRsOC48Wgqz1Q3KRp4TcBXZS5yopq1MTtom3Z560mhz5v + EHzQ== +Received: by 10.180.78.2 with SMTP id x2mr29027162wiw.10.1342967890815; + Sun, 22 Jul 2012 07:38:10 -0700 (PDT) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + fu3sm16706155wib.10.2012.07.22.07.38.09 (version=TLSv1/SSLv3 cipher=OTHER); + Sun, 22 Jul 2012 07:38:09 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 2/4] cli: show: implement --include-text-content for + --format=text +Date: Sun, 22 Jul 2012 15:37:57 +0100 +Message-Id: <1342967879-20453-3-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1342967879-20453-1-git-send-email-markwalters1009@gmail.com> +References: <1342967879-20453-1-git-send-email-markwalters1009@gmail.com> +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: Sun, 22 Jul 2012 14:38:17 -0000 + +--- + 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 + -- 2.26.2