diff options
author | Not Zed <NotZed@Ximian.com> | 2002-02-26 08:26:55 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-02-26 08:26:55 +0800 |
commit | b0a253e060442cad91f28458f868d64c98ac1817 (patch) | |
tree | 813159647f669cc8c9a06371ecc79a1bf482f046 /mail/mail-format.c | |
parent | 822bc5f1d92f2f0c481d84c2d40f6f1cf02a5e50 (diff) | |
download | gsoc2013-evolution-b0a253e060442cad91f28458f868d64c98ac1817.tar.gz gsoc2013-evolution-b0a253e060442cad91f28458f868d64c98ac1817.tar.zst gsoc2013-evolution-b0a253e060442cad91f28458f868d64c98ac1817.zip |
If a related part is requested, remove it from the related undisplayed
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.
svn path=/trunk/; revision=15837
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r-- | mail/mail-format.c | 36 |
1 files changed, 32 insertions, 4 deletions
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". */ |