aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-07-01 22:47:10 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-07-01 22:47:10 +0800
commit1351c8e4fb443a9705bb1225c3c574c05a36f8ca (patch)
treee049bafefac361ae66dfa43abdb956f1f3a730e0 /em-format
parent624f48121f523101fe26c3d3a8b51a4eeda90990 (diff)
parent42e75c9162402078ac629740821c3533925ee342 (diff)
downloadgsoc2013-evolution-1351c8e4fb443a9705bb1225c3c574c05a36f8ca.tar
gsoc2013-evolution-1351c8e4fb443a9705bb1225c3c574c05a36f8ca.tar.gz
gsoc2013-evolution-1351c8e4fb443a9705bb1225c3c574c05a36f8ca.tar.bz2
gsoc2013-evolution-1351c8e4fb443a9705bb1225c3c574c05a36f8ca.tar.lz
gsoc2013-evolution-1351c8e4fb443a9705bb1225c3c574c05a36f8ca.tar.xz
gsoc2013-evolution-1351c8e4fb443a9705bb1225c3c574c05a36f8ca.tar.zst
gsoc2013-evolution-1351c8e4fb443a9705bb1225c3c574c05a36f8ca.zip
Merge branch 'master' into kill-bonobo
Diffstat (limited to 'em-format')
-rw-r--r--em-format/em-format.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/em-format/em-format.c b/em-format/em-format.c
index 585b611e66..9540067602 100644
--- a/em-format/em-format.c
+++ b/em-format/em-format.c
@@ -1672,6 +1672,73 @@ emf_multipart_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, co
}
}
+/* RFC 4155 */
+static void
+emf_application_mbox (EMFormat *emf,
+ CamelStream *stream,
+ CamelMimePart *mime_part,
+ const EMFormatHandler *info)
+{
+ const EMFormatHandler *handle;
+ CamelMimeParser *parser;
+ CamelStream *mem_stream;
+ camel_mime_parser_state_t state;
+
+ /* Extract messages from the application/mbox part and
+ * render them as a flat list of messages. */
+
+ /* XXX If the mbox has multiple messages, maybe render them
+ * as a multipart/digest so each message can be expanded
+ * or collapsed individually.
+ *
+ * See attachment_handler_mail_x_uid_list() for example. */
+
+ /* XXX This is based on em_utils_read_messages_from_stream().
+ * Perhaps refactor that function to return an array of
+ * messages instead of assuming we want to append them
+ * to a folder? */
+
+ handle = em_format_find_handler (emf, "x-evolution/message/rfc822");
+ g_return_if_fail (handle != NULL);
+
+ parser = camel_mime_parser_new ();
+ camel_mime_parser_scan_from (parser, TRUE);
+
+ mem_stream = camel_stream_mem_new ();
+ camel_data_wrapper_decode_to_stream (
+ CAMEL_DATA_WRAPPER (mime_part), mem_stream);
+ camel_seekable_stream_seek (
+ CAMEL_SEEKABLE_STREAM (mem_stream), 0, CAMEL_STREAM_SET);
+ camel_mime_parser_init_with_stream (parser, mem_stream);
+ camel_object_unref (mem_stream);
+
+ /* Extract messages from the mbox. */
+ state = camel_mime_parser_step (parser, NULL, NULL);
+ while (state == CAMEL_MIME_PARSER_STATE_FROM) {
+ CamelMimeMessage *message;
+
+ message = camel_mime_message_new ();
+ mime_part = CAMEL_MIME_PART (message);
+
+ if (camel_mime_part_construct_from_parser (mime_part, parser) == -1) {
+ camel_object_unref (message);
+ break;
+ }
+
+ /* Render the message. */
+ handle->handler (emf, stream, mime_part, handle);
+
+ camel_object_unref (message);
+
+ /* Skip past CAMEL_MIME_PARSER_STATE_FROM_END. */
+ state = camel_mime_parser_step (parser, NULL, NULL);
+
+ state = camel_mime_parser_step (parser, NULL, NULL);
+ }
+
+ camel_object_unref (parser);
+}
+
static void
emf_message_rfc822(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info)
{
@@ -1835,6 +1902,7 @@ static EMFormatHandler type_builtin_table[] = {
#ifdef ENABLE_SMIME
{ (gchar *) "application/x-pkcs7-mime", (EMFormatFunc)emf_application_xpkcs7mime, EM_FORMAT_HANDLER_INLINE_DISPOSITION },
#endif
+ { (gchar *) "application/mbox", emf_application_mbox, EM_FORMAT_HANDLER_INLINE },
{ (gchar *) "multipart/alternative", emf_multipart_alternative },
{ (gchar *) "multipart/appledouble", emf_multipart_appledouble },
{ (gchar *) "multipart/encrypted", emf_multipart_encrypted },