[PATCH 4/4] Update NEWS for user.other_name
[notmuch-archives.git] / 12 / b83bb0010903d120f748b594a57bb0c22268f1
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 D8668429E26\r
6         for <notmuch@notmuchmail.org>; Thu,  2 Aug 2012 18:15:15 -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 I6-cbFb19Ian for <notmuch@notmuchmail.org>;\r
16         Thu,  2 Aug 2012 18:15:12 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
18         [18.7.68.36])\r
19         by olra.theworths.org (Postfix) with ESMTP id BA768429E31\r
20         for <notmuch@notmuchmail.org>; Thu,  2 Aug 2012 18:15:08 -0700 (PDT)\r
21 X-AuditID: 12074424-b7fa06d0000008c2-c5-501b261ba9af\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
23         by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 75.5C.02242.B162B105; Thu,  2 Aug 2012 21:15:07 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q731F6UA008952; \r
27         Thu, 2 Aug 2012 21:15:06 -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 q731F4hX002788\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Thu, 2 Aug 2012 21:15:05 -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 1Sx6To-0003wM-8P; Thu, 02 Aug 2012 21:15:04 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH v3 06/13] show: Feed the sprinter down to part formatters\r
41 Date: Thu,  2 Aug 2012 21:14:52 -0400\r
42 Message-Id: <1343956499-14543-7-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10\r
44 In-Reply-To: <1343956499-14543-1-git-send-email-amdragon@mit.edu>\r
45 References: <1343956499-14543-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixCmqrSutJh1gMHmPusXquTwW12/OZLZ4\r
48         s3IeqwOzx85Zd9k9Dn9dyOLxbNUt5gDmKC6blNSczLLUIn27BK6M9v4V7AW9fhXfrx9mbWDc\r
49         btfFyMkhIWAi8ar1HROELSZx4d56ti5GLg4hgX2MEmseLGSCcNYzSvSdvMYO4Txkkli6YDlU\r
50         2VxGiZtnToH1swloSGzbv5wRxBYRkJbYeXc2K4jNLBAnsWXKf7C4sICnRP/fFWA2i4CqxObX\r
51         89lBbF4BB4nN2yawQNwhL/H0fh8biM0p4Cjx+u0rsHohoJrlbd2sExj5FzAyrGKUTcmt0s1N\r
52         zMwpTk3WLU5OzMtLLdI118vNLNFLTSndxAgKL3YXlR2MzYeUDjEKcDAq8fAaSUoHCLEmlhVX\r
53         5h5ilORgUhLlZVYCCvEl5adUZiQWZ8QXleakFh9ilOBgVhLhrVoiFSDEm5JYWZValA+TkuZg\r
54         URLnvZ5y019IID2xJDU7NbUgtQgmK8PBoSTBG6wKNFSwKDU9tSItM6cEIc3EwQkynAdouD1I\r
55         DW9xQWJucWY6RP4Uo6KUOG86SEIAJJFRmgfXC4v/V4ziQK8I83qBVPEAUwdc9yugwUxAg+3M\r
56         QK4uLklESEk1ME602S9atuOv/wsJxvPKBwSu6VdFcq1kfHt3qZFZx8N7mZ7pcTGH2S11WxKM\r
57         5WbzJ9/IdQ4sntm812MaE5fu3El/dk2V2BGluqWYk+Ge6sW3+7QUvk56zMS1JnqJ74KWtCe3\r
58         Fj7IETGf6uJ779Tvj1ZPjf2/NDy84xiudUFdb1VeGUvnudf+OUosxRmJhlrMRcWJAF3Lltja        AgAA\r
59 Cc: tomi.ollila@iki.fi\r
60 X-BeenThere: notmuch@notmuchmail.org\r
61 X-Mailman-Version: 2.1.13\r
62 Precedence: list\r
63 List-Id: "Use and development of the notmuch mail system."\r
64         <notmuch.notmuchmail.org>\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
68 List-Post: <mailto:notmuch@notmuchmail.org>\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
72 X-List-Received-Date: Fri, 03 Aug 2012 01:15:16 -0000\r
73 \r
74 There are several levels of function calls between where we create the\r
75 sprinter and the call to the part formatter in show_message. This\r
76 feeds the sprinter through all of them and into the part formatters.\r
77 ---\r
78  notmuch-client.h |    6 ++++--\r
79  notmuch-reply.c  |    2 +-\r
80  notmuch-show.c   |   50 +++++++++++++++++++++++++++++---------------------\r
81  3 files changed, 34 insertions(+), 24 deletions(-)\r
82 \r
83 diff --git a/notmuch-client.h b/notmuch-client.h\r
84 index bbc0a11..112574c 100644\r
85 --- a/notmuch-client.h\r
86 +++ b/notmuch-client.h\r
87 @@ -66,12 +66,13 @@ typedef GMimeCipherContext notmuch_crypto_context_t;\r
88  #define STRINGIFY_(s) #s\r
89  \r
90  typedef struct mime_node mime_node_t;\r
91 +struct sprinter;\r
92  struct notmuch_show_params;\r
93  \r
94  typedef struct notmuch_show_format {\r
95      struct sprinter *(*new_sprinter) (const void *ctx, FILE *stream);\r
96      const char *message_set_start;\r
97 -    notmuch_status_t (*part) (const void *ctx,\r
98 +    notmuch_status_t (*part) (const void *ctx, struct sprinter *sprinter,\r
99                               struct mime_node *node, int indent,\r
100                               const struct notmuch_show_params *params);\r
101      const char *message_set_sep;\r
102 @@ -178,7 +179,8 @@ notmuch_status_t\r
103  show_one_part (const char *filename, int part);\r
104  \r
105  void\r
106 -format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first, notmuch_bool_t output_body);\r
107 +format_part_json (const void *ctx, struct sprinter *sp, mime_node_t *node,\r
108 +                 notmuch_bool_t first, notmuch_bool_t output_body);\r
109  \r
110  void\r
111  format_headers_json (const void *ctx, GMimeMessage *message, notmuch_bool_t reply);\r
112 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
113 index e42ba79..07d4452 100644\r
114 --- a/notmuch-reply.c\r
115 +++ b/notmuch-reply.c\r
116 @@ -624,7 +624,7 @@ notmuch_reply_format_json(void *ctx,\r
117      /* Start the original */\r
118      printf (", \"original\": ");\r
119  \r
120 -    format_part_json (ctx, node, TRUE, TRUE);\r
121 +    format_part_json (ctx, sp, node, TRUE, TRUE);\r
122  \r
123      /* End */\r
124      printf ("}\n");\r
125 diff --git a/notmuch-show.c b/notmuch-show.c\r
126 index d04943f..b258f65 100644\r
127 --- a/notmuch-show.c\r
128 +++ b/notmuch-show.c\r
129 @@ -23,7 +23,7 @@\r
130  #include "sprinter.h"\r
131  \r
132  static notmuch_status_t\r
133 -format_part_text (const void *ctx, mime_node_t *node,\r
134 +format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
135                   int indent, const notmuch_show_params_t *params);\r
136  \r
137  static const notmuch_show_format_t format_text = {\r
138 @@ -32,7 +32,7 @@ static const notmuch_show_format_t format_text = {\r
139  };\r
140  \r
141  static notmuch_status_t\r
142 -format_part_json_entry (const void *ctx, mime_node_t *node,\r
143 +format_part_json_entry (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
144                         int indent, const notmuch_show_params_t *params);\r
145  \r
146  static const notmuch_show_format_t format_json = {\r
147 @@ -45,7 +45,7 @@ static const notmuch_show_format_t format_json = {\r
148  };\r
149  \r
150  static notmuch_status_t\r
151 -format_part_mbox (const void *ctx, mime_node_t *node,\r
152 +format_part_mbox (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
153                   int indent, const notmuch_show_params_t *params);\r
154  \r
155  static const notmuch_show_format_t format_mbox = {\r
156 @@ -54,7 +54,7 @@ static const notmuch_show_format_t format_mbox = {\r
157  };\r
158  \r
159  static notmuch_status_t\r
160 -format_part_raw (unused (const void *ctx), mime_node_t *node,\r
161 +format_part_raw (unused (const void *ctx), sprinter_t *sp, mime_node_t *node,\r
162                  unused (int indent),\r
163                  unused (const notmuch_show_params_t *params));\r
164  \r
165 @@ -471,7 +471,7 @@ format_part_sigstatus_json (mime_node_t *node)\r
166  #endif\r
167  \r
168  static notmuch_status_t\r
169 -format_part_text (const void *ctx, mime_node_t *node,\r
170 +format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
171                   int indent, const notmuch_show_params_t *params)\r
172  {\r
173      /* The disposition and content-type metadata are associated with\r
174 @@ -553,7 +553,7 @@ format_part_text (const void *ctx, mime_node_t *node,\r
175      }\r
176  \r
177      for (i = 0; i < node->nchildren; i++)\r
178 -       format_part_text (ctx, mime_node_child (node, i), indent, params);\r
179 +       format_part_text (ctx, sp, mime_node_child (node, i), indent, params);\r
180  \r
181      if (GMIME_IS_MESSAGE (node->part))\r
182         printf ("\fbody}\n");\r
183 @@ -564,7 +564,8 @@ format_part_text (const void *ctx, mime_node_t *node,\r
184  }\r
185  \r
186  void\r
187 -format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first, notmuch_bool_t output_body)\r
188 +format_part_json (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
189 +                 notmuch_bool_t first, notmuch_bool_t output_body)\r
190  {\r
191      /* Any changes to the JSON format should be reflected in the file\r
192       * devel/schemata. */\r
193 @@ -578,7 +579,7 @@ format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first, notm\r
194  \r
195         if (output_body) {\r
196             printf (", \"body\": [");\r
197 -           format_part_json (ctx, mime_node_child (node, 0), first, TRUE);\r
198 +           format_part_json (ctx, sp, mime_node_child (node, 0), first, TRUE);\r
199             printf ("]");\r
200         }\r
201         printf ("}");\r
202 @@ -659,16 +660,17 @@ format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first, notm\r
203      talloc_free (local);\r
204  \r
205      for (i = 0; i < node->nchildren; i++)\r
206 -       format_part_json (ctx, mime_node_child (node, i), i == 0, TRUE);\r
207 +       format_part_json (ctx, sp, mime_node_child (node, i), i == 0, TRUE);\r
208  \r
209      printf ("%s}", terminator);\r
210  }\r
211  \r
212  static notmuch_status_t\r
213 -format_part_json_entry (const void *ctx, mime_node_t *node, unused (int indent),\r
214 +format_part_json_entry (const void *ctx, sprinter_t *sp,\r
215 +                       mime_node_t *node, unused (int indent),\r
216                         const notmuch_show_params_t *params)\r
217  {\r
218 -    format_part_json (ctx, node, TRUE, params->output_body);\r
219 +    format_part_json (ctx, sp, node, TRUE, params->output_body);\r
220  \r
221      return NOTMUCH_STATUS_SUCCESS;\r
222  }\r
223 @@ -679,7 +681,8 @@ format_part_json_entry (const void *ctx, mime_node_t *node, unused (int indent),\r
224   * http://qmail.org/qmail-manual-html/man5/mbox.html\r
225   */\r
226  static notmuch_status_t\r
227 -format_part_mbox (const void *ctx, mime_node_t *node, unused (int indent),\r
228 +format_part_mbox (const void *ctx, unused (sprinter_t *sp), mime_node_t *node,\r
229 +                 unused (int indent),\r
230                   unused (const notmuch_show_params_t *params))\r
231  {\r
232      notmuch_message_t *message = node->envelope_file;\r
233 @@ -730,8 +733,8 @@ format_part_mbox (const void *ctx, mime_node_t *node, unused (int indent),\r
234  }\r
235  \r
236  static notmuch_status_t\r
237 -format_part_raw (unused (const void *ctx), mime_node_t *node,\r
238 -                unused (int indent),\r
239 +format_part_raw (unused (const void *ctx), unused (sprinter_t *sp),\r
240 +                mime_node_t *node, unused (int indent),\r
241                  unused (const notmuch_show_params_t *params))\r
242  {\r
243      if (node->envelope_file) {\r
244 @@ -819,6 +822,7 @@ show_null_message (const notmuch_show_format_t *format)\r
245  static notmuch_status_t\r
246  show_message (void *ctx,\r
247               const notmuch_show_format_t *format,\r
248 +             sprinter_t *sp,\r
249               notmuch_message_t *message,\r
250               int indent,\r
251               notmuch_show_params_t *params)\r
252 @@ -832,7 +836,7 @@ show_message (void *ctx,\r
253         goto DONE;\r
254      part = mime_node_seek_dfs (root, (params->part < 0 ? 0 : params->part));\r
255      if (part)\r
256 -       status = format->part (local, part, indent, params);\r
257 +       status = format->part (local, sp, part, indent, params);\r
258    DONE:\r
259      talloc_free (local);\r
260      return status;\r
261 @@ -841,6 +845,7 @@ show_message (void *ctx,\r
262  static notmuch_status_t\r
263  show_messages (void *ctx,\r
264                const notmuch_show_format_t *format,\r
265 +              sprinter_t *sp,\r
266                notmuch_messages_t *messages,\r
267                int indent,\r
268                notmuch_show_params_t *params)\r
269 @@ -874,7 +879,7 @@ show_messages (void *ctx,\r
270         next_indent = indent;\r
271  \r
272         if ((match && (!excluded || !params->omit_excluded)) || params->entire_thread) {\r
273 -           status = show_message (ctx, format, message, indent, params);\r
274 +           status = show_message (ctx, format, sp, message, indent, params);\r
275             if (status && !res)\r
276                 res = status;\r
277             next_indent = indent + 1;\r
278 @@ -886,7 +891,7 @@ show_messages (void *ctx,\r
279             fputs (format->message_set_sep, stdout);\r
280  \r
281         status = show_messages (ctx,\r
282 -                               format,\r
283 +                               format, sp,\r
284                                 notmuch_message_get_replies (message),\r
285                                 next_indent,\r
286                                 params);\r
287 @@ -910,6 +915,7 @@ static int\r
288  do_show_single (void *ctx,\r
289                 notmuch_query_t *query,\r
290                 const notmuch_show_format_t *format,\r
291 +               sprinter_t *sp,\r
292                 notmuch_show_params_t *params)\r
293  {\r
294      notmuch_messages_t *messages;\r
295 @@ -930,7 +936,8 @@ do_show_single (void *ctx,\r
296  \r
297      notmuch_message_set_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH, 1);\r
298  \r
299 -    return show_message (ctx, format, message, 0, params) != NOTMUCH_STATUS_SUCCESS;\r
300 +    return show_message (ctx, format, sp, message, 0, params)\r
301 +       != NOTMUCH_STATUS_SUCCESS;\r
302  }\r
303  \r
304  /* Formatted output of threads */\r
305 @@ -938,6 +945,7 @@ static int\r
306  do_show (void *ctx,\r
307          notmuch_query_t *query,\r
308          const notmuch_show_format_t *format,\r
309 +        sprinter_t *sp,\r
310          notmuch_show_params_t *params)\r
311  {\r
312      notmuch_threads_t *threads;\r
313 @@ -965,7 +973,7 @@ do_show (void *ctx,\r
314             fputs (format->message_set_sep, stdout);\r
315         first_toplevel = 0;\r
316  \r
317 -       status = show_messages (ctx, format, messages, 0, params);\r
318 +       status = show_messages (ctx, format, sp, messages, 0, params);\r
319         if (status && !res)\r
320             res = status;\r
321  \r
322 @@ -1141,7 +1149,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
323  \r
324      /* If a single message is requested we do not use search_excludes. */\r
325      if (params.part >= 0)\r
326 -       ret = do_show_single (ctx, query, format, &params);\r
327 +       ret = do_show_single (ctx, query, format, sprinter, &params);\r
328      else {\r
329         /* We always apply set the exclude flag. The\r
330          * exclude=true|false option controls whether or not we return\r
331 @@ -1160,7 +1168,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
332             params.omit_excluded = FALSE;\r
333         }\r
334  \r
335 -       ret = do_show (ctx, query, format, &params);\r
336 +       ret = do_show (ctx, query, format, sprinter, &params);\r
337      }\r
338  \r
339      notmuch_crypto_cleanup (&params.crypto);\r
340 -- \r
341 1.7.10\r
342 \r