X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=show-message.c;h=4ccd449018850c417c5a324b3952e1767389aa4e;hp=3c29f26a0490cc951c73aba727eee88bd23b4913;hb=ecae541031911b65594c3ec757abb671583e8872;hpb=02ec2e420c36957fbd903c424b69a9690b400671 diff --git a/show-message.c b/show-message.c index 3c29f26a..4ccd4490 100644 --- a/show-message.c +++ b/show-message.c @@ -28,44 +28,37 @@ show_message_part (GMimeObject *part, const notmuch_show_format_t *format, int first) { + *part_count += 1; + + if (! (GMIME_IS_PART (part) || GMIME_IS_MULTIPART (part) || GMIME_IS_MESSAGE_PART (part))) { + fprintf (stderr, "Warning: Not displaying unknown mime part: %s.\n", + g_type_name (G_OBJECT_TYPE (part))); + return; + } + + if (!first) + fputs (format->part_sep, stdout); + + format->part (part, part_count); + if (GMIME_IS_MULTIPART (part)) { GMimeMultipart *multipart = GMIME_MULTIPART (part); int i; - *part_count = *part_count + 1; - format->part (part, part_count, first); - for (i = 0; i < g_mime_multipart_get_count (multipart); i++) { show_message_part (g_mime_multipart_get_part (multipart, i), part_count, format, i == 0); } - if (format->part_end) - format->part_end (part); - - return; - } - - if (GMIME_IS_MESSAGE_PART (part)) { + } else if (GMIME_IS_MESSAGE_PART (part)) { GMimeMessage *mime_message; mime_message = g_mime_message_part_get_message (GMIME_MESSAGE_PART (part)); show_message_part (g_mime_message_get_mime_part (mime_message), part_count, format, first); - - return; - } - - if (! (GMIME_IS_PART (part))) { - fprintf (stderr, "Warning: Not displaying unknown mime part: %s.\n", - g_type_name (G_OBJECT_TYPE (part))); - return; } - *part_count = *part_count + 1; - - format->part (part, part_count, first); if (format->part_end) format->part_end (part); }