Re: [PATCH] Omit User-Agent: header by default
[notmuch-archives.git] / 0c / 8dbdf40dd7fc432916b1ee19491fd9d6e73320
1 Return-Path: <amdragon@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 53947431FBF\r
6         for <notmuch@notmuchmail.org>; Mon, 12 Aug 2013 11:41:08 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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 kJcCDtCiQTCL for <notmuch@notmuchmail.org>;\r
16         Mon, 12 Aug 2013 11:41:04 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id EDF75431FC0\r
20         for <notmuch@notmuchmail.org>; Mon, 12 Aug 2013 11:40:55 -0700 (PDT)\r
21 X-AuditID: 1209190f-b7fa58e000000953-9c-52092c37d165\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 0E.F0.02387.73C29025; Mon, 12 Aug 2013 14:40:55 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r7CIeqPe011680; \r
27         Mon, 12 Aug 2013 14:40:52 -0400\r
28 Received: from drake.dyndns.org (26-4-172.dynamic.csail.mit.edu [18.26.4.172])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7CIemcs003752\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Mon, 12 Aug 2013 14:40:50 -0400\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1V8x2u-0005yj-Oa; Mon, 12 Aug 2013 14:40:48 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH 6/6] reply: Use RFC 2822/MIME wholly for text format template\r
40 Date: Mon, 12 Aug 2013 14:40:39 -0400\r
41 Message-Id: <1376332839-22825-7-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10.4\r
43 In-Reply-To: <1376332839-22825-1-git-send-email-amdragon@mit.edu>\r
44 References: <1376332839-22825-1-git-send-email-amdragon@mit.edu>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=UTF-8\r
47 Content-Transfer-Encoding: 8bit\r
48 X-Brightmail-Tracker:\r
49  H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IRYrdT0TXX4Qwy+HVS2OL6zZnMDowez1bd\r
50         Yg5gjOKySUnNySxLLdK3S+DKaJ/TwVSwpJmxYk7bTpYGxkXZXYycHBICJhJn7lxghLDFJC7c\r
51         W8/WxcjFISSwj1Hi8JZPLCAJIYGNjBKbF1hAJI4wSTR1/GCCSMxllLj6yxHEZhPQkNi2fznY\r
52         JBEBaYmdd2ezdjFycDALqEn86VIBCQsLFEvMXHQJrIRFQFXiVsNKNhCbV8BB4vq11+wQRyhK\r
53         dD+bABbnFHCUuL/8HNQNDhIbd/UwQtQLSpyc+YQFYry6xPp5QiBhZgF5ieats5knMArNQlI1\r
54         C6FqFpKqBYzMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3RN9HIzS/RSU0o3MYICmFOSfwfjt4NK\r
55         hxgFOBiVeHgzPnIECbEmlhVX5h5ilORgUhLlnaTJGSTEl5SfUpmRWJwRX1Sak1p8iFGCg1lJ\r
56         hHcLK1CONyWxsiq1KB8mJc3BoiTO++zp2UAhgfTEktTs1NSC1CKYrAwHh5IEb782UKNgUWp6\r
57         akVaZk4JQpqJgxNkOA/Q8GaQGt7igsTc4sx0iPwpRl2OC70LPjEKseTl56VKifOmgBQJgBRl\r
58         lObBzYElnleM4kBvCfN2glTxAJMW3KRXQEuYgJYYNXOALClJREhJNTDOnabTaTKjq7LKctsr\r
59         ublTXyRJv3QKdej6zJ9jsuifs+COkrX/AitNNwV+sDeqkCg56cV/0nXtgr8HZmtXFvWaxbwO\r
60         CdZS67sY5np9F/PhHZo8T9ne1PE+7cxadOTcu7DDKqd+X9GfaTv5KUu57YegSCner5L32TYr\r
61         6Ff/OXsxdqen16P7Ag5KLMUZiYZazEXFiQBDGZQTFwMAAA==\r
62 X-BeenThere: notmuch@notmuchmail.org\r
63 X-Mailman-Version: 2.1.13\r
64 Precedence: list\r
65 List-Id: "Use and development of the notmuch mail system."\r
66         <notmuch.notmuchmail.org>\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
70 List-Post: <mailto:notmuch@notmuchmail.org>\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
74 X-List-Received-Date: Mon, 12 Aug 2013 18:41:08 -0000\r
75 \r
76 Previously, reply's default text format used an odd mix of RFC 2045\r
77 MIME encoding for the reply template's body and some made-up RFC\r
78 2822-like UTF-8 format for the headers.  The intent was to present the\r
79 headers to the user in a nice, un-encoded format, but this assumed\r
80 that whatever ultimately sent the email would RFC 2047-encode the\r
81 headers, while at the same time the body was already RFC 2045 encoded,\r
82 so it assumed that whatever sent the email would *not* re-encode the\r
83 body.\r
84 \r
85 This can be fixed by either producing a fully decoded UTF-8 reply\r
86 template, or a fully encoded MIME-compliant RFC 2822 message.  This\r
87 patch does the latter because it is\r
88 \r
89 a) Well-defined by RFC 2822 and MIME (while any UTF-8 format would be\r
90    ad hoc).\r
91 \r
92 b) Ready to be piped to sendmail.  The point of the text format is to\r
93    be minimal, so a user should be able to pop up the tmeplate in\r
94    whatever editor they want, edit it, and push it to sendmail.\r
95 \r
96 c) Consistent with how frontend capabilities.  If a frontend has the\r
97    smarts to RFC 2047 encode the headers before sending the mail, it\r
98    probably has the smarts to RFC 2047 decode them before presenting\r
99    the template to a user for editing.\r
100 \r
101 Also, as far as I know, nothing automated consumes the reply text\r
102 format, so changing this should not cause serious problems.  (And if\r
103 anything does still consume this format, it probably gets these\r
104 encoding issues wrong anyway.)\r
105 ---\r
106  Makefile.local           |    1 -\r
107  gmime-filter-headers.c   |  263 ----------------------------------------------\r
108  gmime-filter-headers.h   |   69 ------------\r
109  man/man1/notmuch-reply.1 |    2 +-\r
110  notmuch-reply.c          |   15 +--\r
111  test/reply               |    9 +-\r
112  test/reply-to-sender     |    4 +-\r
113  7 files changed, 12 insertions(+), 351 deletions(-)\r
114  delete mode 100644 gmime-filter-headers.c\r
115  delete mode 100644 gmime-filter-headers.h\r
116 \r
117 diff --git a/Makefile.local b/Makefile.local\r
118 index 84043fe..b7cd266 100644\r
119 --- a/Makefile.local\r
120 +++ b/Makefile.local\r
121 @@ -255,7 +255,6 @@ notmuch_client_srcs =               \\r
122         command-line-arguments.c\\r
123         debugger.c              \\r
124         gmime-filter-reply.c    \\r
125 -       gmime-filter-headers.c  \\r
126         hooks.c                 \\r
127         notmuch.c               \\r
128         notmuch-config.c        \\r
129 diff --git a/gmime-filter-headers.c b/gmime-filter-headers.c\r
130 deleted file mode 100644\r
131 index 7db3779..0000000\r
132 --- a/gmime-filter-headers.c\r
133 +++ /dev/null\r
134 @@ -1,263 +0,0 @@\r
135 -/*\r
136 - * Copyright © 2009 Keith Packard <keithp@keithp.com>\r
137 - * Copyright © 2010 Michal Sojka <sojkam1@fel.cvut.cz>\r
138 - *\r
139 - * This program is free software; you can redistribute it and/or modify\r
140 - * it under the terms of the GNU General Public License as published by\r
141 - * the Free Software Foundation, either version 3 of the License, or\r
142 - * (at your option) any later version.\r
143 - *\r
144 - * This program is distributed in the hope that it will be useful, but\r
145 - * WITHOUT ANY WARRANTY; without even the implied warranty of\r
146 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
147 - * General Public License for more details.\r
148 - *\r
149 - * You should have received a copy of the GNU General Public License along\r
150 - * with this program; if not, write to the Free Software Foundation, Inc.,\r
151 - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.\r
152 - */\r
153 -\r
154 -#include "gmime-filter-headers.h"\r
155 -#include <string.h>\r
156 -#include <gmime/gmime-utils.h>\r
157 -#include <glib/gprintf.h>\r
158 -#include <stdlib.h>\r
159 -#include <xutil.h>\r
160 -\r
161 -/**\r
162 - * SECTION: gmime-filter-headers\r
163 - * @title: GMimeFilterHeaders\r
164 - * @short_description: Add/remove headers markers\r
165 - *\r
166 - * A #GMimeFilter for decoding rfc2047 encoded headers to UTF-8\r
167 - **/\r
168 -\r
169 -\r
170 -static void g_mime_filter_headers_class_init (GMimeFilterHeadersClass *klass);\r
171 -static void g_mime_filter_headers_init (GMimeFilterHeaders *filter, GMimeFilterHeadersClass *klass);\r
172 -static void g_mime_filter_headers_finalize (GObject *object);\r
173 -\r
174 -static GMimeFilter *filter_copy (GMimeFilter *filter);\r
175 -static void filter_filter (GMimeFilter *filter, char *in, size_t len, size_t prespace,\r
176 -                          char **out, size_t *outlen, size_t *outprespace);\r
177 -static void filter_complete (GMimeFilter *filter, char *in, size_t len, size_t prespace,\r
178 -                            char **out, size_t *outlen, size_t *outprespace);\r
179 -static void filter_reset (GMimeFilter *filter);\r
180 -\r
181 -\r
182 -static GMimeFilterClass *parent_class = NULL;\r
183 -\r
184 -GType\r
185 -g_mime_filter_headers_get_type (void)\r
186 -{\r
187 -       static GType type = 0;\r
188 -\r
189 -       if (!type) {\r
190 -               static const GTypeInfo info = {\r
191 -                       sizeof (GMimeFilterHeadersClass),\r
192 -                       NULL, /* base_class_init */\r
193 -                       NULL, /* base_class_finalize */\r
194 -                       (GClassInitFunc) g_mime_filter_headers_class_init,\r
195 -                       NULL, /* class_finalize */\r
196 -                       NULL, /* class_data */\r
197 -                       sizeof (GMimeFilterHeaders),\r
198 -                       0,    /* n_preallocs */\r
199 -                       (GInstanceInitFunc) g_mime_filter_headers_init,\r
200 -                       NULL    /* value_table */\r
201 -               };\r
202 -\r
203 -               type = g_type_register_static (GMIME_TYPE_FILTER, "GMimeFilterHeaders", &info, (GTypeFlags) 0);\r
204 -       }\r
205 -\r
206 -       return type;\r
207 -}\r
208 -\r
209 -\r
210 -static void\r
211 -g_mime_filter_headers_class_init (GMimeFilterHeadersClass *klass)\r
212 -{\r
213 -       GObjectClass *object_class = G_OBJECT_CLASS (klass);\r
214 -       GMimeFilterClass *filter_class = GMIME_FILTER_CLASS (klass);\r
215 -\r
216 -       parent_class = (GMimeFilterClass *) g_type_class_ref (GMIME_TYPE_FILTER);\r
217 -\r
218 -       object_class->finalize = g_mime_filter_headers_finalize;\r
219 -\r
220 -       filter_class->copy = filter_copy;\r
221 -       filter_class->filter = filter_filter;\r
222 -       filter_class->complete = filter_complete;\r
223 -       filter_class->reset = filter_reset;\r
224 -}\r
225 -\r
226 -static void\r
227 -g_mime_filter_headers_init (GMimeFilterHeaders *filter, GMimeFilterHeadersClass *klass)\r
228 -{\r
229 -       (void) klass;\r
230 -       filter->saw_nl = TRUE;\r
231 -       filter->line = NULL;\r
232 -       filter->line_size = 0;\r
233 -       filter->lineptr = NULL;\r
234 -}\r
235 -\r
236 -static void\r
237 -g_mime_filter_headers_finalize (GObject *object)\r
238 -{\r
239 -       free (GMIME_FILTER_HEADERS (object)->line);\r
240 -       G_OBJECT_CLASS (parent_class)->finalize (object);\r
241 -}\r
242 -\r
243 -\r
244 -static GMimeFilter *\r
245 -filter_copy (GMimeFilter *filter)\r
246 -{\r
247 -       (void) filter;\r
248 -       return g_mime_filter_headers_new ();\r
249 -}\r
250 -\r
251 -static void\r
252 -output_decoded_header (GMimeFilterHeaders *headers, char **outptr)\r
253 -{\r
254 -       char *colon, *name, *s, *decoded_value;\r
255 -       size_t offset;\r
256 -       gint ret;\r
257 -\r
258 -       colon = strchr (headers->line, ':');\r
259 -       if (colon == NULL)\r
260 -               return;\r
261 -\r
262 -       name = headers->line;\r
263 -       *colon = '\0';\r
264 -       s = colon + 1;\r
265 -       while (*s == ' ' || *s == '\t')\r
266 -               s++;\r
267 -       decoded_value = g_mime_utils_header_decode_text(s);\r
268 -       if (decoded_value == NULL)\r
269 -               return;\r
270 -       offset = *outptr - GMIME_FILTER (headers)->outbuf;\r
271 -       g_mime_filter_set_size (GMIME_FILTER (headers), strlen(name) + 2 +\r
272 -                              strlen(decoded_value) + 2, TRUE);\r
273 -       *outptr = GMIME_FILTER (headers)->outbuf + offset;\r
274 -       ret = g_sprintf (*outptr, "%s: %s\n", name, decoded_value);\r
275 -       if (ret > 0)\r
276 -               *outptr += ret;\r
277 -       free (decoded_value);\r
278 -}\r
279 -\r
280 -static void\r
281 -output_final_newline (GMimeFilterHeaders *headers, char **outptr)\r
282 -{\r
283 -       size_t offset;\r
284 -\r
285 -       offset = *outptr - GMIME_FILTER (headers)->outbuf;\r
286 -       g_mime_filter_set_size (GMIME_FILTER (headers), 1, TRUE);\r
287 -       *outptr = GMIME_FILTER (headers)->outbuf + offset;\r
288 -       *(*outptr)++ = '\n';\r
289 -}\r
290 -\r
291 -static void\r
292 -filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,\r
293 -              char **outbuf, size_t *outlen, size_t *outprespace)\r
294 -{\r
295 -       GMimeFilterHeaders *headers = (GMimeFilterHeaders *) filter;\r
296 -       register const char *inptr = inbuf;\r
297 -       const char *inend = inbuf + inlen;\r
298 -       char *lineptr, *lineend, *outptr;\r
299 -\r
300 -       (void) prespace;\r
301 -       if (headers->line == NULL) {\r
302 -               headers->line_size = 200;\r
303 -               headers->lineptr = headers->line = malloc (headers->line_size);\r
304 -       }\r
305 -       lineptr = headers->lineptr;\r
306 -       lineend = headers->line + headers->line_size - 1;\r
307 -       if (lineptr == NULL)\r
308 -               return;\r
309 -       outptr = filter->outbuf;\r
310 -       while (inptr < inend) {\r
311 -               if (*inptr == '\n') {\r
312 -                       if (headers->saw_nl)\r
313 -                               output_final_newline(headers, &outptr);\r
314 -                       headers->saw_nl = TRUE;\r
315 -                       inptr++;\r
316 -                       continue;\r
317 -               }\r
318 -\r
319 -               if (lineptr == lineend) {\r
320 -                       headers->line_size *= 2;\r
321 -                       headers->line = xrealloc (headers->line, headers->line_size);\r
322 -                       lineptr = headers->line + (headers->line_size / 2) - 1;\r
323 -                       lineend = headers->line + headers->line_size - 1;\r
324 -               }\r
325 -\r
326 -               if (headers->saw_nl && *inptr != ' ' && *inptr != '\t') {\r
327 -                       *lineptr = '\0';\r
328 -                       output_decoded_header (headers, &outptr);\r
329 -                       lineptr = headers->line;\r
330 -               }\r
331 -               if (headers->saw_nl && (*inptr == ' ' || *inptr == '\t')) {\r
332 -                       *lineptr = ' ';\r
333 -                       lineptr++;\r
334 -                       while (inptr < inend && (*inptr == ' ' || *inptr == '\t'))\r
335 -                               inptr++;\r
336 -                       headers->saw_nl = FALSE;\r
337 -                       continue;\r
338 -               }\r
339 -               headers->saw_nl = FALSE;\r
340 -\r
341 -               if (*inptr != '\r')\r
342 -                       *lineptr++ = *inptr;\r
343 -               inptr++;\r
344 -       }\r
345 -       if (headers->saw_nl) {\r
346 -               *lineptr = '\0';\r
347 -               output_decoded_header (headers, &outptr);\r
348 -               lineptr = headers->line;\r
349 -       }\r
350 -       headers->lineptr = lineptr;\r
351 -       *outlen = outptr - filter->outbuf;\r
352 -       *outprespace = filter->outpre;\r
353 -       *outbuf = filter->outbuf;\r
354 -}\r
355 -\r
356 -static void\r
357 -filter_complete (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,\r
358 -                char **outbuf, size_t *outlen, size_t *outprespace)\r
359 -{\r
360 -       if (inbuf && inlen)\r
361 -               filter_filter (filter, inbuf, inlen, prespace, outbuf, outlen, outprespace);\r
362 -}\r
363 -\r
364 -static void\r
365 -filter_reset (GMimeFilter *filter)\r
366 -{\r
367 -       GMimeFilterHeaders *headers = (GMimeFilterHeaders *) filter;\r
368 -\r
369 -       headers->saw_nl = TRUE;\r
370 -       free(headers->line);\r
371 -       headers->line = NULL;\r
372 -       headers->line_size = 0;\r
373 -}\r
374 -\r
375 -\r
376 -/**\r
377 - * g_mime_filter_headers_new:\r
378 - * @encode: %TRUE if the filter should encode or %FALSE otherwise\r
379 - * @dots: encode/decode dots (as for SMTP)\r
380 - *\r
381 - * Creates a new #GMimeFilterHeaders filter.\r
382 - *\r
383 - * If @encode is %TRUE, then all lines will be prefixed by "> ",\r
384 - * otherwise any lines starting with "> " will have that removed\r
385 - *\r
386 - * Returns: a new #GMimeFilterHeaders filter.\r
387 - **/\r
388 -GMimeFilter *\r
389 -g_mime_filter_headers_new (void)\r
390 -{\r
391 -       GMimeFilterHeaders *new_headers;\r
392 -\r
393 -       new_headers = (GMimeFilterHeaders *) g_object_newv (GMIME_TYPE_FILTER_HEADERS, 0, NULL);\r
394 -\r
395 -       return (GMimeFilter *) new_headers;\r
396 -}\r
397 -\r
398 diff --git a/gmime-filter-headers.h b/gmime-filter-headers.h\r
399 deleted file mode 100644\r
400 index 1d1a3eb..0000000\r
401 --- a/gmime-filter-headers.h\r
402 +++ /dev/null\r
403 @@ -1,69 +0,0 @@\r
404 -/*\r
405 - * Copyright © 2009 Keith Packard <keithp@keithp.com>\r
406 - * Copyright © 2010 Michal Sojka <sojkam1@fel.cvut.cz>\r
407 - *\r
408 - * This program is free software; you can redistribute it and/or modify\r
409 - * it under the terms of the GNU General Public License as published by\r
410 - * the Free Software Foundation, either version 3 of the License, or\r
411 - * (at your option) any later version.\r
412 - *\r
413 - * This program is distributed in the hope that it will be useful, but\r
414 - * WITHOUT ANY WARRANTY; without even the implied warranty of\r
415 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
416 - * General Public License for more details.\r
417 - *\r
418 - * You should have received a copy of the GNU General Public License along\r
419 - * with this program; if not, write to the Free Software Foundation, Inc.,\r
420 - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.\r
421 - */\r
422 -\r
423 -#ifndef _GMIME_FILTER_HEADERS_H_\r
424 -#define _GMIME_FILTER_HEADERS_H_\r
425 -\r
426 -#include <gmime/gmime-filter.h>\r
427 -\r
428 -G_BEGIN_DECLS\r
429 -\r
430 -#define GMIME_TYPE_FILTER_HEADERS            (g_mime_filter_headers_get_type ())\r
431 -#define GMIME_FILTER_HEADERS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMIME_TYPE_FILTER_HEADERS, GMimeFilterHeaders))\r
432 -#define GMIME_FILTER_HEADERS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMIME_TYPE_FILTER_HEADERS, GMimeFilterHeadersClass))\r
433 -#define GMIME_IS_FILTER_HEADERS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GMIME_TYPE_FILTER_HEADERS))\r
434 -#define GMIME_IS_FILTER_HEADERS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GMIME_TYPE_FILTER_HEADERS))\r
435 -#define GMIME_FILTER_HEADERS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GMIME_TYPE_FILTER_HEADERS, GMimeFilterHeadersClass))\r
436 -\r
437 -typedef struct _GMimeFilterHeaders GMimeFilterHeaders;\r
438 -typedef struct _GMimeFilterHeadersClass GMimeFilterHeadersClass;\r
439 -\r
440 -/**\r
441 - * GMimeFilterHeaders:\r
442 - * @parent_object: parent #GMimeFilter\r
443 - * @saw_nl: previous char was a \n\r
444 - * @line: temporary buffer for line unfolding\r
445 - * @line_size: size of currently allocated memory for @line\r
446 - * @lineptr: pointer to the first unused character in @line\r
447 - *\r
448 - * A filter to decode rfc2047 encoded headers\r
449 - **/\r
450 -struct _GMimeFilterHeaders {\r
451 -       GMimeFilter parent_object;\r
452 -\r
453 -       gboolean saw_nl;\r
454 -       char *line;\r
455 -       size_t line_size;\r
456 -       char *lineptr;\r
457 -};\r
458 -\r
459 -struct _GMimeFilterHeadersClass {\r
460 -       GMimeFilterClass parent_class;\r
461 -\r
462 -};\r
463 -\r
464 -\r
465 -GType g_mime_filter_headers_get_type (void);\r
466 -\r
467 -GMimeFilter *g_mime_filter_headers_new (void);\r
468 -\r
469 -G_END_DECLS\r
470 -\r
471 -\r
472 -#endif /* _GMIME_FILTER_HEADERS_H_ */\r
473 diff --git a/man/man1/notmuch-reply.1 b/man/man1/notmuch-reply.1\r
474 index ac76b07..e553145 100644\r
475 --- a/man/man1/notmuch-reply.1\r
476 +++ b/man/man1/notmuch-reply.1\r
477 @@ -41,7 +41,7 @@ include\r
478  .RS\r
479  .TP 4\r
480  .BR default\r
481 -Includes subject and quoted message body.\r
482 +Includes subject and quoted message body as an RFC 2822 message.\r
483  .TP\r
484  .BR json\r
485  Produces JSON output containing headers for a reply message and the\r
486 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
487 index 0f3b9cd..bfd0f51 100644\r
488 --- a/notmuch-reply.c\r
489 +++ b/notmuch-reply.c\r
490 @@ -21,28 +21,17 @@\r
491   */\r
492  \r
493  #include "notmuch-client.h"\r
494 -#include "gmime-filter-headers.h"\r
495  #include "sprinter.h"\r
496  \r
497  static void\r
498  show_reply_headers (GMimeMessage *message)\r
499  {\r
500 -    GMimeStream *stream_stdout = NULL, *stream_filter = NULL;\r
501 +    GMimeStream *stream_stdout = NULL;\r
502  \r
503      stream_stdout = g_mime_stream_file_new (stdout);\r
504      if (stream_stdout) {\r
505         g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);\r
506 -       stream_filter = g_mime_stream_filter_new(stream_stdout);\r
507 -       if (stream_filter) {\r
508 -               // g_mime_object_write_to_stream will produce\r
509 -               // RFC2047-encoded headers, but we want to present the\r
510 -               // user with decoded headers and let whatever\r
511 -               // ultimately sends the mail do the RFC2047 encoding.\r
512 -               g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),\r
513 -                                        g_mime_filter_headers_new());\r
514 -               g_mime_object_write_to_stream(GMIME_OBJECT(message), stream_filter);\r
515 -               g_object_unref(stream_filter);\r
516 -       }\r
517 +       g_mime_object_write_to_stream (GMIME_OBJECT(message), stream_stdout);\r
518         g_object_unref(stream_stdout);\r
519      }\r
520  }\r
521 diff --git a/test/reply b/test/reply\r
522 index a85ebe5..d4389cf 100755\r
523 --- a/test/reply\r
524 +++ b/test/reply\r
525 @@ -132,7 +132,9 @@ add_message '[subject]="This subject is exactly 200 bytes in length. Other than\r
526             '[body]="200-byte header"'\r
527  output=$(notmuch reply id:${gen_msg_id})\r
528  test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
529 -Subject: Re: This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces\r
530 +Subject: Re: This subject is exactly 200 bytes in length. Other than its\r
531 + length there is not much of note here. Note that the length of 200 bytes\r
532 + includes the Subject: and Re: prefixes with two spaces\r
533  In-Reply-To: <${gen_msg_id}>\r
534  References: <${gen_msg_id}>\r
535  \r
536 @@ -200,10 +202,11 @@ add_message '[subject]="=?iso-8859-1?q?=e0=df=e7?="' \\r
537             '[body]="Encoding"'\r
538  \r
539  output=$(notmuch reply id:${gen_msg_id})\r
540 +# Note that GMime changes from Q- to B-encoding\r
541  test_expect_equal "$output" "\\r
542  From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
543 -Subject: Re: àßç\r
544 -To: ☃ <snowman@example.com>\r
545 +Subject: Re: =?iso-8859-1?b?4N/n?=\r
546 +To: =?UTF-8?b?4piD?= <snowman@example.com>\r
547  In-Reply-To: <${gen_msg_id}>\r
548  References: <${gen_msg_id}>\r
549  \r
550 diff --git a/test/reply-to-sender b/test/reply-to-sender\r
551 index c7d15bb..30e5e38 100755\r
552 --- a/test/reply-to-sender\r
553 +++ b/test/reply-to-sender\r
554 @@ -200,7 +200,9 @@ add_message '[subject]="This subject is exactly 200 bytes in length. Other than\r
555              '[body]="200-byte header"'\r
556  output=$(notmuch reply  --reply-to=sender id:${gen_msg_id})\r
557  test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
558 -Subject: Re: This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces\r
559 +Subject: Re: This subject is exactly 200 bytes in length. Other than its\r
560 + length there is not much of note here. Note that the length of 200 bytes\r
561 + includes the Subject: and Re: prefixes with two spaces\r
562  In-Reply-To: <${gen_msg_id}>\r
563  References: <${gen_msg_id}>\r
564  \r
565 -- \r
566 1.7.10.4\r
567 \r