- /* Stream the MIME part out to stdout. */
- stream = g_mime_stream_file_new (stdout);
- g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream), FALSE);
+ content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
+
+ printf ("%%part{ ID: %d, Content-type: %s\n",
+ *part_count,
+ g_mime_content_type_to_string (content_type));
+
+ if (g_mime_content_type_is_type (content_type, "text", "*") &&
+ !g_mime_content_type_is_type (content_type, "text", "html"))
+ {
+ stream = g_mime_stream_file_new (stdout);
+ g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream), FALSE);
+
+ wrapper = g_mime_part_get_content_object (GMIME_PART (part));
+ if (wrapper)
+ g_mime_data_wrapper_write_to_stream (wrapper, stream);
+ }