X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-reply.c;h=5d72b1fd71022ae52c579e6c2734d7c0a6e190bd;hp=23d04b8b1ea01083de530204bc4b95eeaaf130c5;hb=03ac922c4b4b542658a1c20e152df0ed63299c81;hpb=c6e70e15eaf7355fb9fe9b599aef07f2be619968 diff --git a/notmuch-reply.c b/notmuch-reply.c index 23d04b8b..5d72b1fd 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -24,6 +24,19 @@ #include "gmime-filter-reply.h" #include "gmime-filter-headers.h" +static void +reply_part (GMimeObject *part, + unused (int *part_count)); + +static const notmuch_show_format_t format_reply = { + NULL, + NULL, NULL, + NULL, NULL, NULL, + NULL, reply_part, NULL, NULL, NULL, + NULL, NULL, + NULL +}; + static void reply_part_content (GMimeObject *part) { @@ -72,34 +85,11 @@ show_reply_headers (GMimeMessage *message) } static void -reply_part (GMimeObject *part, int *part_count) +reply_part (GMimeObject *part, + unused (int *part_count)) { - GMimeContentDisposition *disposition; - GMimeContentType *content_type; - - (void) part_count; - disposition = g_mime_object_get_content_disposition (part); - if (disposition && - strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0) - { - const char *filename = g_mime_part_get_filename (GMIME_PART (part)); - content_type = g_mime_object_get_content_type (GMIME_OBJECT (part)); - - if (g_mime_content_type_is_type (content_type, "text", "*") && - !g_mime_content_type_is_type (content_type, "text", "html")) - { - reply_part_content (part); - } - else - { - printf ("Attachment: %s (%s)\n", filename, - g_mime_content_type_to_string (content_type)); - } - - return; - } - - content_type = g_mime_object_get_content_type (GMIME_OBJECT (part)); + GMimeContentType *content_type = g_mime_object_get_content_type (GMIME_OBJECT (part)); + GMimeContentDisposition *disposition = g_mime_object_get_content_disposition (part); if (g_mime_content_type_is_type (content_type, "text", "*") && !g_mime_content_type_is_type (content_type, "text", "html")) @@ -108,8 +98,18 @@ reply_part (GMimeObject *part, int *part_count) } else { - printf ("Non-text part: %s\n", - g_mime_content_type_to_string (content_type)); + if (disposition && + 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 + { + printf ("Non-text part: %s\n", + g_mime_content_type_to_string (content_type)); + } } } @@ -447,6 +447,9 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_ notmuch_message_t *message; const char *subject, *from_addr = NULL; const char *in_reply_to, *orig_references, *references; + const notmuch_show_format_t *format = &format_reply; + notmuch_show_params_t params; + params.part = -1; for (messages = notmuch_query_search_messages (query); notmuch_messages_valid (messages); @@ -505,7 +508,8 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_ notmuch_message_get_header (message, "date"), notmuch_message_get_header (message, "from")); - show_message_body (notmuch_message_get_filename (message), reply_part); + show_message_body (notmuch_message_get_filename (message), + format, ¶ms); notmuch_message_destroy (message); }