diff options
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-display.c | 3 | ||||
-rw-r--r-- | mail/mail-display.h | 2 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 6 | ||||
-rw-r--r-- | mail/mail-format.c | 36 |
5 files changed, 49 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 1693d29cce..45d3f63c91 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2002-02-26 Not Zed <NotZed@Ximian.com> + + * mail-display.c (on_url_requested): If a related part is + requested, remove it from the related undisplayed list. + + * mail-format.c (handle_multipart_related): Check if related parts + are displayed, if not, remove them. For #2741. + 2002-02-24 Chris Toshok <toshok@ximian.com> * folder-browser.c (folder_browser_search_do_search): rename diff --git a/mail/mail-display.c b/mail/mail-display.c index bc74557618..81a9fce492 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -1162,6 +1162,9 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle, g_return_if_fail (CAMEL_IS_MEDIUM (medium)); + if (md->related) + g_hash_table_remove(md->related, medium); + data = camel_medium_get_content_object (medium); if (!mail_content_loaded (data, md, FALSE, url, html, handle)) return; diff --git a/mail/mail-display.h b/mail/mail-display.h index ea87d2cada..015f87d651 100644 --- a/mail/mail-display.h +++ b/mail/mail-display.h @@ -40,6 +40,8 @@ struct _MailDisplay { CamelMimeMessage *current_message; GData **data; + + GHashTable *related; /* related parts not displayed yet */ /* Sigh. This shouldn't be needed. I haven't figured out why it is though. */ diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 7cf21ca1da..c43a093a5a 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -46,7 +46,7 @@ #include "mail-vfolder.h" #include "mail-autofilter.h" -#define w(x) +#define w(x) #define d(x) /* note that many things are effectively serialised by having them run in @@ -302,6 +302,8 @@ update_1folder(struct _folder_info *mfi, CamelFolderInfo *info) } else if (info) unread = info->unread_message_count; + d(printf("folder updated: unread %d: '%s'\n", unread, mfi->full_name)); + if (unread == -1) return; @@ -354,7 +356,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si) static void create_folders(CamelFolderInfo *fi, struct _store_info *si) { - d(printf("Setup new folder: %s\n", fi->url)); + d(printf("Setup new folder: %s\n %s\n", fi->url, fi->full_name)); setup_folder(fi, si); diff --git a/mail/mail-format.c b/mail/mail-format.c index a55ffbbe17..4b315643b4 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -162,7 +162,7 @@ mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md, GHashTable *hash; g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message)); - + hash = g_datalist_get_data (md->data, "part_urls"); if (!hash) { hash = g_hash_table_new (g_str_hash, g_str_equal); @@ -1826,13 +1826,14 @@ static gboolean handle_multipart_related (CamelMimePart *part, const char *mime_type, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream) { - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); + CamelDataWrapper *wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part)); CamelMultipart *mp; CamelMimePart *body_part, *display_part = NULL; CamelContentType *content_type; const char *start; int i, nparts; + GHashTable *related_save; + int ret; g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); @@ -1871,6 +1872,10 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type, return handle_multipart_mixed (part, mime_type, md, html, stream); } + /* setup a 'stack' of related parts */ + related_save = md->related; + md->related = g_hash_table_new(NULL, NULL); + /* 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); @@ -1879,10 +1884,33 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type, get_cid (body_part, md); get_location (body_part, md); + g_hash_table_insert(md->related, body_part, body_part); } /* Now, display the displayed part. */ - return format_mime_part (display_part, md, html, stream); + ret = format_mime_part (display_part, md, html, stream); + + /* FIXME: flush html stream via gtkhtml_stream_flush which doens't exist yet ... */ + while (gtk_events_pending()) + gtk_main_iteration(); + + /* Now check for related parts which didn't display, display them as attachments */ + for (i = 0; i < nparts; i++) { + body_part = camel_multipart_get_part (mp, i); + if (body_part == display_part) + continue; + + if (g_hash_table_lookup(md->related, body_part)) { + if (ret) + write_hr (html, stream); + ret |= format_mime_part(body_part, md, html, stream); + } + } + + g_hash_table_destroy(md->related); + md->related = related_save; + + return ret; } /* RFC 2046 says "display the last part that you are able to display". */ |