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