Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / a3 / 8514638bf7e415eb7b253794b6029a8a66ba0a
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 8C766431FD2\r
6         for <notmuch@notmuchmail.org>; Fri, 27 Jul 2012 21:29:29 -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 I+ue9wDsM4j9 for <notmuch@notmuchmail.org>;\r
16         Fri, 27 Jul 2012 21:29:26 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
18         [18.9.25.13])\r
19         by olra.theworths.org (Postfix) with ESMTP id 6F101431FBC\r
20         for <notmuch@notmuchmail.org>; Fri, 27 Jul 2012 21:29:25 -0700 (PDT)\r
21 X-AuditID: 1209190d-b7fd56d000000933-8b-50136aa44896\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 76.04.02355.4AA63105; Sat, 28 Jul 2012 00:29:24 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q6S4TNxj002940; \r
27         Sat, 28 Jul 2012 00:29:23 -0400\r
28 Received: from drake.dyndns.org\r
29         (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [209.6.116.242]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6S4TKoR027357\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Sat, 28 Jul 2012 00:29:22 -0400 (EDT)\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
36         (envelope-from <amdragon@mit.edu>)\r
37         id 1SuyeW-0002Wx-KH; Sat, 28 Jul 2012 00:29:20 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v2 06/13] show: Feed the sprinter down to part formatters\r
41 Date: Sat, 28 Jul 2012 00:29:07 -0400\r
42 Message-Id: <1343449754-9010-7-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10\r
44 In-Reply-To: <1343449754-9010-1-git-send-email-amdragon@mit.edu>\r
45 References: <1343449754-9010-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFjrLIsWRmVeSWpSXmKPExsUixG6norskSzjAYNE3bYu9De2MFqvn8lhc\r
48         vzmT2eLNynmsDiweO2fdZfdYvGk/m8fhrwtZPJ6tusUcwBLFZZOSmpNZllqkb5fAlXFl+QOW\r
49         ghc+FUd3bGZrYFxn28XIwSEhYCLx61xOFyMnkCkmceHeerYuRi4OIYF9jBJzm5exQzgbGCW+\r
50         PV7GCOE8YpI4cuUqK0iLkMBcRolla7VAbDYBDYlt+5czgtgiAtISO+/OZgXZwCyQJ/F4rQSI\r
51         KSzgKXH4JtgyFgFViW1f/oJN4RWwl1i3E2KihIC8xNP7fWwgNqeAg8Tmlx+YITbZS+yevIF1\r
52         AiP/AkaGVYyyKblVurmJmTnFqcm6xcmJeXmpRbpGermZJXqpKaWbGEGhxinJu4Px3UGlQ4wC\r
53         HIxKPLynrggFCLEmlhVX5h5ilORgUhLljQoXDhDiS8pPqcxILM6ILyrNSS0+xCjBwawkwrtT\r
54         ECjHm5JYWZValA+TkuZgURLnvZJy019IID2xJDU7NbUgtQgmK8PBoSTBuz0TqFGwKDU9tSIt\r
55         M6cEIc3EwQkynAdo+BqQGt7igsTc4sx0iPwpRkUpcd7HIAkBkERGaR5cLywVvGIUB3pFmFcY\r
56         mBiEeIBpBK77FdBgJqDBFtFCIINLEhFSUg2MB3pbnz8xDBV6vm5pzNFzdyoXNexftPSHxxam\r
57         CecW59+8eGPX40rxZbMy7+9NjhfU6pTX/i44XcZlRu2BJS9Ymiumrjt2K3OGr3u+0dPWWJ97\r
58         86+bTfT9uvWrEdNFv3kcP+7Ze5/gXXH7+9WlV/kUyhjTez4FrVh+ptr7flCMl+7ujGm7z1no\r
59         sSqxFGckGmoxFxUnAgAecisT4AIAAA==\r
60 Cc: tomi.ollila@iki.fi\r
61 X-BeenThere: notmuch@notmuchmail.org\r
62 X-Mailman-Version: 2.1.13\r
63 Precedence: list\r
64 List-Id: "Use and development of the notmuch mail system."\r
65         <notmuch.notmuchmail.org>\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
69 List-Post: <mailto:notmuch@notmuchmail.org>\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
73 X-List-Received-Date: Sat, 28 Jul 2012 04:29:29 -0000\r
74 \r
75 There are several levels of function calls between where we create the\r
76 sprinter and the call to the part formatter in show_message. This\r
77 feeds the sprinter through all of them and into the part formatters.\r
78 ---\r
79  notmuch-client.h |    5 +++--\r
80  notmuch-reply.c  |    2 +-\r
81  notmuch-show.c   |   50 +++++++++++++++++++++++++++++---------------------\r
82  3 files changed, 33 insertions(+), 24 deletions(-)\r
83 \r
84 diff --git a/notmuch-client.h b/notmuch-client.h\r
85 index e4172a2..8eeedf7 100644\r
86 --- a/notmuch-client.h\r
87 +++ b/notmuch-client.h\r
88 @@ -72,7 +72,7 @@ struct notmuch_show_params;\r
89  typedef struct notmuch_show_format {\r
90      sprinter_t *(*new_sprinter) (const void *ctx, FILE *stream);\r
91      const char *message_set_start;\r
92 -    notmuch_status_t (*part) (const void *ctx,\r
93 +    notmuch_status_t (*part) (const void *ctx, sprinter_t *sprinter,\r
94                               struct mime_node *node, int indent,\r
95                               const struct notmuch_show_params *params);\r
96      const char *message_set_sep;\r
97 @@ -179,7 +179,8 @@ notmuch_status_t\r
98  show_one_part (const char *filename, int part);\r
99  \r
100  void\r
101 -format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first, notmuch_bool_t output_body);\r
102 +format_part_json (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
103 +                 notmuch_bool_t first, notmuch_bool_t output_body);\r
104  \r
105  void\r
106  format_headers_json (const void *ctx, GMimeMessage *message, notmuch_bool_t reply);\r
107 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
108 index e42ba79..07d4452 100644\r
109 --- a/notmuch-reply.c\r
110 +++ b/notmuch-reply.c\r
111 @@ -624,7 +624,7 @@ notmuch_reply_format_json(void *ctx,\r
112      /* Start the original */\r
113      printf (", \"original\": ");\r
114  \r
115 -    format_part_json (ctx, node, TRUE, TRUE);\r
116 +    format_part_json (ctx, sp, node, TRUE, TRUE);\r
117  \r
118      /* End */\r
119      printf ("}\n");\r
120 diff --git a/notmuch-show.c b/notmuch-show.c\r
121 index d04943f..b258f65 100644\r
122 --- a/notmuch-show.c\r
123 +++ b/notmuch-show.c\r
124 @@ -23,7 +23,7 @@\r
125  #include "sprinter.h"\r
126  \r
127  static notmuch_status_t\r
128 -format_part_text (const void *ctx, mime_node_t *node,\r
129 +format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
130                   int indent, const notmuch_show_params_t *params);\r
131  \r
132  static const notmuch_show_format_t format_text = {\r
133 @@ -32,7 +32,7 @@ static const notmuch_show_format_t format_text = {\r
134  };\r
135  \r
136  static notmuch_status_t\r
137 -format_part_json_entry (const void *ctx, mime_node_t *node,\r
138 +format_part_json_entry (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
139                         int indent, const notmuch_show_params_t *params);\r
140  \r
141  static const notmuch_show_format_t format_json = {\r
142 @@ -45,7 +45,7 @@ static const notmuch_show_format_t format_json = {\r
143  };\r
144  \r
145  static notmuch_status_t\r
146 -format_part_mbox (const void *ctx, mime_node_t *node,\r
147 +format_part_mbox (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
148                   int indent, const notmuch_show_params_t *params);\r
149  \r
150  static const notmuch_show_format_t format_mbox = {\r
151 @@ -54,7 +54,7 @@ static const notmuch_show_format_t format_mbox = {\r
152  };\r
153  \r
154  static notmuch_status_t\r
155 -format_part_raw (unused (const void *ctx), mime_node_t *node,\r
156 +format_part_raw (unused (const void *ctx), sprinter_t *sp, mime_node_t *node,\r
157                  unused (int indent),\r
158                  unused (const notmuch_show_params_t *params));\r
159  \r
160 @@ -471,7 +471,7 @@ format_part_sigstatus_json (mime_node_t *node)\r
161  #endif\r
162  \r
163  static notmuch_status_t\r
164 -format_part_text (const void *ctx, mime_node_t *node,\r
165 +format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
166                   int indent, const notmuch_show_params_t *params)\r
167  {\r
168      /* The disposition and content-type metadata are associated with\r
169 @@ -553,7 +553,7 @@ format_part_text (const void *ctx, mime_node_t *node,\r
170      }\r
171  \r
172      for (i = 0; i < node->nchildren; i++)\r
173 -       format_part_text (ctx, mime_node_child (node, i), indent, params);\r
174 +       format_part_text (ctx, sp, mime_node_child (node, i), indent, params);\r
175  \r
176      if (GMIME_IS_MESSAGE (node->part))\r
177         printf ("\fbody}\n");\r
178 @@ -564,7 +564,8 @@ format_part_text (const void *ctx, mime_node_t *node,\r
179  }\r
180  \r
181  void\r
182 -format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first, notmuch_bool_t output_body)\r
183 +format_part_json (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
184 +                 notmuch_bool_t first, notmuch_bool_t output_body)\r
185  {\r
186      /* Any changes to the JSON format should be reflected in the file\r
187       * devel/schemata. */\r
188 @@ -578,7 +579,7 @@ format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first, notm\r
189  \r
190         if (output_body) {\r
191             printf (", \"body\": [");\r
192 -           format_part_json (ctx, mime_node_child (node, 0), first, TRUE);\r
193 +           format_part_json (ctx, sp, mime_node_child (node, 0), first, TRUE);\r
194             printf ("]");\r
195         }\r
196         printf ("}");\r
197 @@ -659,16 +660,17 @@ format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first, notm\r
198      talloc_free (local);\r
199  \r
200      for (i = 0; i < node->nchildren; i++)\r
201 -       format_part_json (ctx, mime_node_child (node, i), i == 0, TRUE);\r
202 +       format_part_json (ctx, sp, mime_node_child (node, i), i == 0, TRUE);\r
203  \r
204      printf ("%s}", terminator);\r
205  }\r
206  \r
207  static notmuch_status_t\r
208 -format_part_json_entry (const void *ctx, mime_node_t *node, unused (int indent),\r
209 +format_part_json_entry (const void *ctx, sprinter_t *sp,\r
210 +                       mime_node_t *node, unused (int indent),\r
211                         const notmuch_show_params_t *params)\r
212  {\r
213 -    format_part_json (ctx, node, TRUE, params->output_body);\r
214 +    format_part_json (ctx, sp, node, TRUE, params->output_body);\r
215  \r
216      return NOTMUCH_STATUS_SUCCESS;\r
217  }\r
218 @@ -679,7 +681,8 @@ format_part_json_entry (const void *ctx, mime_node_t *node, unused (int indent),\r
219   * http://qmail.org/qmail-manual-html/man5/mbox.html\r
220   */\r
221  static notmuch_status_t\r
222 -format_part_mbox (const void *ctx, mime_node_t *node, unused (int indent),\r
223 +format_part_mbox (const void *ctx, unused (sprinter_t *sp), mime_node_t *node,\r
224 +                 unused (int indent),\r
225                   unused (const notmuch_show_params_t *params))\r
226  {\r
227      notmuch_message_t *message = node->envelope_file;\r
228 @@ -730,8 +733,8 @@ format_part_mbox (const void *ctx, mime_node_t *node, unused (int indent),\r
229  }\r
230  \r
231  static notmuch_status_t\r
232 -format_part_raw (unused (const void *ctx), mime_node_t *node,\r
233 -                unused (int indent),\r
234 +format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),\r
235 +                mime_node_t *node, unused (int indent),\r
236                  unused (const notmuch_show_params_t *params))\r
237  {\r
238      if (node->envelope_file) {\r
239 @@ -819,6 +822,7 @@ show_null_message (const notmuch_show_format_t *format)\r
240  static notmuch_status_t\r
241  show_message (void *ctx,\r
242               const notmuch_show_format_t *format,\r
243 +             sprinter_t *sp,\r
244               notmuch_message_t *message,\r
245               int indent,\r
246               notmuch_show_params_t *params)\r
247 @@ -832,7 +836,7 @@ show_message (void *ctx,\r
248         goto DONE;\r
249      part = mime_node_seek_dfs (root, (params->part < 0 ? 0 : params->part));\r
250      if (part)\r
251 -       status = format->part (local, part, indent, params);\r
252 +       status = format->part (local, sp, part, indent, params);\r
253    DONE:\r
254      talloc_free (local);\r
255      return status;\r
256 @@ -841,6 +845,7 @@ show_message (void *ctx,\r
257  static notmuch_status_t\r
258  show_messages (void *ctx,\r
259                const notmuch_show_format_t *format,\r
260 +              sprinter_t *sp,\r
261                notmuch_messages_t *messages,\r
262                int indent,\r
263                notmuch_show_params_t *params)\r
264 @@ -874,7 +879,7 @@ show_messages (void *ctx,\r
265         next_indent = indent;\r
266  \r
267         if ((match && (!excluded || !params->omit_excluded)) || params->entire_thread) {\r
268 -           status = show_message (ctx, format, message, indent, params);\r
269 +           status = show_message (ctx, format, sp, message, indent, params);\r
270             if (status && !res)\r
271                 res = status;\r
272             next_indent = indent + 1;\r
273 @@ -886,7 +891,7 @@ show_messages (void *ctx,\r
274             fputs (format->message_set_sep, stdout);\r
275  \r
276         status = show_messages (ctx,\r
277 -                               format,\r
278 +                               format, sp,\r
279                                 notmuch_message_get_replies (message),\r
280                                 next_indent,\r
281                                 params);\r
282 @@ -910,6 +915,7 @@ static int\r
283  do_show_single (void *ctx,\r
284                 notmuch_query_t *query,\r
285                 const notmuch_show_format_t *format,\r
286 +               sprinter_t *sp,\r
287                 notmuch_show_params_t *params)\r
288  {\r
289      notmuch_messages_t *messages;\r
290 @@ -930,7 +936,8 @@ do_show_single (void *ctx,\r
291  \r
292      notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH, 1);\r
293  \r
294 -    return show_message (ctx, format, message, 0, params) != NOTMUCH_STATUS_SUCCESS;\r
295 +    return show_message (ctx, format, sp, message, 0, params)\r
296 +       != NOTMUCH_STATUS_SUCCESS;\r
297  }\r
298  \r
299  /* Formatted output of threads */\r
300 @@ -938,6 +945,7 @@ static int\r
301  do_show (void *ctx,\r
302          notmuch_query_t *query,\r
303          const notmuch_show_format_t *format,\r
304 +        sprinter_t *sp,\r
305          notmuch_show_params_t *params)\r
306  {\r
307      notmuch_threads_t *threads;\r
308 @@ -965,7 +973,7 @@ do_show (void *ctx,\r
309             fputs (format->message_set_sep, stdout);\r
310         first_toplevel = 0;\r
311  \r
312 -       status = show_messages (ctx, format, messages, 0, params);\r
313 +       status = show_messages (ctx, format, sp, messages, 0, params);\r
314         if (status && !res)\r
315             res = status;\r
316  \r
317 @@ -1141,7 +1149,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
318  \r
319      /* If a single message is requested we do not use search_excludes. */\r
320      if (params.part >= 0)\r
321 -       ret = do_show_single (ctx, query, format, &params);\r
322 +       ret = do_show_single (ctx, query, format, sprinter, &params);\r
323      else {\r
324         /* We always apply set the exclude flag. The\r
325          * exclude=true|false option controls whether or not we return\r
326 @@ -1160,7 +1168,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
327             params.omit_excluded = FALSE;\r
328         }\r
329  \r
330 -       ret = do_show (ctx, query, format, &params);\r
331 +       ret = do_show (ctx, query, format, sprinter, &params);\r
332      }\r
333  \r
334      notmuch_crypto_cleanup (&params.crypto);\r
335 -- \r
336 1.7.10\r
337 \r