Print "part" markers for each MIME part (with Content-type).

This can allow for the client to hide undesired MIME parts
such as text/html.
This commit is contained in:
Carl Worth 2009-11-02 13:27:34 -08:00
parent ab317ca474
commit d6615b554e
2 changed files with 14 additions and 4 deletions

2
TODO
View file

@ -1,5 +1,3 @@
Fix "notmuch show" to actually MIME-decode messages.
Add support to format a reply buffer for a particular message.
Add feedback for tag addition/removal to notmuch.el.

View file

@ -904,6 +904,7 @@ show_message_part (GMimeObject *part)
GMimeStream *stream;
GMimeDataWrapper *wrapper;
GMimeContentDisposition *disposition;
GMimeContentType *content_type;
if (GMIME_IS_MULTIPART (part)) {
GMimeMultipart *multipart = GMIME_MULTIPART (part);
@ -943,13 +944,22 @@ show_message_part (GMimeObject *part)
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));
printf ("%%attachment{ Content-type: %s\n",
g_mime_content_type_to_string (content_type));
printf ("%s\n", filename);
printf ("%%attachment}\n");
/* XXX: Need to print content type here as well. */
printf ("%%attachment{ %s %%attachment}\n", filename);
return;
}
/* Stream the MIME part out to stdout. */
content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
printf ("%%part{ Content-type: %s\n",
g_mime_content_type_to_string (content_type));
stream = g_mime_stream_file_new (stdout);
g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream), FALSE);
@ -957,6 +967,8 @@ show_message_part (GMimeObject *part)
if (wrapper)
g_mime_data_wrapper_write_to_stream (wrapper, stream);
printf ("%%part}\n");
g_object_unref (stream);
}