diff options
author | Carl Worth <cworth@cworth.org> | 2009-11-02 13:27:34 -0800 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2009-11-02 13:41:04 -0800 |
commit | d6615b554e6ade878d3bc3caf9ff93be1a4cf143 (patch) | |
tree | 4e1ba3ac05bac0e7a91fc86fadfd516c84714cf8 /notmuch.c | |
parent | ab317ca474d2e6bade79eebc00c5e548b8df0c24 (diff) |
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.
Diffstat (limited to 'notmuch.c')
-rw-r--r-- | notmuch.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -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); } |