aboutsummaryrefslogtreecommitdiffstats
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
parent26139115b4cadd29b0a7eb35826214cbf0375b92 (diff)
downloadgsoc2013-evolution-1335b50751b46bde7e458138e2becbd8f7b69b9b.tar.gz
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
-rw-r--r--mail/ChangeLog28
-rw-r--r--mail/em-event.c12
-rw-r--r--mail/em-folder-view.c7
-rw-r--r--mail/em-format-html.c46
-rw-r--r--mail/em-format.c47
-rw-r--r--mail/em-format.h2
6 files changed, 78 insertions, 64 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 175fbd6b01..77ac356c32 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,31 @@
+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.
+
+2004-11-02 Not Zed <NotZed@Ximian.com>
+
+ * em-event.c (eme_target_free, em_event_target_new_message):
+ handle NULL folder or message.
+
2004-11-02 Jeffrey Stedfast <fejj@novell.com>
* em-folder-view.c (emfv_list_done_message_selected): Check for
diff --git a/mail/em-event.c b/mail/em-event.c
index dc3462bc3b..b7b811d6aa 100644
--- a/mail/em-event.c
+++ b/mail/em-event.c
@@ -71,8 +71,10 @@ eme_target_free(EEvent *ep, EEventTarget *t)
case EM_EVENT_TARGET_MESSAGE: {
EMEventTargetMessage *s = (EMEventTargetMessage *)t;
- camel_object_unref(s->folder);
- camel_object_unref(s->message);
+ if (s->folder)
+ camel_object_unref(s->folder);
+ if (s->message)
+ camel_object_unref(s->message);
g_free(s->uid);
break; }
}
@@ -144,9 +146,11 @@ em_event_target_new_message(EMEvent *eme, CamelFolder *folder, CamelMimeMessage
t->uid = g_strdup (uid);
t->folder = folder;
- camel_object_ref(folder);
+ if (folder)
+ camel_object_ref(folder);
t->message = message;
- camel_object_ref(message);
+ if (message)
+ camel_object_ref(message);
t->target.mask = ~flags;
return t;
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 8d7d218ff5..305b8c9137 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -1997,10 +1997,10 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM
EMEvent *eme;
EMEventTargetMessage *target;
- if (emfv->preview == NULL || msg == NULL) {
+ if (emfv->preview == NULL) {
emfv->priv->nomarkseen = FALSE;
- g_object_unref (emfv);
emfv_enable_menus(emfv);
+ g_object_unref (emfv);
return;
}
@@ -2035,10 +2035,9 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM
}
}
- g_object_unref (emfv);
emfv->priv->nomarkseen = FALSE;
-
emfv_enable_menus(emfv);
+ g_object_unref (emfv);
}
static void
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index e92c18fd75..6925e785e5 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -785,7 +785,7 @@ 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, *tmp;
+ const char *location;
EMFormatPURI *puri;
char *cid = NULL;
@@ -793,43 +793,27 @@ efh_text_html(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFor
"<div style=\"border: solid #%06x 1px; background-color: #%06x;\">\n"
"<!-- text/html -->\n",
efh->frame_colour & 0xffffff, efh->content_colour & 0xffffff);
-
- if ((base = camel_medium_get_header((CamelMedium *)part, "Content-Base"))) {
- char *base_url;
- size_t len;
-
- len = strlen(base);
- if (*base == '"' && *(base + len - 1) == '"') {
- len -= 2;
- base_url = alloca(len + 1);
- memcpy(base_url, base + 1, len);
- base_url[len] = '\0';
- base = base_url;
- }
-
- /* FIXME: set base needs to go on the gtkhtml stream? */
- gtk_html_set_base(efh->html, base);
- }
+ /* TODO: perhaps we don't need to calculate this anymore now base is handled better */
/* 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) {
+ location = camel_mime_part_get_content_location(part);
+ if (location == 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) {
+ if (strchr(location, ':') == NULL && ((EMFormat *)efh)->base != NULL) {
CamelURL *uri;
- uri = camel_url_new_with_base(((EMFormat *)efh)->base, tmp);
+ uri = camel_url_new_with_base(((EMFormat *)efh)->base, location);
cid = camel_url_to_string(uri, 0);
camel_url_free(uri);
} else {
- cid = g_strdup(tmp);
+ cid = g_strdup(location);
}
}
@@ -1004,9 +988,8 @@ efh_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;
- CamelURL *base_save = NULL;
EMFormatPURI *puri;
struct _EMFormatHTMLJob *job;
@@ -1045,13 +1028,6 @@ efh_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);
partidlen = emf->part_id->len;
@@ -1079,11 +1055,6 @@ efh_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
em_format_html_job_queue((EMFormatHTML *)emf, job);
em_format_pull_level(emf);
-
- if (location) {
- camel_url_free(emf->base);
- emf->base = base_save;
- }
}
static void
@@ -1312,7 +1283,6 @@ efh_format_timeout(struct _format_msg *m)
mail_msg_free(m);
p->last_part = NULL;
} else {
- /*hstream = gtk_html_begin(efh->html);*/
hstream = NULL;
m->estream = (EMHTMLStream *)em_html_stream_new(efh->html, hstream);
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
diff --git a/mail/em-format.h b/mail/em-format.h
index ac12853fd2..2d28eca231 100644
--- a/mail/em-format.h
+++ b/mail/em-format.h
@@ -204,7 +204,7 @@ struct _EMFormat {
EDList header_list; /* if empty, then all */
struct _CamelSession *session; /* session, used for authentication when required */
- struct _CamelURL *base; /* current location (base url) */
+ struct _CamelURL *base; /* content-base header or absolute content-location, for any part */
const char *snoop_mime_type; /* if we snooped an application/octet-stream type, what we snooped */