1 Return-Path: <bremner@tethera.net>
\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 7720B431FD0
\r
6 for <notmuch@notmuchmail.org>; Tue, 10 Jan 2012 04:07:17 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] 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 M6Z3YGwza1sG for <notmuch@notmuchmail.org>;
\r
16 Tue, 10 Jan 2012 04:07:16 -0800 (PST)
\r
17 Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])
\r
18 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id B806E431FB6
\r
21 for <notmuch@notmuchmail.org>; Tue, 10 Jan 2012 04:07:15 -0800 (PST)
\r
22 Received: from zancas.localnet
\r
23 (fctnnbsc36w-156034072155.pppoe-dynamic.High-Speed.nb.bellaliant.net
\r
24 [156.34.72.155]) (authenticated bits=0)
\r
25 by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id q0AC7BPi029349
\r
26 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);
\r
27 Tue, 10 Jan 2012 08:07:11 -0400
\r
28 Received: from bremner by zancas.localnet with local (Exim 4.77)
\r
29 (envelope-from <bremner@tethera.net>)
\r
30 id 1RkaTu-0002kC-NX; Tue, 10 Jan 2012 08:07:10 -0400
\r
31 From: David Bremner <david@tethera.net>
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH 2/2] notmuch-reply.c: uncrustify
\r
34 Date: Tue, 10 Jan 2012 08:07:08 -0400
\r
35 Message-Id: <1326197228-10356-3-git-send-email-david@tethera.net>
\r
36 X-Mailer: git-send-email 1.7.7.3
\r
37 In-Reply-To: <1326197228-10356-1-git-send-email-david@tethera.net>
\r
38 References: <1324135695-15487-1-git-send-email-david@tethera.net>
\r
39 <1326197228-10356-1-git-send-email-david@tethera.net>
\r
40 Cc: David Bremner <bremner@debian.org>
\r
41 X-BeenThere: notmuch@notmuchmail.org
\r
42 X-Mailman-Version: 2.1.13
\r
44 List-Id: "Use and development of the notmuch mail system."
\r
45 <notmuch.notmuchmail.org>
\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
49 List-Post: <mailto:notmuch@notmuchmail.org>
\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
53 X-List-Received-Date: Tue, 10 Jan 2012 12:07:17 -0000
\r
55 From: David Bremner <bremner@debian.org>
\r
57 This patch shows the raw result of running uncrustify on notmuch-reply.c.
\r
58 The re-indenting of "format_reply" would probably not be desirable.
\r
60 notmuch-reply.c | 160 +++++++++++++++++++++++++-----------------------------
\r
61 1 files changed, 74 insertions(+), 86 deletions(-)
\r
63 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
64 index 000f6da..00c9923 100644
\r
65 --- a/notmuch-reply.c
\r
66 +++ b/notmuch-reply.c
\r
67 @@ -32,17 +32,17 @@ reply_part_content (GMimeObject *part);
\r
69 static const notmuch_show_format_t format_reply = {
\r
72 - "", NULL, reply_headers_message_part, ">\n",
\r
77 - reply_part_content,
\r
83 + "", NULL, reply_headers_message_part, ">\n",
\r
88 + reply_part_content,
\r
96 @@ -54,14 +54,14 @@ show_reply_headers (GMimeMessage *message)
\r
97 stream_stdout = g_mime_stream_file_new (stdout);
\r
98 if (stream_stdout) {
\r
99 g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
\r
100 - stream_filter = g_mime_stream_filter_new(stream_stdout);
\r
101 + stream_filter = g_mime_stream_filter_new (stream_stdout);
\r
102 if (stream_filter) {
\r
103 - g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
\r
104 - g_mime_filter_headers_new());
\r
105 - g_mime_object_write_to_stream(GMIME_OBJECT(message), stream_filter);
\r
106 - g_object_unref(stream_filter);
\r
107 + g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter),
\r
108 + g_mime_filter_headers_new ());
\r
109 + g_mime_object_write_to_stream (GMIME_OBJECT (message), stream_filter);
\r
110 + g_object_unref (stream_filter);
\r
112 - g_object_unref(stream_stdout);
\r
113 + g_object_unref (stream_stdout);
\r
117 @@ -94,18 +94,13 @@ reply_part_content (GMimeObject *part)
\r
118 GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (part);
\r
120 if (g_mime_content_type_is_type (content_type, "multipart", "*") ||
\r
121 - g_mime_content_type_is_type (content_type, "message", "rfc822"))
\r
123 + g_mime_content_type_is_type (content_type, "message", "rfc822")) {
\r
124 /* Output nothing, since multipart subparts will be handled individually. */
\r
126 - else if (g_mime_content_type_is_type (content_type, "application", "pgp-encrypted") ||
\r
127 - g_mime_content_type_is_type (content_type, "application", "pgp-signature"))
\r
129 + } else if (g_mime_content_type_is_type (content_type, "application", "pgp-encrypted") ||
\r
130 + g_mime_content_type_is_type (content_type, "application", "pgp-signature")) {
\r
131 /* Ignore PGP/MIME cruft parts */
\r
133 - else if (g_mime_content_type_is_type (content_type, "text", "*") &&
\r
134 - !g_mime_content_type_is_type (content_type, "text", "html"))
\r
136 + } else if (g_mime_content_type_is_type (content_type, "text", "*") &&
\r
137 + !g_mime_content_type_is_type (content_type, "text", "html")) {
\r
138 GMimeStream *stream_stdout = NULL, *stream_filter = NULL;
\r
139 GMimeDataWrapper *wrapper;
\r
140 const char *charset;
\r
141 @@ -114,33 +109,28 @@ reply_part_content (GMimeObject *part)
\r
142 stream_stdout = g_mime_stream_file_new (stdout);
\r
143 if (stream_stdout) {
\r
144 g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
\r
145 - stream_filter = g_mime_stream_filter_new(stream_stdout);
\r
146 + stream_filter = g_mime_stream_filter_new (stream_stdout);
\r
148 - g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
\r
149 - g_mime_filter_charset_new(charset, "UTF-8"));
\r
150 + g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter),
\r
151 + g_mime_filter_charset_new (charset, "UTF-8"));
\r
154 - g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
\r
155 - g_mime_filter_reply_new(TRUE));
\r
156 + g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter),
\r
157 + g_mime_filter_reply_new (TRUE));
\r
158 wrapper = g_mime_part_get_content_object (GMIME_PART (part));
\r
159 if (wrapper && stream_filter)
\r
160 g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);
\r
162 - g_object_unref(stream_filter);
\r
163 + g_object_unref (stream_filter);
\r
165 - g_object_unref(stream_stdout);
\r
169 + g_object_unref (stream_stdout);
\r
172 - strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
\r
174 + strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0) {
\r
175 const char *filename = g_mime_part_get_filename (GMIME_PART (part));
\r
176 printf ("Attachment: %s (%s)\n", filename,
\r
177 g_mime_content_type_to_string (content_type));
\r
182 printf ("Non-text part: %s\n",
\r
183 g_mime_content_type_to_string (content_type));
\r
185 @@ -276,8 +266,7 @@ reply_to_header_is_redundant (notmuch_message_t *message)
\r
186 cc = notmuch_message_get_header (message, "cc");
\r
188 if ((to && strstr (to, addr) != 0) ||
\r
189 - (cc && strstr (cc, addr) != 0))
\r
191 + (cc && strstr (cc, addr) != 0)) {
\r
195 @@ -345,16 +334,16 @@ add_recipients_from_message (GMimeMessage *reply,
\r
196 static const char *
\r
197 guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message)
\r
199 - const char *received,*primary,*by;
\r
200 + const char *received, *primary, *by;
\r
201 const char **other;
\r
203 - char *mta,*ptr,*token;
\r
204 - char *domain=NULL;
\r
206 - const char *delim=". \t";
\r
207 - size_t i,j,other_len;
\r
208 + char *mta, *ptr, *token;
\r
209 + char *domain = NULL;
\r
210 + char *tld = NULL;
\r
211 + const char *delim = ". \t";
\r
212 + size_t i, j, other_len;
\r
214 - const char *to_headers[] = {"Envelope-to", "X-Original-To"};
\r
215 + const char *to_headers[] = { "Envelope-to", "X-Original-To" };
\r
217 primary = notmuch_config_get_user_primary_email (config);
\r
218 other = notmuch_config_get_user_other_email (config, &other_len);
\r
219 @@ -373,22 +362,22 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
\r
220 * 'by' part of Received headers
\r
221 * If none of these work, we give up and return NULL
\r
223 - for (i = 0; i < sizeof(to_headers)/sizeof(*to_headers); i++) {
\r
224 - tohdr = xstrdup(notmuch_message_get_header (message, to_headers[i]));
\r
225 + for (i = 0; i < sizeof(to_headers) / sizeof(*to_headers); i++) {
\r
226 + tohdr = xstrdup (notmuch_message_get_header (message, to_headers[i]));
\r
227 if (tohdr && *tohdr) {
\r
228 /* tohdr is potentialy a list of email addresses, so here we
\r
229 * check if one of the email addresses is a substring of tohdr
\r
231 - if (strcasestr(tohdr, primary)) {
\r
233 + if (strcasestr (tohdr, primary)) {
\r
237 for (j = 0; j < other_len; j++)
\r
238 if (strcasestr (tohdr, other[j])) {
\r
248 @@ -412,7 +401,7 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
\r
249 * so again we check if one of the email addresses is a
\r
252 - if (strcasestr(ptr, primary)) {
\r
253 + if (strcasestr (ptr, primary)) {
\r
256 for (i = 0; i < other_len; i++)
\r
257 @@ -430,12 +419,12 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
\r
258 * system in this step of the receive chain
\r
261 - while((by = strstr (by, " by ")) != NULL) {
\r
262 + while ((by = strstr (by, " by ")) != NULL) {
\r
266 mta = xstrdup (by);
\r
267 - token = strtok(mta," \t");
\r
268 + token = strtok (mta, " \t");
\r
269 if (token == NULL) {
\r
272 @@ -458,15 +447,15 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
\r
273 * the test is the other way around: we check if this is a
\r
274 * substring of one of the email addresses.
\r
277 + *(tld - 1) = '.';
\r
279 - if (strcasestr(primary, domain)) {
\r
281 + if (strcasestr (primary, domain)) {
\r
285 for (i = 0; i < other_len; i++)
\r
286 - if (strcasestr (other[i],domain)) {
\r
288 + if (strcasestr (other[i], domain)) {
\r
293 @@ -477,10 +466,10 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
\r
297 -notmuch_reply_format_default(void *ctx,
\r
298 - notmuch_config_t *config,
\r
299 - notmuch_query_t *query,
\r
300 - notmuch_show_params_t *params)
\r
301 +notmuch_reply_format_default (void *ctx,
\r
302 + notmuch_config_t *config,
\r
303 + notmuch_query_t *query,
\r
304 + notmuch_show_params_t *params)
\r
306 GMimeMessage *reply;
\r
307 notmuch_messages_t *messages;
\r
308 @@ -491,8 +480,7 @@ notmuch_reply_format_default(void *ctx,
\r
310 for (messages = notmuch_query_search_messages (query);
\r
311 notmuch_messages_valid (messages);
\r
312 - notmuch_messages_move_to_next (messages))
\r
314 + notmuch_messages_move_to_next (messages)) {
\r
315 message = notmuch_messages_get (messages);
\r
317 /* The 1 means we want headers in a "pretty" order. */
\r
318 @@ -524,7 +512,7 @@ notmuch_reply_format_default(void *ctx,
\r
319 "From", from_addr);
\r
321 in_reply_to = talloc_asprintf (ctx, "<%s>",
\r
322 - notmuch_message_get_message_id (message));
\r
323 + notmuch_message_get_message_id (message));
\r
325 g_mime_object_set_header (GMIME_OBJECT (reply),
\r
326 "In-Reply-To", in_reply_to);
\r
327 @@ -555,10 +543,10 @@ notmuch_reply_format_default(void *ctx,
\r
329 /* This format is currently tuned for a git send-email --notmuch hook */
\r
331 -notmuch_reply_format_headers_only(void *ctx,
\r
332 - notmuch_config_t *config,
\r
333 - notmuch_query_t *query,
\r
334 - unused (notmuch_show_params_t *params))
\r
335 +notmuch_reply_format_headers_only (void *ctx,
\r
336 + notmuch_config_t *config,
\r
337 + notmuch_query_t *query,
\r
338 + unused (notmuch_show_params_t * params))
\r
340 GMimeMessage *reply;
\r
341 notmuch_messages_t *messages;
\r
342 @@ -568,8 +556,7 @@ notmuch_reply_format_headers_only(void *ctx,
\r
344 for (messages = notmuch_query_search_messages (query);
\r
345 notmuch_messages_valid (messages);
\r
346 - notmuch_messages_move_to_next (messages))
\r
348 + notmuch_messages_move_to_next (messages)) {
\r
349 message = notmuch_messages_get (messages);
\r
351 /* The 0 means we do not want headers in a "pretty" order. */
\r
352 @@ -580,16 +567,16 @@ notmuch_reply_format_headers_only(void *ctx,
\r
355 in_reply_to = talloc_asprintf (ctx, "<%s>",
\r
356 - notmuch_message_get_message_id (message));
\r
357 + notmuch_message_get_message_id (message));
\r
359 - g_mime_object_set_header (GMIME_OBJECT (reply),
\r
360 + g_mime_object_set_header (GMIME_OBJECT (reply),
\r
361 "In-Reply-To", in_reply_to);
\r
364 orig_references = notmuch_message_get_header (message, "references");
\r
366 /* We print In-Reply-To followed by References because git format-patch treats them
\r
367 - * specially. Git does not interpret the other headers specially
\r
368 + * specially. Git does not interpret the other headers specially
\r
370 references = talloc_asprintf (ctx, "%s%s%s",
\r
371 orig_references ? orig_references : "",
\r
372 @@ -598,7 +585,7 @@ notmuch_reply_format_headers_only(void *ctx,
\r
373 g_mime_object_set_header (GMIME_OBJECT (reply),
\r
374 "References", references);
\r
376 - (void)add_recipients_from_message (reply, config, message);
\r
377 + (void) add_recipients_from_message (reply, config, message);
\r
379 reply_headers = g_mime_object_to_string (GMIME_OBJECT (reply));
\r
380 printf ("%s", reply_headers);
\r
381 @@ -625,6 +612,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
\r
382 notmuch_query_t *query;
\r
383 char *query_string;
\r
384 int opt_index, ret = 0;
\r
386 int (*reply_format_func)(void *ctx, notmuch_config_t *config, notmuch_query_t *query, notmuch_show_params_t *params);
\r
387 notmuch_show_params_t params = { .part = -1 };
\r
388 int format = FORMAT_DEFAULT;
\r
389 @@ -651,10 +639,10 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
\r
390 reply_format_func = notmuch_reply_format_default;
\r
393 - GMimeSession* session = g_object_new (g_mime_session_get_type(), NULL);
\r
394 + GMimeSession* session = g_object_new (g_mime_session_get_type (), NULL);
\r
395 params.cryptoctx = g_mime_gpg_context_new (session, "gpg");
\r
396 if (params.cryptoctx) {
\r
397 - g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) params.cryptoctx, FALSE);
\r
398 + g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) params.cryptoctx, FALSE);
\r
399 params.decrypt = TRUE;
\r
401 fprintf (stderr, "Failed to construct gpg context.\n");
\r
402 @@ -666,7 +654,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
\r
403 if (config == NULL)
\r
406 - query_string = query_string_from_args (ctx, argc-opt_index, argv+opt_index);
\r
407 + query_string = query_string_from_args (ctx, argc - opt_index, argv + opt_index);
\r
408 if (query_string == NULL) {
\r
409 fprintf (stderr, "Out of memory\n");
\r
411 @@ -695,7 +683,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
\r
412 notmuch_database_close (notmuch);
\r
414 if (params.cryptoctx)
\r
415 - g_object_unref(params.cryptoctx);
\r
416 + g_object_unref (params.cryptoctx);
\r