[evolution/gnome-3-4] Attached images not shown in text/html within multipart/mixed



commit c40339cf1db1244e6aada0267e4a36ac8691a106
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 24 10:40:22 2012 +0200

    Attached images not shown in text/html within multipart/mixed
    
    This should work like multipart/related, but if a mailer sends
    multipart/mixed with text/html and image/* parts, where the html
    part looks for the image (with cid:...) then these were not found
    and html part showed image as missing.

 mail/em-format-html.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 3c130e6..6c4c2d7 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -1703,6 +1703,12 @@ badurl:
 /* ********************************************************************** */
 
 static void
+emfh_write_related (EMFormat *emf,
+                    CamelStream *stream,
+                    EMFormatPURI *puri,
+                    GCancellable *cancellable);
+
+static void
 efh_url_requested (GtkHTML *html,
                    const gchar *url,
                    GtkHTMLStream *handle,
@@ -1714,6 +1720,26 @@ efh_url_requested (GtkHTML *html,
 	d(printf("url requested, html = %p, url '%s'\n", html, url));
 
 	puri = em_format_find_visible_puri ((EMFormat *) efh, url);
+	if (!puri && url && g_str_has_prefix (url, "cid:")) {
+		GHashTableIter iter;
+		gpointer key, value;
+
+		g_hash_table_iter_init (&iter, ((EMFormat *) efh)->pending_uri_table);
+		while (g_hash_table_iter_next (&iter, &key, &value)) {
+			puri = value;
+
+			if (puri->part && g_strcmp0 (url + 4, camel_mime_part_get_content_id (puri->part)) == 0)
+				break;
+
+			puri = NULL;
+		}
+
+		if (puri) {
+			/* it's expected as cid:, with its content, thus write it as such */
+			puri->func = emfh_write_related;
+		}
+	}
+
 	if (puri) {
 		CamelDataWrapper *dw = camel_medium_get_content ((CamelMedium *) puri->part);
 		CamelContentType *ct = dw ? dw->mime_type : NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]