From 6ce4413006e2ebd82c9e03d90bfa707c2ed371ee Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 24 Sep 2004 04:09:10 +0000 Subject: ** See bug #65058 (again again). 2004-09-23 Not Zed ** See bug #65058 (again again). * em-format-html.c (efh_text_html): calculate our location uri ourselves (content id). * em-format.c (em_format_add_puri): if we have no content-location key, don't fallback to any container's location. svn path=/trunk/; revision=27356 --- mail/ChangeLog | 10 ++++++++++ mail/em-format-html.c | 33 ++++++++++++++++++++++++++++----- mail/em-format.c | 3 +-- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index fd35b59830..4f371628a5 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2004-09-23 Not Zed + + ** See bug #65058 (again again). + + * em-format-html.c (efh_text_html): calculate our location uri + ourselves (content id). + + * em-format.c (em_format_add_puri): if we have no content-location + key, don't fallback to any container's location. + 2004-09-23 Not Zed * em-folder-tree.c (emft_get_folder_info__desc): describe the diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 7c362c5f4c..503a3053e2 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -795,8 +795,9 @@ efh_write_text_html(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) static void efh_text_html(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) { - const char *location, *base; + const char *location, *base, *tmp; EMFormatPURI *puri; + char *cid = NULL; camel_stream_printf (stream, "
\n" @@ -821,14 +822,36 @@ efh_text_html(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFor gtk_html_set_base(efh->html, base); } - puri = em_format_add_puri((EMFormat *)efh, sizeof(EMFormatPURI), NULL, part, efh_write_text_html); - location = puri->uri?puri->uri:puri->cid; - d(printf("adding iframe, location %s\n", location)); + /* calculate our own location string so add_puri doesn't do it + for us. our iframes are special cases, we need to use the + proper base url to access them, but other children parts + shouldn't blindly inherit the container's location. */ + tmp = camel_mime_part_get_content_location(part); + if (tmp == NULL) { + if (((EMFormat *)efh)->base) + cid = camel_url_to_string(((EMFormat *)efh)->base, 0); + else + cid = g_strdup(((EMFormat *)efh)->part_id->str); + } else { + if (strchr(tmp, ':') == NULL && ((EMFormat *)efh)->base != NULL) { + CamelURL *uri; + + uri = camel_url_new_with_base(((EMFormat *)efh)->base, tmp); + cid = camel_url_to_string(uri, 0); + camel_url_free(uri); + } else { + cid = g_strdup(tmp); + } + } + + puri = em_format_add_puri((EMFormat *)efh, sizeof(EMFormatPURI), cid, part, efh_write_text_html); + d(printf("adding iframe, location %s\n", cid)); camel_stream_printf(stream, "\n" "
\n" "\n", - location, location); + cid, cid); + g_free(cid); } /* This is a lot of code for something useless ... */ diff --git a/mail/em-format.c b/mail/em-format.c index 39b039e2b6..df5ca50e65 100644 --- a/mail/em-format.c +++ b/mail/em-format.c @@ -354,8 +354,7 @@ em_format_add_puri(EMFormat *emf, size_t size, const char *cid, CamelMimePart *p tmp = camel_mime_part_get_content_location(part); puri->uri = NULL; if (tmp == NULL) { - if (emf->base) - puri->uri = camel_url_to_string(emf->base, 0); + /* no location, don't set a uri at all, html parts do this themselves */ } else { if (strchr(tmp, ':') == NULL && emf->base != NULL) { CamelURL *uri; -- cgit v1.2.3