1 Return-Path: <novalazy@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id D7F8A431FC0
\r
6 for <notmuch@notmuchmail.org>; Sun, 5 Aug 2012 00:22:57 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id YPoJ4FswajM3 for <notmuch@notmuchmail.org>;
\r
17 Sun, 5 Aug 2012 00:22:56 -0700 (PDT)
\r
18 Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com
\r
19 [209.85.160.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id EC46A431FC9
\r
22 for <notmuch@notmuchmail.org>; Sun, 5 Aug 2012 00:22:52 -0700 (PDT)
\r
23 Received: by mail-pb0-f53.google.com with SMTP id ro8so3935886pbb.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 05 Aug 2012 00:22:52 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
27 bh=2r9napsdlhmpo6bzVYOfb4NhdMAwQsnGQhu3cVy1zHs=;
\r
28 b=AE+EsX9PYbv8ocarLfThTQoWmg3Lrn0MvBg+B6fiTgqdh/A7q9Kfnc+VgcuDd5Yb8c
\r
29 ng12jrNItoVA4oJGURFkgvouArBG/7Tw5la09ycNVT+7cBubQGBwLmkRwa7Lqy9W2ZhS
\r
30 qYPrtZMgUSzjW4t5zegBh3pLAL0mxCH6az//P7DuhmAJt7cTHoDKLH0n7JquFgPFnbyX
\r
31 JKfgQ81tN5iIMFKV30u+ksxAcL1foRIRKuTFQSJ3pvH3fYzTMGZinhKeyTTPUFXZyAIq
\r
32 WKbGhYHEZWM6N9el0vB7hOt7buBEOJlR0YM5G0YoAj7lgROubj/3/WolPGlGXmtMSXRN
\r
34 Received: by 10.66.75.74 with SMTP id a10mr9866871paw.46.1344151372775;
\r
35 Sun, 05 Aug 2012 00:22:52 -0700 (PDT)
\r
36 Received: from localhost (215.42.233.220.static.exetel.com.au.
\r
38 by mx.google.com with ESMTPS id sh3sm6413930pbc.16.2012.08.05.00.22.50
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Sun, 05 Aug 2012 00:22:52 -0700 (PDT)
\r
41 From: Peter Wang <novalazy@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH 3/4] show: indicate length of omitted body content (text)
\r
44 Date: Sun, 5 Aug 2012 17:22:24 +1000
\r
45 Message-Id: <1344151345-25411-3-git-send-email-novalazy@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.4.4
\r
47 In-Reply-To: <1344151345-25411-1-git-send-email-novalazy@gmail.com>
\r
48 References: <1344151345-25411-1-git-send-email-novalazy@gmail.com>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Sun, 05 Aug 2012 07:22:58 -0000
\r
63 If a leaf part's body content is omitted, return the content length in
\r
64 --format=text output, for parity with --format=json output.
\r
66 notmuch-show.c | 23 +++++++++++++++++++----
\r
67 1 files changed, 19 insertions(+), 4 deletions(-)
\r
69 diff --git a/notmuch-show.c b/notmuch-show.c
\r
70 index 5c54257..cde8a1e 100644
\r
71 --- a/notmuch-show.c
\r
72 +++ b/notmuch-show.c
\r
73 @@ -488,9 +488,17 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
\r
74 GMIME_OBJECT (node->envelope_part) : node->part;
\r
75 GMimeContentType *content_type = g_mime_object_get_content_type (meta);
\r
76 const notmuch_bool_t leaf = GMIME_IS_PART (node->part);
\r
77 + notmuch_bool_t leaf_text_part = FALSE;
\r
78 const char *part_type;
\r
82 + g_mime_content_type_is_type (content_type, "text", "*") &&
\r
83 + !g_mime_content_type_is_type (content_type, "text", "html"))
\r
85 + leaf_text_part = TRUE;
\r
88 if (node->envelope_file) {
\r
89 notmuch_message_t *message = node->envelope_file;
\r
91 @@ -519,7 +527,16 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
\r
92 printf (", Filename: %s", filename);
\r
94 printf (", Content-id: %s", cid);
\r
95 - printf (", Content-type: %s\n", g_mime_content_type_to_string (content_type));
\r
96 + printf (", Content-type: %s", g_mime_content_type_to_string (content_type));
\r
97 + if (leaf && !leaf_text_part) {
\r
98 + GMimeDataWrapper *wrapper = g_mime_part_get_content_object (GMIME_PART (node->part));
\r
99 + GMimeStream *stream = g_mime_data_wrapper_get_stream (wrapper);
\r
100 + ssize_t length = g_mime_stream_length (stream);
\r
101 + if (length >= 0) {
\r
102 + printf (", Content-length: %ld", length);
\r
108 if (GMIME_IS_MESSAGE (node->part)) {
\r
109 @@ -547,9 +564,7 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
\r
113 - if (g_mime_content_type_is_type (content_type, "text", "*") &&
\r
114 - !g_mime_content_type_is_type (content_type, "text", "html"))
\r
116 + if (leaf_text_part) {
\r
117 GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
\r
118 g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
\r
119 show_text_part_content (node->part, stream_stdout, 0);
\r