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 9041E431FBD
\r
6 for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 15:23:59 -0800 (PST)
\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 LPmyJY0MksO8 for <notmuch@notmuchmail.org>;
\r
17 Sat, 15 Dec 2012 15:23:59 -0800 (PST)
\r
18 Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com
\r
19 [209.85.220.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 ECDCC431FB6
\r
22 for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 15:23:58 -0800 (PST)
\r
23 Received: by mail-pa0-f53.google.com with SMTP id hz1so2966461pad.26
\r
24 for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 15:23:58 -0800 (PST)
\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=tE75JGd2ikxQV9e93UiWLvzaZrmroKLjWoRJQIlgTps=;
\r
28 b=rHJQv51ixnSlZl246uK9aGdXzOtLFfIMVD8MavLCe0R2DyoTMNUSzSSE+qeaC8ldpP
\r
29 jd1SPel5OAeCXvBwisGRhq6cIjUtCy9gFVHPtneQvzHI68kEfA8KbAmYf0P0C49Tu7b/
\r
30 ju6vwToMrMzWGR6HWkdothUSkCc6CKhsHmXDhgCjrb7KKcbkK7y5/DbMG+GztzpKSH9U
\r
31 YADY3ZQnttE7OYvPEXmMtW4e3wfHbjew1IoB/uJ5NtF05yHZIju1KaDmlzRo87Nk6Lxv
\r
32 9DWse8NGtWuN4cSz9RyqljKfa2298HgT6wMmt4D8TjvxlvpOpzkSAKRx8NKDzbu7C0ec
\r
34 Received: by 10.68.134.130 with SMTP id pk2mr28716388pbb.31.1355613837222;
\r
35 Sat, 15 Dec 2012 15:23:57 -0800 (PST)
\r
36 Received: from localhost (215.42.233.220.static.exetel.com.au.
\r
38 by mx.google.com with ESMTPS id c2sm5697259pay.34.2012.12.15.15.23.54
\r
39 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Sat, 15 Dec 2012 15:23:56 -0800 (PST)
\r
41 From: Peter Wang <novalazy@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [PATCH v5b] show: indicate charset for all omitted parts
\r
44 Date: Sun, 16 Dec 2012 10:22:50 +1100
\r
45 Message-Id: <1355613770-3793-1-git-send-email-novalazy@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.12.1
\r
47 In-Reply-To: <1355540805-24937-3-git-send-email-novalazy@gmail.com>
\r
48 References: <1355540805-24937-3-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: Sat, 15 Dec 2012 23:23:59 -0000
\r
63 Write a "charset" field for all omitted parts for which it is applicable,
\r
64 not only text/html parts. Factor out the code to a separate function.
\r
65 It will be extended with more fields next.
\r
67 notmuch-show.c | 24 ++++++++++++++++--------
\r
68 1 file changed, 16 insertions(+), 8 deletions(-)
\r
70 diff --git a/notmuch-show.c b/notmuch-show.c
\r
71 index a83fef9..6a9278c 100644
\r
72 --- a/notmuch-show.c
\r
73 +++ b/notmuch-show.c
\r
74 @@ -599,6 +599,17 @@ format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
\r
75 return NOTMUCH_STATUS_SUCCESS;
\r
79 +format_omitted_part_meta_sprinter (sprinter_t *sp, GMimeObject *meta)
\r
81 + const char *content_charset = g_mime_object_get_content_type_parameter (meta, "charset");
\r
83 + if (content_charset != NULL) {
\r
84 + sp->map_key (sp, "content-charset");
\r
85 + sp->string (sp, content_charset);
\r
90 format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
\r
91 notmuch_bool_t first, notmuch_bool_t output_body)
\r
92 @@ -677,14 +688,9 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
\r
93 * makes charset decoding the responsibility on the caller, we
\r
94 * report the charset for text/html parts.
\r
96 - if (g_mime_content_type_is_type (content_type, "text", "html")) {
\r
97 - const char *content_charset = g_mime_object_get_content_type_parameter (meta, "charset");
\r
99 - if (content_charset != NULL) {
\r
100 - sp->map_key (sp, "content-charset");
\r
101 - sp->string (sp, content_charset);
\r
103 - } else if (g_mime_content_type_is_type (content_type, "text", "*")) {
\r
104 + if (g_mime_content_type_is_type (content_type, "text", "*") &&
\r
105 + ! g_mime_content_type_is_type (content_type, "text", "html"))
\r
107 GMimeStream *stream_memory = g_mime_stream_mem_new ();
\r
108 GByteArray *part_content;
\r
109 show_text_part_content (node->part, stream_memory, 0);
\r
110 @@ -692,6 +698,8 @@ format_part_sprinter (const void *ctx, sprinter_t *sp, mime_node_t *node,
\r
111 sp->map_key (sp, "content");
\r
112 sp->string_len (sp, (char *) part_content->data, part_content->len);
\r
113 g_object_unref (stream_memory);
\r
115 + format_omitted_part_meta_sprinter (sp, meta);
\r
117 } else if (GMIME_IS_MULTIPART (node->part)) {
\r
118 sp->map_key (sp, "content");
\r