1 Return-Path: <amthrax@drake.mit.edu>
\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 2CE60431FBD
\r
6 for <notmuch@notmuchmail.org>; Thu, 22 Mar 2012 20:34:14 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id ncvPiQqky7pU for <notmuch@notmuchmail.org>;
\r
16 Thu, 22 Mar 2012 20:34:13 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id EC595431FAE
\r
20 for <notmuch@notmuchmail.org>; Thu, 22 Mar 2012 20:34:12 -0700 (PDT)
\r
21 X-AuditID: 1209190f-b7f8a6d000000914-fd-4f6bef33b9b2
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id B0.F8.02324.33FEB6F4; Thu, 22 Mar 2012 23:34:11 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q2N3YBL0025960;
\r
27 Thu, 22 Mar 2012 23:34:11 -0400
\r
28 Received: from drake.mit.edu
\r
29 (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
30 [209.6.116.242]) (authenticated bits=0)
\r
31 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
32 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q2N3Y8ZE007969
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Thu, 22 Mar 2012 23:34:10 -0400 (EDT)
\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.77)
\r
36 (envelope-from <amthrax@drake.mit.edu>)
\r
37 id 1SAvGS-0002PH-Ml; Thu, 22 Mar 2012 23:34:08 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 2/3] reply: Convert default reply format to self-recursive
\r
42 Date: Thu, 22 Mar 2012 23:34:06 -0400
\r
43 Message-Id: <1332473647-9133-3-git-send-email-amdragon@mit.edu>
\r
44 X-Mailer: git-send-email 1.7.7.3
\r
45 In-Reply-To: <1332473647-9133-1-git-send-email-amdragon@mit.edu>
\r
46 References: <1332473647-9133-1-git-send-email-amdragon@mit.edu>
\r
47 X-Brightmail-Tracker:
\r
48 H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsUixG6nrmv8PtvfYGW/vsX1mzOZHRg9nq26
\r
49 xRzAGMVlk5Kak1mWWqRvl8CVsf8YS8FWo4qrV++xNTBu0Oxi5OSQEDCR2HvtECuELSZx4d56
\r
50 ti5GLg4hgX2MEi83zGaCcDYwSnzed4MdwrnPJDH1xgWosvmMEku/tLOB9LMJaEhs27+cEcQW
\r
51 EZCW2Hl3NtBcDg5mATWJP10qIGFhgQCJ5v53bCBhFgFVieebDUHCvAL2EtOv7GKBuEJB4tzq
\r
52 c+wgNqeAg8TZz/fAJgoB1Wx98oV9AiP/AkaGVYyyKblVurmJmTnFqcm6xcmJeXmpRbomermZ
\r
53 JXqpKaWbGEEhwynJv4Px20GlQ4wCHIxKPLzNPtn+QqyJZcWVuYcYJTmYlER5Gd4BhfiS8lMq
\r
54 MxKLM+KLSnNSiw8xSnAwK4nwKjkD5XhTEiurUovyYVLSHCxK4rxqWu/8hATSE0tSs1NTC1KL
\r
55 YLIyHBxKEryTQIYKFqWmp1akZeaUIKSZODhBhvMADV8KUsNbXJCYW5yZDpE/xagoJc67BCQh
\r
56 AJLIKM2D64XF9CtGcaBXhHkXg1TxANMBXPcroMFMQIMnXMsCGVySiJCSamDUnx60LkPyYpXD
\r
57 jueJNf1Gl8QK53mu3qUw+/t+n7cy0Rf4a+vXf393ROqT+PPp++fJfJJrO3O+ps4twvhdQqBV
\r
58 4IL++IJtBy0a7Kxss2bLdh+fYN6QWO/jdu1dc2HLxXJ9ya9vrdfKTZ72NbBX+0hSz6usUiWO
\r
59 P049My2ab/C0zOiJkp9SyKrEUpyRaKjFXFScCABKPIbYxAIAAA==
\r
60 X-BeenThere: notmuch@notmuchmail.org
\r
61 X-Mailman-Version: 2.1.13
\r
63 List-Id: "Use and development of the notmuch mail system."
\r
64 <notmuch.notmuchmail.org>
\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
68 List-Post: <mailto:notmuch@notmuchmail.org>
\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
72 X-List-Received-Date: Fri, 23 Mar 2012 03:34:14 -0000
\r
74 This re-arranges the default reply formatter code to use the
\r
75 mime_node_t abstraction. There are no semantic changes.
\r
77 notmuch-reply.c | 119 +++++++++++++++++++++----------------------------------
\r
78 1 files changed, 45 insertions(+), 74 deletions(-)
\r
80 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
81 index 2f5ed3d..84a1220 100644
\r
82 --- a/notmuch-reply.c
\r
83 +++ b/notmuch-reply.c
\r
85 #include "gmime-filter-headers.h"
\r
88 -reply_headers_message_part (GMimeMessage *message);
\r
91 -reply_part_content (GMimeObject *part);
\r
93 -static const notmuch_show_format_t format_reply = {
\r
96 - "", NULL, reply_headers_message_part, ">\n",
\r
101 - reply_part_content,
\r
110 show_reply_headers (GMimeMessage *message)
\r
112 GMimeStream *stream_stdout = NULL, *stream_filter = NULL;
\r
113 @@ -65,66 +43,55 @@ show_reply_headers (GMimeMessage *message)
\r
117 -reply_headers_message_part (GMimeMessage *message)
\r
118 +format_part_reply (mime_node_t *node)
\r
120 - InternetAddressList *recipients;
\r
121 - const char *recipients_string;
\r
124 - printf ("> From: %s\n", g_mime_message_get_sender (message));
\r
125 - recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
\r
126 - recipients_string = internet_address_list_to_string (recipients, 0);
\r
127 - if (recipients_string)
\r
128 - printf ("> To: %s\n",
\r
129 - recipients_string);
\r
130 - recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_CC);
\r
131 - recipients_string = internet_address_list_to_string (recipients, 0);
\r
132 - if (recipients_string)
\r
133 - printf ("> Cc: %s\n",
\r
134 - recipients_string);
\r
135 - printf ("> Subject: %s\n", g_mime_message_get_subject (message));
\r
136 - printf ("> Date: %s\n", g_mime_message_get_date_as_string (message));
\r
138 + if (GMIME_IS_MESSAGE (node->part)) {
\r
139 + GMimeMessage *message = GMIME_MESSAGE (node->part);
\r
140 + InternetAddressList *recipients;
\r
141 + const char *recipients_string;
\r
143 + printf ("> From: %s\n", g_mime_message_get_sender (message));
\r
144 + recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
\r
145 + recipients_string = internet_address_list_to_string (recipients, 0);
\r
146 + if (recipients_string)
\r
147 + printf ("> To: %s\n",
\r
148 + recipients_string);
\r
149 + recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_CC);
\r
150 + recipients_string = internet_address_list_to_string (recipients, 0);
\r
151 + if (recipients_string)
\r
152 + printf ("> Cc: %s\n",
\r
153 + recipients_string);
\r
154 + printf ("> Subject: %s\n", g_mime_message_get_subject (message));
\r
155 + printf ("> Date: %s\n", g_mime_message_get_date_as_string (message));
\r
157 + } else if (GMIME_IS_PART (node->part)) {
\r
158 + GMimeContentType *content_type = g_mime_object_get_content_type (node->part);
\r
159 + GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (node->part);
\r
162 -reply_part_content (GMimeObject *part)
\r
164 - GMimeContentType *content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
\r
165 - GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (part);
\r
167 - if (g_mime_content_type_is_type (content_type, "multipart", "*") ||
\r
168 - g_mime_content_type_is_type (content_type, "message", "rfc822"))
\r
170 - /* Output nothing, since multipart subparts will be handled individually. */
\r
172 - else if (g_mime_content_type_is_type (content_type, "application", "pgp-encrypted") ||
\r
173 - g_mime_content_type_is_type (content_type, "application", "pgp-signature"))
\r
175 - /* Ignore PGP/MIME cruft parts */
\r
177 - else if (g_mime_content_type_is_type (content_type, "text", "*") &&
\r
178 - !g_mime_content_type_is_type (content_type, "text", "html"))
\r
180 - GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
\r
181 - g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
\r
182 - show_text_part_content (part, stream_stdout, NOTMUCH_SHOW_TEXT_PART_REPLY);
\r
183 - g_object_unref(stream_stdout);
\r
187 - if (disposition &&
\r
188 - strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
\r
190 - const char *filename = g_mime_part_get_filename (GMIME_PART (part));
\r
191 + if (g_mime_content_type_is_type (content_type, "application", "pgp-encrypted") ||
\r
192 + g_mime_content_type_is_type (content_type, "application", "pgp-signature")) {
\r
193 + /* Ignore PGP/MIME cruft parts */
\r
194 + } else if (g_mime_content_type_is_type (content_type, "text", "*") &&
\r
195 + !g_mime_content_type_is_type (content_type, "text", "html")) {
\r
196 + GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);
\r
197 + g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
\r
198 + show_text_part_content (node->part, stream_stdout, NOTMUCH_SHOW_TEXT_PART_REPLY);
\r
199 + g_object_unref(stream_stdout);
\r
200 + } else if (disposition &&
\r
201 + strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0) {
\r
202 + const char *filename = g_mime_part_get_filename (GMIME_PART (node->part));
\r
203 printf ("Attachment: %s (%s)\n", filename,
\r
204 g_mime_content_type_to_string (content_type));
\r
209 printf ("Non-text part: %s\n",
\r
210 g_mime_content_type_to_string (content_type));
\r
214 + for (i = 0; i < node->nchildren; i++)
\r
215 + format_part_reply (mime_node_child (node, i));
\r
218 /* Is the given address configured as one of the user's "personal" or
\r
219 @@ -550,7 +517,7 @@ notmuch_reply_format_default(void *ctx,
\r
220 GMimeMessage *reply;
\r
221 notmuch_messages_t *messages;
\r
222 notmuch_message_t *message;
\r
223 - const notmuch_show_format_t *format = &format_reply;
\r
224 + mime_node_t *root;
\r
226 for (messages = notmuch_query_search_messages (query);
\r
227 notmuch_messages_valid (messages);
\r
228 @@ -577,7 +544,11 @@ notmuch_reply_format_default(void *ctx,
\r
229 notmuch_message_get_header (message, "date"),
\r
230 notmuch_message_get_header (message, "from"));
\r
232 - show_message_body (message, format, params);
\r
233 + if (mime_node_open (ctx, message, params->cryptoctx, params->decrypt,
\r
234 + &root) == NOTMUCH_STATUS_SUCCESS) {
\r
235 + format_part_reply (mime_node_child (root, 0));
\r
236 + talloc_free (root);
\r
239 notmuch_message_destroy (message);
\r