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