aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog25
-rw-r--r--mail/mail-config.c28
-rw-r--r--mail/mail-config.h8
-rw-r--r--mail/mail-display.c166
-rw-r--r--mail/mail-display.h4
-rw-r--r--mail/mail-format.c229
6 files changed, 303 insertions, 157 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index a7d9d35c49..672cec0df7 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,28 @@
+2001-05-11 Dan Winship <danw@ximian.com>
+
+ * mail-display.c (load_http): callback to use GNOME-VFS to load
+ http data.
+ (on_url_requested): Handle http: URLs that refer to either MIME
+ parts or web data.
+ (mail_display_redisplay_when_loaded): Moved out of
+ mail_content_loaded and made more generic.
+
+ * mail-format.c (add_url): Handle two different kinds of URLs
+ (URLs that point to CamelMimeParts and URLs that point to
+ GByteArrays).
+ (mail_content_loaded): Use mail_display_redisplay_when_loaded.
+ (format_mime_part): Renamed from "call_handler_function". Also,
+ record Content-Location if the part has one. (This is not yet 100%
+ correct: it doesn't deal with relative URLs at all.)
+ (handle_text_html): Use Content-Location URL rather than
+ Content-ID, when available (will help deal with relative URLs once
+ GtkHTML supports that better).
+ (etc): Update for changes.
+
+ * mail-config.c (mail_config_get_http_mode,
+ mail_config_set_http_mode): get/set HTTP image downloading mode.
+ (config_read, mail_config_write_on_exit): save/load that data.
+
2001-05-11 JP Rosevear <jpr@ximian.com>
* mail-importer.h: add proto
diff --git a/mail/mail-config.c b/mail/mail-config.c
index eb6c3982c8..3a76d57805 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -65,6 +65,8 @@ typedef struct {
char *pgp_path;
CamelPgpType pgp_type;
+
+ MailConfigHTTPMode http_mode;
} MailConfig;
static const char GCONFPATH[] = "/apps/Evolution/Mail";
@@ -449,6 +451,14 @@ config_read (void)
if (def)
config->pgp_type = CAMEL_PGP_TYPE_NONE;
g_free (str);
+
+ /* HTTP images */
+ str = g_strdup_printf ("=%s/config/Mail=/Display/http_images",
+ evolution_dir);
+ config->http_mode = gnome_config_get_int_with_default (str, &def);
+ if (def)
+ config->http_mode = MAIL_CONFIG_HTTP_NEVER;
+ g_free (str);
gnome_config_sync ();
}
@@ -626,6 +636,12 @@ mail_config_write_on_exit (void)
gnome_config_set_int (str, config->pgp_type);
g_free (str);
+ /* HTTP images */
+ str = g_strdup_printf ("=%s/config/Mail=/Display/http_images",
+ evolution_dir);
+ gnome_config_set_int (str, config->http_mode);
+ g_free (str);
+
/* Passwords */
gnome_config_private_clean_section ("/Evolution/Passwords");
sources = mail_config_get_sources ();
@@ -858,6 +874,18 @@ mail_config_set_pgp_path (const char *pgp_path)
config->pgp_path = g_strdup (pgp_path);
}
+MailConfigHTTPMode
+mail_config_get_http_mode (void)
+{
+ return config->http_mode;
+}
+
+void
+mail_config_set_http_mode (MailConfigHTTPMode mode)
+{
+ config->http_mode = mode;
+}
+
const MailConfigAccount *
mail_config_get_default_account (void)
{
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 198e0f4cde..31e31ddb2f 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -59,6 +59,11 @@ typedef struct {
gchar *sent_folder_name, *sent_folder_uri;
} MailConfigAccount;
+typedef enum {
+ MAIL_CONFIG_HTTP_NEVER, MAIL_CONFIG_HTTP_SOMETIMES,
+ MAIL_CONFIG_HTTP_ALWAYS,
+} MailConfigHTTPMode;
+
/* Identities */
MailConfigIdentity *identity_copy (const MailConfigIdentity *id);
void identity_destroy (MailConfigIdentity *id);
@@ -115,6 +120,9 @@ void mail_config_set_pgp_type (CamelPgpType pgp_type);
const char *mail_config_get_pgp_path (void);
void mail_config_set_pgp_path (const char *pgp_path);
+MailConfigHTTPMode mail_config_get_http_mode (void);
+void mail_config_set_http_mode (MailConfigHTTPMode);
+
const MailConfigAccount *mail_config_get_default_account (void);
const MailConfigAccount *mail_config_get_account_by_name (const char *account_name);
const MailConfigAccount *mail_config_get_account_by_source_url (const char *url);
diff --git a/mail/mail-display.c b/mail/mail-display.c
index f4063583bd..28701b566e 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -20,6 +20,7 @@
#include <libgnorba/gnorba.h>
#include <libgnomevfs/gnome-vfs-mime-info.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
+#include <libgnomevfs/gnome-vfs.h>
#include <bonobo/bonobo-control-frame.h>
#include <bonobo/bonobo-stream-memory.h>
#include <bonobo/bonobo-ui-toolbar-icon.h>
@@ -691,7 +692,7 @@ on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
if (strncmp (cid, "cid:", 4) != 0)
return FALSE;
- urls = g_datalist_get_data (md->data, "urls");
+ urls = g_datalist_get_data (md->data, "part_urls");
g_return_val_if_fail (urls != NULL, FALSE);
medium = g_hash_table_lookup (urls, cid);
@@ -850,6 +851,40 @@ on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
return TRUE;
}
+
+static void
+load_http (MailDisplay *md, gpointer data)
+{
+ char *url = data;
+ GHashTable *urls;
+ GnomeVFSHandle *handle;
+ GnomeVFSFileSize read;
+ GByteArray *ba;
+ char buf[8192];
+
+ urls = g_datalist_get_data (md->data, "data_urls");
+ ba = g_hash_table_lookup (urls, url);
+ g_return_if_fail (ba != NULL);
+
+ if (gnome_vfs_open (&handle, url, GNOME_VFS_OPEN_READ) != GNOME_VFS_OK) {
+#if 0
+ printf ("failed to open %s\n", url);
+#endif
+ g_free (url);
+ return;
+ }
+
+ while (gnome_vfs_read (handle, buf, sizeof (buf), &read) == GNOME_VFS_OK)
+ g_byte_array_append (ba, buf, read);
+ gnome_vfs_close (handle);
+
+#if 0
+ if (!ba->len)
+ printf ("no data in %s\n", url);
+#endif
+
+ g_free (url);
+}
static void
on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
@@ -857,40 +892,137 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
{
MailDisplay *md = user_data;
GHashTable *urls;
+ CamelMedium *medium;
+ GByteArray *ba;
- urls = g_datalist_get_data (md->data, "urls");
+ urls = g_datalist_get_data (md->data, "part_urls");
g_return_if_fail (urls != NULL);
- user_data = g_hash_table_lookup (urls, url);
- if (user_data == NULL) {
- gtk_html_end (html, handle, GTK_HTML_STREAM_ERROR);
- return;
- }
-
- if (strncmp (url, "cid:", 4) == 0) {
- CamelMedium *medium = user_data;
+ /* See if it refers to a MIME part (cid: or http:) */
+ medium = g_hash_table_lookup (urls, url);
+ if (medium) {
CamelDataWrapper *data;
CamelStream *stream_mem;
- GByteArray *ba;
g_return_if_fail (CAMEL_IS_MEDIUM (medium));
+
data = camel_medium_get_content_object (medium);
- if (!mail_content_loaded (data, md))
+ if (!mail_content_loaded (data, md)) {
+ gtk_html_end (html, handle, GTK_HTML_STREAM_ERROR);
return;
+ }
ba = g_byte_array_new ();
stream_mem = camel_stream_mem_new_with_byte_array (ba);
camel_data_wrapper_write_to_stream (data, stream_mem);
gtk_html_write (html, handle, ba->data, ba->len);
camel_object_unref (CAMEL_OBJECT (stream_mem));
- } else if (strncmp (url, "x-evolution-data:", 17) == 0) {
- GByteArray *ba = user_data;
- g_return_if_fail (ba != NULL);
- gtk_html_write (html, handle, ba->data, ba->len);
+ gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
+ return;
+ }
+
+ urls = g_datalist_get_data (md->data, "data_urls");
+ g_return_if_fail (urls != NULL);
+
+ /* See if it's some piece of cached data */
+ ba = g_hash_table_lookup (urls, url);
+ if (ba) {
+ if (ba->len)
+ gtk_html_write (html, handle, ba->data, ba->len);
+ gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
+ return;
+ }
+
+ /* See if it's something we can load. */
+ if (strncmp (url, "http:", 5) == 0 &&
+ mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS) {
+ ba = g_byte_array_new ();
+ g_hash_table_insert (urls, g_strdup (url), ba);
+ mail_display_redisplay_when_loaded (md, ba, load_http, g_strdup (url));
}
- gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
+ gtk_html_end (html, handle, GTK_HTML_STREAM_ERROR);
+}
+
+struct _load_content_msg {
+ struct _mail_msg msg;
+
+ MailDisplay *display;
+ CamelMimeMessage *message;
+ void (*callback)(MailDisplay *, gpointer);
+ gpointer data;
+};
+
+static char *
+load_content_desc (struct _mail_msg *mm, int done)
+{
+ return g_strdup (_("Loading message content"));
+}
+
+static void
+load_content_load (struct _mail_msg *mm)
+{
+ struct _load_content_msg *m = (struct _load_content_msg *)mm;
+
+ m->callback (m->display, m->data);
+}
+
+static void
+load_content_loaded (struct _mail_msg *mm)
+{
+ struct _load_content_msg *m = (struct _load_content_msg *)mm;
+
+ if (m->display->current_message == m->message)
+ mail_display_queue_redisplay (m->display);
+}
+
+static void
+load_content_free (struct _mail_msg *mm)
+{
+ struct _load_content_msg *m = (struct _load_content_msg *)mm;
+
+ gtk_object_unref (GTK_OBJECT (m->display));
+ camel_object_unref (CAMEL_OBJECT (m->message));
+}
+
+static struct _mail_msg_op load_content_op = {
+ load_content_desc,
+ load_content_load,
+ load_content_loaded,
+ load_content_free,
+};
+
+void
+mail_display_redisplay_when_loaded (MailDisplay *md,
+ gconstpointer key,
+ void (*callback)(MailDisplay *, gpointer),
+ gpointer data)
+{
+ struct _load_content_msg *m;
+ GHashTable *loading;
+
+ loading = g_datalist_get_data (md->data, "loading");
+ if (loading) {
+ if (g_hash_table_lookup (loading, key))
+ return;
+ } else {
+ loading = g_hash_table_new (NULL, NULL);
+ g_datalist_set_data_full (md->data, "loading", loading,
+ (GDestroyNotify)g_hash_table_destroy);
+ }
+ g_hash_table_insert (loading, (gpointer)key, GINT_TO_POINTER (1));
+
+ m = mail_msg_new (&load_content_op, NULL, sizeof (*m));
+ m->display = md;
+ gtk_object_ref (GTK_OBJECT (m->display));
+ m->message = md->current_message;
+ camel_object_ref (CAMEL_OBJECT (m->message));
+ m->callback = callback;
+ m->data = data;
+
+ e_thread_put (mail_thread_queued, (EMsg *)m);
+ return;
}
void
diff --git a/mail/mail-display.h b/mail/mail-display.h
index f14df5658c..4f78e7cc1d 100644
--- a/mail/mail-display.h
+++ b/mail/mail-display.h
@@ -42,6 +42,10 @@ GtkWidget * mail_display_new (void);
void mail_display_queue_redisplay (MailDisplay *mail_display);
void mail_display_redisplay (MailDisplay *mail_display, gboolean unscroll);
+void mail_display_redisplay_when_loaded (MailDisplay *md,
+ gconstpointer key,
+ void (*callback)(MailDisplay *, gpointer),
+ gpointer data);
void mail_display_set_message (MailDisplay *mail_display,
CamelMedium *medium);
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 5ffb7d48b5..35bb64f164 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -2,10 +2,9 @@
/*
* Authors:
- * Matt Loper <matt@helixcode.com>
- * Dan Winship <danw@helixcode.com>
+ * Dan Winship <danw@ximian.com>
*
- * Copyright 2000, Helix Code, Inc. (http://www.helixcode.com)
+ * Copyright 2000, 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,6 +38,7 @@
#include <camel/camel-mime-utils.h>
#include <camel/camel-pgp-mime.h>
+#include <camel/camel-stream-null.h>
#include <shell/e-setup.h>
#include <e-util/e-html-utils.h>
@@ -102,30 +102,38 @@ static gboolean handle_via_bonobo (CamelMimePart *part,
static void write_headers (CamelMimeMessage *message, MailDisplay *md);
/* dispatch html printing via mimetype */
-static gboolean call_handler_function (CamelMimePart *part, MailDisplay *md);
+static gboolean format_mime_part (CamelMimePart *part, MailDisplay *md);
static void
free_url (gpointer key, gpointer value, gpointer data)
{
g_free (key);
+ if (data)
+ g_byte_array_free (value, TRUE);
}
static void
-free_urls (gpointer urls)
+free_part_urls (gpointer urls)
{
g_hash_table_foreach (urls, free_url, NULL);
g_hash_table_destroy (urls);
}
+static void
+free_data_urls (gpointer urls)
+{
+ g_hash_table_foreach (urls, free_url, GINT_TO_POINTER (1));
+ g_hash_table_destroy (urls);
+}
+
static char *
-add_url (char *url, gpointer data, MailDisplay *md)
+add_url (const char *kind, char *url, gpointer data, MailDisplay *md)
{
GHashTable *urls;
gpointer old_key, old_value;
- urls = g_datalist_get_data (md->data, "urls");
+ urls = g_datalist_get_data (md->data, kind);
g_return_val_if_fail (urls != NULL, NULL);
-
if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) {
g_free (url);
url = old_key;
@@ -148,15 +156,21 @@ mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md)
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message));
- urls = g_datalist_get_data (md->data, "urls");
+ urls = g_datalist_get_data (md->data, "part_urls");
if (!urls) {
urls = g_hash_table_new (g_str_hash, g_str_equal);
- g_datalist_set_data_full (md->data, "urls", urls,
- free_urls);
+ g_datalist_set_data_full (md->data, "part_urls", urls,
+ free_part_urls);
}
-
+ urls = g_datalist_get_data (md->data, "data_urls");
+ if (!urls) {
+ urls = g_hash_table_new (g_str_hash, g_str_equal);
+ g_datalist_set_data_full (md->data, "data_urls", urls,
+ free_data_urls);
+ }
+
write_headers (mime_message, md);
- call_handler_function (CAMEL_MIME_PART (mime_message), md);
+ format_mime_part (CAMEL_MIME_PART (mime_message), md);
}
@@ -186,13 +200,9 @@ mail_format_raw_message (CamelMimeMessage *mime_message, MailDisplay *md)
static const char *
get_cid (CamelMimePart *part, MailDisplay *md)
{
- GHashTable *urls;
char *cid;
- gpointer orig_name, value;
static int fake_cid_counter = 0;
- urls = g_datalist_get_data (md->data, "urls");
-
/* If we have a real Content-ID, use it. If we don't,
* make a (syntactically invalid, unique) fake one.
*/
@@ -202,24 +212,30 @@ get_cid (CamelMimePart *part, MailDisplay *md)
} else
cid = g_strdup_printf ("cid:@@@%d", fake_cid_counter++);
- if (g_hash_table_lookup_extended (urls, cid, &orig_name, &value)) {
- g_free (cid);
- return orig_name;
- } else
- g_hash_table_insert (urls, cid, part);
+ return add_url ("part_urls", cid, part, md);
+}
+
+static const char *
+get_location (CamelMimePart *part, MailDisplay *md)
+{
+ const char *loc;
+
+ /* FIXME: relative URLs */
+ loc = camel_mime_part_get_content_location (part);
+ if (!loc)
+ return NULL;
- return cid;
+ return add_url ("part_urls", g_strdup (loc), part, md);
}
static const char *
get_url_for_icon (const char *icon_name, MailDisplay *md)
{
- static GHashTable *icons;
char *icon_path, buf[1024], *url;
+ int fd, nread;
GByteArray *ba;
- if (!icons)
- icons = g_hash_table_new (g_str_hash, g_str_equal);
+ /* FIXME: cache */
if (*icon_name == '/')
icon_path = g_strdup (icon_name);
@@ -229,33 +245,22 @@ get_url_for_icon (const char *icon_name, MailDisplay *md)
return "file:///dev/null";
}
- ba = g_hash_table_lookup (icons, icon_path);
- if (!ba) {
- int fd, nread;
-
- fd = open (icon_path, O_RDONLY);
- if (fd == -1) {
- g_free (icon_path);
- return "file:///dev/null";
- }
-
- ba = g_byte_array_new ();
-
- while (1) {
- nread = read (fd, buf, sizeof (buf));
- if (nread < 1)
- break;
- g_byte_array_append (ba, buf, nread);
- }
- close (fd);
+ fd = open (icon_path, O_RDONLY);
+ g_free (icon_path);
+ if (fd == -1)
+ return "file:///dev/null";
- /* FIXME: these aren't freed. */
- g_hash_table_insert (icons, g_strdup (icon_path), ba);
+ ba = g_byte_array_new ();
+ while (1) {
+ nread = read (fd, buf, sizeof (buf));
+ if (nread < 1)
+ break;
+ g_byte_array_append (ba, buf, nread);
}
- g_free (icon_path);
+ close (fd);
url = g_strdup_printf ("x-evolution-data:%p", ba);
- return add_url (url, ba, md);
+ return add_url ("data_urls", url, ba, md);
}
@@ -550,12 +555,17 @@ attachment_header (CamelMimePart *part, const char *mime_type,
}
static gboolean
-call_handler_function (CamelMimePart *part, MailDisplay *md)
+format_mime_part (CamelMimePart *part, MailDisplay *md)
{
CamelDataWrapper *wrapper;
char *mime_type;
MailMimeHandler *handler;
gboolean output, is_inline;
+ const char *location;
+
+ /* Record URLs associated with this part */
+ get_cid (part, md);
+ get_location (part, md);
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -738,7 +748,7 @@ write_headers (CamelMimeMessage *message, MailDisplay *md)
"<table bgcolor=\"#000000\" width=\"100%%\" "
"cellspacing=0 cellpadding=1><tr><td>"
"<table bgcolor=\"#EEEEEE\" width=\"100%%\" cellpadding=0 cellspacing=0>"
- "<tr><td><table>");
+ "<tr><td><table>\n");
write_address(md, camel_mime_message_get_from(message),
_("From:"), WRITE_BOLD);
@@ -757,86 +767,26 @@ write_headers (CamelMimeMessage *message, MailDisplay *md)
"</table></td></tr></table></td></tr></table></font>");
}
-struct _load_content_msg {
- struct _mail_msg msg;
-
- MailDisplay *display;
- CamelMimeMessage *message;
- CamelDataWrapper *wrapper;
-};
-
-static char *
-load_content_desc (struct _mail_msg *mm, int done)
-{
- return g_strdup (_("Loading message content"));
-}
-
-static void
-load_content_load (struct _mail_msg *mm)
-{
- struct _load_content_msg *m = (struct _load_content_msg *)mm;
- CamelStream *memstream;
-
- memstream = camel_stream_mem_new ();
- camel_data_wrapper_write_to_stream (m->wrapper, memstream);
- camel_object_unref (CAMEL_OBJECT (memstream));
-}
-
-static void
-load_content_loaded (struct _mail_msg *mm)
-{
- struct _load_content_msg *m = (struct _load_content_msg *)mm;
-
- if (m->display->current_message == m->message)
- mail_display_queue_redisplay (m->display);
-}
-
static void
-load_content_free (struct _mail_msg *mm)
+load_offline_content (MailDisplay *md, gpointer data)
{
- struct _load_content_msg *m = (struct _load_content_msg *)mm;
+ CamelDataWrapper *wrapper = data;
+ CamelStream *stream;
- gtk_object_unref (GTK_OBJECT (m->display));
- camel_object_unref (CAMEL_OBJECT (m->wrapper));
- camel_object_unref (CAMEL_OBJECT (m->message));
+ stream = camel_stream_null_new ();
+ camel_data_wrapper_write_to_stream (wrapper, stream);
+ camel_object_unref (CAMEL_OBJECT (stream));
+ camel_object_unref (CAMEL_OBJECT (wrapper));
}
-static struct _mail_msg_op load_content_op = {
- load_content_desc,
- load_content_load,
- load_content_loaded,
- load_content_free,
-};
-
gboolean
mail_content_loaded (CamelDataWrapper *wrapper, MailDisplay *md)
{
- struct _load_content_msg *m;
- GHashTable *loading;
-
if (!camel_data_wrapper_is_offline (wrapper))
return TRUE;
- loading = g_datalist_get_data (md->data, "loading");
- if (loading) {
- if (g_hash_table_lookup (loading, wrapper))
- return FALSE;
- } else {
- loading = g_hash_table_new (NULL, NULL);
- g_datalist_set_data_full (md->data, "loading", loading,
- (GDestroyNotify)g_hash_table_destroy);
- }
- g_hash_table_insert (loading, wrapper, GINT_TO_POINTER (1));
-
- m = mail_msg_new (&load_content_op, NULL, sizeof (*m));
- m->display = md;
- gtk_object_ref (GTK_OBJECT (m->display));
- m->message = md->current_message;
- camel_object_ref (CAMEL_OBJECT (m->message));
- m->wrapper = wrapper;
- camel_object_ref (CAMEL_OBJECT (m->wrapper));
-
- e_thread_put (mail_thread_queued, (EMsg *)m);
+ camel_object_ref (CAMEL_OBJECT (wrapper));
+ mail_display_redisplay_when_loaded (md, wrapper, load_offline_content, wrapper);
return FALSE;
}
@@ -1254,7 +1204,7 @@ try_uudecoding (char *start, MailDisplay *md)
"finalize", destroy_part, part);
mail_html_write (md->html, md->stream, "<hr>");
- call_handler_function (part, md);
+ format_mime_part (part, md);
return p + 4;
}
@@ -1282,18 +1232,11 @@ try_inline_binhex (char *start, MailDisplay *md)
"finalize", destroy_part, part);
mail_html_write (md->html, md->stream, "<hr>");
- call_handler_function (part, md);
+ format_mime_part (part, md);
return p;
}
-static void
-free_byte_array (CamelObject *obj, gpointer event_data, gpointer user_data)
-{
- /* We don't have to do a forward event here right now */
- g_byte_array_free (user_data, TRUE);
-}
-
/* text/enriched (RFC 1896) or text/richtext (included in RFC 1341) */
static gboolean
handle_text_enriched (CamelMimePart *part, const char *mime_type,
@@ -1450,9 +1393,7 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type,
mail_html_write (md->html, md->stream,
"<iframe src=\"%s\" frameborder=0 scrolling=no>"
"</iframe>", xed);
- add_url (xed, ba, md);
- camel_object_hook_event (CAMEL_OBJECT (md->current_message),
- "finalize", free_byte_array, ba);
+ add_url ("data_urls", xed, ba, md);
return TRUE;
}
@@ -1461,10 +1402,17 @@ static gboolean
handle_text_html (CamelMimePart *part, const char *mime_type,
MailDisplay *md)
{
+ const char *location;
+
mail_html_write (md->html, md->stream, "\n<!-- text/html -->\n");
+
+ /* FIXME: deal with relative URLs */
+ location = get_location (part, md);
+ if (!location)
+ location = get_cid (part, md);
mail_html_write (md->html, md->stream,
"<iframe src=\"%s\" frameborder=0 scrolling=no>"
- "</iframe>", get_cid (part, md));
+ "</iframe>", location);
return TRUE;
}
@@ -1496,7 +1444,7 @@ handle_multipart_mixed (CamelMimePart *part, const char *mime_type,
part = camel_multipart_get_part (mp, i);
- output = call_handler_function (part, md);
+ output = format_mime_part (part, md);
}
return TRUE;
@@ -1528,7 +1476,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
} else {
gboolean retcode;
- retcode = call_handler_function (mime_part, md);
+ retcode = format_mime_part (mime_part, md);
camel_object_unref (CAMEL_OBJECT (mime_part));
return retcode;
@@ -1567,7 +1515,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
part = camel_multipart_get_part (mp, i);
- output = call_handler_function (part, md);
+ output = format_mime_part (part, md);
}
/* Now display the "seal-of-authenticity" or something... */
@@ -1653,17 +1601,18 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type,
return handle_multipart_mixed (part, mime_type, md);
}
- /* Record the Content-IDs of any non-displayed parts. */
+ /* Record the Content-ID/Content-Location of any non-displayed parts. */
for (i = 0; i < nparts; i++) {
body_part = camel_multipart_get_part (mp, i);
if (body_part == display_part)
continue;
get_cid (body_part, md);
+ get_location (body_part, md);
}
/* Now, display the displayed part. */
- return call_handler_function (display_part, md);
+ return format_mime_part (display_part, md);
}
/* RFC 2046 says "display the last part that you are able to display". */
@@ -1707,7 +1656,7 @@ handle_multipart_alternative (CamelMimePart *part, const char *mime_type,
mime_part = find_preferred_alternative (multipart, FALSE);
if (mime_part)
- return call_handler_function (mime_part, md);
+ return format_mime_part (mime_part, md);
else
return handle_multipart_mixed (part, mime_type, md);
}
@@ -1730,7 +1679,7 @@ handle_multipart_appledouble (CamelMimePart *part, const char *mime_type,
* likely it's application/octet-stream though.
*/
part = camel_multipart_get_part (multipart, 1);
- return call_handler_function (part, md);
+ return format_mime_part (part, md);
}
static gboolean