[PATCH 2/4] cli: show: implement --include-text-content for --format=text
authorMark Walters <markwalters1009@gmail.com>
Sun, 22 Jul 2012 14:37:57 +0000 (15:37 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:27 +0000 (09:48 -0800)
f3/a8a2782f75a5f4e57ee4a2bdddfc4dc365cc6c [new file with mode: 0644]

diff --git a/f3/a8a2782f75a5f4e57ee4a2bdddfc4dc365cc6c b/f3/a8a2782f75a5f4e57ee4a2bdddfc4dc365cc6c
new file mode 100644 (file)
index 0000000..42b7c11
--- /dev/null
@@ -0,0 +1,94 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id C0712431FBF\r
+       for <notmuch@notmuchmail.org>; Sun, 22 Jul 2012 07:38:16 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id AHn5qU65+sgx for <notmuch@notmuchmail.org>;\r
+       Sun, 22 Jul 2012 07:38:15 -0700 (PDT)\r
+Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com\r
+       [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 8E56D431FC9\r
+       for <notmuch@notmuchmail.org>; Sun, 22 Jul 2012 07:38:12 -0700 (PDT)\r
+Received: by wibhq4 with SMTP id hq4so1563921wib.2\r
+       for <notmuch@notmuchmail.org>; Sun, 22 Jul 2012 07:38:10 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=P9dJc6Kay0QjkSUAsLliRbt89YsJ/5H1sV2x72Xq5hs=;\r
+       b=or/iZib6cThKiOfbQAoyYscO52d008xT+6OfCDvMKmQyDcFeVatS8tHPVqfkpWvpL/\r
+       tlg8ulmRbny2NC2KWpUN0aa0lrDQrqfmQdFNYjdHEktHeq1pAnIxUc8TxfjOBq87Grz9\r
+       dhSQfkNrveFIM1yF0wk/cjQEZt0f9HR9coWaa+XjfLPEF2TBKAigt5fS1+aA2D7H68Go\r
+       OdcqffUXNmd2WysQy/OR0tKswOdLfU2HWCQTfQ9No226BMhhAmH4l9gJgviTKmwOkxlV\r
+       6RYEhwzSz52G13pZDhM2313yRsOC48Wgqz1Q3KRp4TcBXZS5yopq1MTtom3Z560mhz5v\r
+       EHzQ==\r
+Received: by 10.180.78.2 with SMTP id x2mr29027162wiw.10.1342967890815;\r
+       Sun, 22 Jul 2012 07:38:10 -0700 (PDT)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223])     by mx.google.com with ESMTPS id\r
+ fu3sm16706155wib.10.2012.07.22.07.38.09       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sun, 22 Jul 2012 07:38:09 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/4] cli: show: implement --include-text-content for\r
+       --format=text\r
+Date: Sun, 22 Jul 2012 15:37:57 +0100\r
+Message-Id: <1342967879-20453-3-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1342967879-20453-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1342967879-20453-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 22 Jul 2012 14:38:17 -0000\r
+\r
+---\r
+ notmuch-show.c |   13 +++++++++----\r
+ 1 files changed, 9 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index 35e3f22..6261b6d 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -537,11 +537,15 @@ format_part_text (const void *ctx, mime_node_t *node,\r
+       if (g_mime_content_type_is_type (content_type, "text", "*") &&\r
+           !g_mime_content_type_is_type (content_type, "text", "html"))\r
+       {\r
+-          GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);\r
+-          g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);\r
+-          show_text_part_content (node->part, stream_stdout, 0);\r
+-          g_object_unref(stream_stdout);\r
++          if (params->include_text_content) {\r
++              GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);\r
++              g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);\r
++              show_text_part_content (node->part, stream_stdout, 0);\r
++              g_object_unref(stream_stdout);\r
++          } else {\r
++              printf ("Text part (not included): %s\n",\r
++                      g_mime_content_type_to_string (content_type));\r
++          }\r
+       } else {\r
+           printf ("Non-text part: %s\n",\r
+                   g_mime_content_type_to_string (content_type));\r
+-- \r
+1.7.9.1\r
+\r