From: David Bremner <brem...@debian.org> This patch shows the raw result of running uncrustify on notmuch-reply.c. The re-indenting of "format_reply" would probably not be desirable. --- notmuch-reply.c | 160 +++++++++++++++++++++++++----------------------------- 1 files changed, 74 insertions(+), 86 deletions(-)
diff --git a/notmuch-reply.c b/notmuch-reply.c index 000f6da..00c9923 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -32,17 +32,17 @@ reply_part_content (GMimeObject *part); static const notmuch_show_format_t format_reply = { "", - "", NULL, - "", NULL, reply_headers_message_part, ">\n", - "", - NULL, - NULL, - NULL, - reply_part_content, - NULL, - "", - "", - "", "", + "", NULL, + "", NULL, reply_headers_message_part, ">\n", + "", + NULL, + NULL, + NULL, + reply_part_content, + NULL, + "", + "", + "", "", "" }; @@ -54,14 +54,14 @@ show_reply_headers (GMimeMessage *message) stream_stdout = g_mime_stream_file_new (stdout); if (stream_stdout) { g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE); - stream_filter = g_mime_stream_filter_new(stream_stdout); + stream_filter = g_mime_stream_filter_new (stream_stdout); if (stream_filter) { - g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter), - g_mime_filter_headers_new()); - g_mime_object_write_to_stream(GMIME_OBJECT(message), stream_filter); - g_object_unref(stream_filter); + g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter), + g_mime_filter_headers_new ()); + g_mime_object_write_to_stream (GMIME_OBJECT (message), stream_filter); + g_object_unref (stream_filter); } - g_object_unref(stream_stdout); + g_object_unref (stream_stdout); } } @@ -94,18 +94,13 @@ reply_part_content (GMimeObject *part) GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (part); if (g_mime_content_type_is_type (content_type, "multipart", "*") || - g_mime_content_type_is_type (content_type, "message", "rfc822")) - { + g_mime_content_type_is_type (content_type, "message", "rfc822")) { /* Output nothing, since multipart subparts will be handled individually. */ - } - else if (g_mime_content_type_is_type (content_type, "application", "pgp-encrypted") || - g_mime_content_type_is_type (content_type, "application", "pgp-signature")) - { + } else if (g_mime_content_type_is_type (content_type, "application", "pgp-encrypted") || + g_mime_content_type_is_type (content_type, "application", "pgp-signature")) { /* Ignore PGP/MIME cruft parts */ - } - else if (g_mime_content_type_is_type (content_type, "text", "*") && - !g_mime_content_type_is_type (content_type, "text", "html")) - { + } else if (g_mime_content_type_is_type (content_type, "text", "*") && + !g_mime_content_type_is_type (content_type, "text", "html")) { GMimeStream *stream_stdout = NULL, *stream_filter = NULL; GMimeDataWrapper *wrapper; const char *charset; @@ -114,33 +109,28 @@ reply_part_content (GMimeObject *part) stream_stdout = g_mime_stream_file_new (stdout); if (stream_stdout) { g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE); - stream_filter = g_mime_stream_filter_new(stream_stdout); + stream_filter = g_mime_stream_filter_new (stream_stdout); if (charset) { - g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter), - g_mime_filter_charset_new(charset, "UTF-8")); + g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter), + g_mime_filter_charset_new (charset, "UTF-8")); } } - g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter), - g_mime_filter_reply_new(TRUE)); + g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter), + g_mime_filter_reply_new (TRUE)); wrapper = g_mime_part_get_content_object (GMIME_PART (part)); if (wrapper && stream_filter) g_mime_data_wrapper_write_to_stream (wrapper, stream_filter); if (stream_filter) - g_object_unref(stream_filter); + g_object_unref (stream_filter); if (stream_stdout) - g_object_unref(stream_stdout); - } - else - { + g_object_unref (stream_stdout); + } else { if (disposition && - strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0) - { + strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0) { const char *filename = g_mime_part_get_filename (GMIME_PART (part)); printf ("Attachment: %s (%s)\n", filename, g_mime_content_type_to_string (content_type)); - } - else - { + } else { printf ("Non-text part: %s\n", g_mime_content_type_to_string (content_type)); } @@ -276,8 +266,7 @@ reply_to_header_is_redundant (notmuch_message_t *message) cc = notmuch_message_get_header (message, "cc"); if ((to && strstr (to, addr) != 0) || - (cc && strstr (cc, addr) != 0)) - { + (cc && strstr (cc, addr) != 0)) { return 1; } @@ -345,16 +334,16 @@ add_recipients_from_message (GMimeMessage *reply, static const char * guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message) { - const char *received,*primary,*by; + const char *received, *primary, *by; const char **other; char *tohdr; - char *mta,*ptr,*token; - char *domain=NULL; - char *tld=NULL; - const char *delim=". \t"; - size_t i,j,other_len; + char *mta, *ptr, *token; + char *domain = NULL; + char *tld = NULL; + const char *delim = ". \t"; + size_t i, j, other_len; - const char *to_headers[] = {"Envelope-to", "X-Original-To"}; + const char *to_headers[] = { "Envelope-to", "X-Original-To" }; primary = notmuch_config_get_user_primary_email (config); other = notmuch_config_get_user_other_email (config, &other_len); @@ -373,22 +362,22 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message * 'by' part of Received headers * If none of these work, we give up and return NULL */ - for (i = 0; i < sizeof(to_headers)/sizeof(*to_headers); i++) { - tohdr = xstrdup(notmuch_message_get_header (message, to_headers[i])); + for (i = 0; i < sizeof(to_headers) / sizeof(*to_headers); i++) { + tohdr = xstrdup (notmuch_message_get_header (message, to_headers[i])); if (tohdr && *tohdr) { /* tohdr is potentialy a list of email addresses, so here we * check if one of the email addresses is a substring of tohdr */ - if (strcasestr(tohdr, primary)) { - free(tohdr); + if (strcasestr (tohdr, primary)) { + free (tohdr); return primary; } for (j = 0; j < other_len; j++) if (strcasestr (tohdr, other[j])) { - free(tohdr); + free (tohdr); return other[j]; } - free(tohdr); + free (tohdr); } } @@ -412,7 +401,7 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message * so again we check if one of the email addresses is a * substring of ptr */ - if (strcasestr(ptr, primary)) { + if (strcasestr (ptr, primary)) { return primary; } for (i = 0; i < other_len; i++) @@ -430,12 +419,12 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message * system in this step of the receive chain */ by = received; - while((by = strstr (by, " by ")) != NULL) { + while ((by = strstr (by, " by ")) != NULL) { by += 4; if (*by == '\0') break; mta = xstrdup (by); - token = strtok(mta," \t"); + token = strtok (mta, " \t"); if (token == NULL) { free (mta); break; @@ -458,15 +447,15 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message * the test is the other way around: we check if this is a * substring of one of the email addresses. */ - *(tld-1) = '.'; + *(tld - 1) = '.'; - if (strcasestr(primary, domain)) { - free(mta); + if (strcasestr (primary, domain)) { + free (mta); return primary; } for (i = 0; i < other_len; i++) - if (strcasestr (other[i],domain)) { - free(mta); + if (strcasestr (other[i], domain)) { + free (mta); return other[i]; } } @@ -477,10 +466,10 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message } static int -notmuch_reply_format_default(void *ctx, - notmuch_config_t *config, - notmuch_query_t *query, - notmuch_show_params_t *params) +notmuch_reply_format_default (void *ctx, + notmuch_config_t *config, + notmuch_query_t *query, + notmuch_show_params_t *params) { GMimeMessage *reply; notmuch_messages_t *messages; @@ -491,8 +480,7 @@ notmuch_reply_format_default(void *ctx, for (messages = notmuch_query_search_messages (query); notmuch_messages_valid (messages); - notmuch_messages_move_to_next (messages)) - { + notmuch_messages_move_to_next (messages)) { message = notmuch_messages_get (messages); /* The 1 means we want headers in a "pretty" order. */ @@ -524,7 +512,7 @@ notmuch_reply_format_default(void *ctx, "From", from_addr); in_reply_to = talloc_asprintf (ctx, "<%s>", - notmuch_message_get_message_id (message)); + notmuch_message_get_message_id (message)); g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to); @@ -555,10 +543,10 @@ notmuch_reply_format_default(void *ctx, /* This format is currently tuned for a git send-email --notmuch hook */ static int -notmuch_reply_format_headers_only(void *ctx, - notmuch_config_t *config, - notmuch_query_t *query, - unused (notmuch_show_params_t *params)) +notmuch_reply_format_headers_only (void *ctx, + notmuch_config_t *config, + notmuch_query_t *query, + unused (notmuch_show_params_t * params)) { GMimeMessage *reply; notmuch_messages_t *messages; @@ -568,8 +556,7 @@ notmuch_reply_format_headers_only(void *ctx, for (messages = notmuch_query_search_messages (query); notmuch_messages_valid (messages); - notmuch_messages_move_to_next (messages)) - { + notmuch_messages_move_to_next (messages)) { message = notmuch_messages_get (messages); /* The 0 means we do not want headers in a "pretty" order. */ @@ -580,16 +567,16 @@ notmuch_reply_format_headers_only(void *ctx, } in_reply_to = talloc_asprintf (ctx, "<%s>", - notmuch_message_get_message_id (message)); + notmuch_message_get_message_id (message)); - g_mime_object_set_header (GMIME_OBJECT (reply), + g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to); orig_references = notmuch_message_get_header (message, "references"); /* We print In-Reply-To followed by References because git format-patch treats them - * specially. Git does not interpret the other headers specially + * specially. Git does not interpret the other headers specially */ references = talloc_asprintf (ctx, "%s%s%s", orig_references ? orig_references : "", @@ -598,7 +585,7 @@ notmuch_reply_format_headers_only(void *ctx, g_mime_object_set_header (GMIME_OBJECT (reply), "References", references); - (void)add_recipients_from_message (reply, config, message); + (void) add_recipients_from_message (reply, config, message); reply_headers = g_mime_object_to_string (GMIME_OBJECT (reply)); printf ("%s", reply_headers); @@ -625,6 +612,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) notmuch_query_t *query; char *query_string; int opt_index, ret = 0; + int (*reply_format_func)(void *ctx, notmuch_config_t *config, notmuch_query_t *query, notmuch_show_params_t *params); notmuch_show_params_t params = { .part = -1 }; int format = FORMAT_DEFAULT; @@ -651,10 +639,10 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) reply_format_func = notmuch_reply_format_default; if (decrypt) { - GMimeSession* session = g_object_new (g_mime_session_get_type(), NULL); + GMimeSession* session = g_object_new (g_mime_session_get_type (), NULL); params.cryptoctx = g_mime_gpg_context_new (session, "gpg"); if (params.cryptoctx) { - g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) params.cryptoctx, FALSE); + g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) params.cryptoctx, FALSE); params.decrypt = TRUE; } else { fprintf (stderr, "Failed to construct gpg context.\n"); @@ -666,7 +654,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) if (config == NULL) return 1; - query_string = query_string_from_args (ctx, argc-opt_index, argv+opt_index); + query_string = query_string_from_args (ctx, argc - opt_index, argv + opt_index); if (query_string == NULL) { fprintf (stderr, "Out of memory\n"); return 1; @@ -695,7 +683,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) notmuch_database_close (notmuch); if (params.cryptoctx) - g_object_unref(params.cryptoctx); + g_object_unref (params.cryptoctx); return ret; } -- 1.7.7.3 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch