aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-format.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-11-03 10:40:39 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-11-03 10:40:39 +0800
commit1335b50751b46bde7e458138e2becbd8f7b69b9b (patch)
tree000acd05dea99f413b078dd774eb03b508bacb3e /mail/em-format.c
parent26139115b4cadd29b0a7eb35826214cbf0375b92 (diff)
downloadgsoc2013-evolution-1335b50751b46bde7e458138e2becbd8f7b69b9b.tar
gsoc2013-evolution-1335b50751b46bde7e458138e2becbd8f7b69b9b.tar.gz
gsoc2013-evolution-1335b50751b46bde7e458138e2becbd8f7b69b9b.tar.bz2
gsoc2013-evolution-1335b50751b46bde7e458138e2becbd8f7b69b9b.tar.lz
gsoc2013-evolution-1335b50751b46bde7e458138e2becbd8f7b69b9b.tar.xz
gsoc2013-evolution-1335b50751b46bde7e458138e2becbd8f7b69b9b.tar.zst
gsoc2013-evolution-1335b50751b46bde7e458138e2becbd8f7b69b9b.zip
revert jeff's last change - we do actually want to know when we couldn't
2004-11-03 Not Zed <NotZed@Ximian.com> * em-folder-view.c (emfv_list_done_message_selected): revert jeff's last change - we do actually want to know when we couldn't load a message. the crash he was fixing was fixed elsewhere. also fix the unref ordering stuff. * em-format-html.c (efh_format_timeout): removed the fixme i added. 2004-11-01 Not Zed <NotZed@Ximian.com> ** See bug #67496. * em-format-html.c (efh_text_html): use the base on the emformat to calculate our absolute iframe uri. (efh_multipart_related): same as emf_multipart_related. * em-format.c (emf_multipart_related): remove content-location handling, now done in format_part_as. (em_format_part_as): track content-base (& absolute content-location) of all parts here. svn path=/trunk/; revision=27807
Diffstat (limited to 'mail/em-format.c')
-rw-r--r--mail/em-format.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/mail/em-format.c b/mail/em-format.c
index df5ca50e65..73bba36e57 100644
--- a/mail/em-format.c
+++ b/mail/em-format.c
@@ -538,10 +538,32 @@ void
em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const char *mime_type)
{
const EMFormatHandler *handle = NULL;
- const char *snoop_save = emf->snoop_mime_type;
+ const char *snoop_save = emf->snoop_mime_type, *tmp;
+ CamelURL *base_save = emf->base, *base = NULL;
+ char *basestr = NULL;
+
+ d(printf("format_part_as()\n"));
emf->snoop_mime_type = NULL;
+ /* RFC 2110, we keep track of content-base, and absolute content-location headers
+ This is actually only required for html, but, *shrug* */
+ tmp = camel_medium_get_header((CamelMedium *)part, "Content-Base");
+ if (tmp == NULL) {
+ tmp = camel_mime_part_get_content_location(part);
+ if (tmp && strchr(tmp, ':') == NULL)
+ tmp = NULL;
+ } else {
+ tmp = basestr = camel_header_location_decode(tmp);
+ }
+ printf("content-base is '%s'\n", tmp?tmp:"<unset>");
+ if (tmp
+ && (base = camel_url_new(tmp, NULL))) {
+ emf->base = base;
+ d(printf("Setting content base '%s'\n", tmp));
+ }
+ g_free(basestr);
+
if (mime_type != NULL) {
if (g_ascii_strcasecmp(mime_type, "application/octet-stream") == 0)
emf->snoop_mime_type = mime_type = em_utils_snoop_type(part);
@@ -554,8 +576,7 @@ em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const
&& !em_format_is_attachment(emf, part)) {
d(printf("running handler for type '%s'\n", mime_type));
handle->handler(emf, stream, part, handle);
- emf->snoop_mime_type = snoop_save;
- return;
+ goto finish;
}
d(printf("this type is an attachment? '%s'\n", mime_type));
} else {
@@ -563,7 +584,12 @@ em_format_part_as(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const
}
((EMFormatClass *)G_OBJECT_GET_CLASS(emf))->format_attachment(emf, stream, part, mime_type, handle);
+finish:
+ emf->base = base_save;
emf->snoop_mime_type = snoop_save;
+
+ if (base)
+ camel_url_free(base);
}
void
@@ -1278,10 +1304,9 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)part);
CamelMimePart *body_part, *display_part = NULL;
CamelContentType *content_type;
- const char *location, *start;
+ const char *start;
int i, nparts, partidlen, displayid = 0;
char *oldpartid;
- CamelURL *base_save = NULL;
struct _EMFormatPURITree *ptree;
EMFormatPURI *puri, *purin;
@@ -1321,13 +1346,6 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
return;
}
- /* stack of present location and pending uri's */
- location = camel_mime_part_get_content_location(part);
- if (location) {
- d(printf("setting content location %s\n", location));
- base_save = emf->base;
- emf->base = camel_url_new(location, NULL);
- }
em_format_push_level(emf);
oldpartid = g_strdup(emf->part_id->str);
@@ -1370,11 +1388,6 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
g_free(oldpartid);
em_format_pull_level(emf);
-
- if (location) {
- camel_url_free(emf->base);
- emf->base = base_save;
- }
}
static void