\n", cancellable, NULL); /* output some info about it */ text = em_format_describe_part (part, mime_type); html = camel_text_to_html ( text, emfq->text_html_flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0); camel_stream_write_string (stream, html, cancellable, NULL); g_free (html); g_free (text); camel_stream_write_string ( stream, " |
\n"); if (((CamelMimePart *) emf->message) != part) { camel_stream_printf ( stream, "%s\n", _("-------- Forwarded Message --------")); emfq_format_headers (emfq, stream, (CamelMedium *) part); } else if (emfq->flags & EM_FORMAT_QUOTE_HEADERS) emfq_format_headers (emfq, stream, (CamelMedium *) part); em_format_part (emf, stream, part, cancellable); if (emfq->flags & EM_FORMAT_QUOTE_CITE) camel_stream_write_string ( stream, "", cancellable, NULL); } /* Decodes inline encoded parts of 'part'. The returned pointer, * if not NULL, should be unreffed with g_object_unref(). */ static CamelMimePart * decode_inline_parts (CamelMimePart *part, GCancellable *cancellable) { CamelMultipart *mp; CamelStream *null; CamelStream *filtered_stream; EMInlineFilter *inline_filter; g_return_val_if_fail (part != NULL, NULL); null = camel_stream_null_new (); filtered_stream = camel_stream_filter_new (null); g_object_unref (null); inline_filter = em_inline_filter_new ( camel_mime_part_get_encoding (part), camel_mime_part_get_content_type (part)); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), CAMEL_MIME_FILTER (inline_filter)); camel_data_wrapper_decode_to_stream_sync ( camel_medium_get_content (CAMEL_MEDIUM (part)), filtered_stream, cancellable, NULL); camel_stream_close (filtered_stream, cancellable, NULL); g_object_unref (filtered_stream); if (!em_inline_filter_found_any (inline_filter)) { g_object_unref (inline_filter); return NULL; } mp = em_inline_filter_get_multipart (inline_filter); g_object_unref (inline_filter); if (mp) { part = camel_mime_part_new (); camel_medium_set_content ( CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (mp)); g_object_unref (mp); } else { g_object_ref (part); } return part; } static void emfq_text_plain (EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info, GCancellable *cancellable, gboolean is_fallback) { EMFormatQuote *emfq = EM_FORMAT_QUOTE (emf); CamelStream *filtered_stream; CamelMimeFilter *html_filter; CamelMimeFilter *sig_strip; CamelMimePart *mp; CamelContentType *type; const gchar *format; guint32 rgb = 0x737373, flags; if (!part) return; mp = decode_inline_parts (part, cancellable); if (mp) { if (CAMEL_IS_MULTIPART (camel_medium_get_content (CAMEL_MEDIUM (mp)))) { em_format_part (emf, stream, mp, cancellable); g_object_unref (mp); return; } g_object_unref (mp); } flags = emfq->text_html_flags; /* Check for RFC 2646 flowed text. */ type = camel_mime_part_get_content_type (part); if (camel_content_type_is(type, "text", "plain") && (format = camel_content_type_param(type, "format")) && !g_ascii_strcasecmp(format, "flowed")) flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED; filtered_stream = camel_stream_filter_new (stream); if ((emfq->flags & EM_FORMAT_QUOTE_KEEP_SIG) == 0) { sig_strip = em_stripsig_filter_new (TRUE); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), sig_strip); g_object_unref (sig_strip); } html_filter = camel_mime_filter_tohtml_new (flags, rgb); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), html_filter); g_object_unref (html_filter); em_format_format_text ( EM_FORMAT (emfq), filtered_stream, CAMEL_DATA_WRAPPER (part), cancellable); camel_stream_flush (filtered_stream, cancellable, NULL); g_object_unref (filtered_stream); } static void emfq_text_enriched (EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info, GCancellable *cancellable, gboolean is_fallback) { CamelStream *filtered_stream; CamelMimeFilter *enriched; guint32 flags = 0; if (g_strcmp0 (info->mime_type, "text/richtext") == 0) { flags = CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT; camel_stream_write_string ( stream, "\n\n", cancellable, NULL); } else { camel_stream_write_string ( stream, "\n\n", cancellable, NULL); } enriched = camel_mime_filter_enriched_new (flags); filtered_stream = camel_stream_filter_new (stream); camel_stream_filter_add ( CAMEL_STREAM_FILTER (filtered_stream), enriched); g_object_unref (enriched); camel_stream_write_string (stream, "