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