From 4c20fe02c4bf78e56caf5393598fdb71b4ac772e Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 4 Jun 2002 23:58:22 +0000 Subject: The following changes take a great leap toward fixing bug #1042. 2002-06-04 Jeffrey Stedfast The following changes take a great leap toward fixing bug #1042. * mail-display.c (mail_display_push_content_location): New function to push a Content-Location value onto the MailDisplay. (mail_display_get_content_location): Gets the current Content-Location CamelURL value. (mail_display_pop_content_location): Pop the Content-Location off the stack. * mail-format.c (get_location): Do URL merging if the Content-Location isn't a full URL. If the Content-Location doesn't exist, pretend the URL is actually the Content-Location URL of our parent multipart (assuming it exists). If that doesn't exist, then yes - return NULL. (handle_multipart_related): Push the Content-Location header value of the multipart/related so that we can do URL merging in get_location() as we process each of the subparts. When we're done, pop it back off the stack. svn path=/trunk/; revision=17113 --- mail/mail-display.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'mail/mail-display.c') diff --git a/mail/mail-display.c b/mail/mail-display.c index 990905fc41..35521e9b13 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -754,14 +754,14 @@ save_url (MailDisplay *md, const char *url) urls = g_datalist_get_data (md->data, "part_urls"); g_return_val_if_fail (urls != NULL, NULL); - + part = g_hash_table_lookup (urls, url); if (part == NULL) { GByteArray *ba; - + urls = g_datalist_get_data (md->data, "data_urls"); g_return_val_if_fail (urls != NULL, NULL); - + /* See if it's some piece of cached data if it is then pretend it * is a mime part so that we can use the mime part saveing routines. * It is gross but it keeps duplicated code to a minimum and helps @@ -2420,4 +2420,47 @@ mail_display_get_url_for_icon (MailDisplay *md, const char *icon_name) } +struct _location_url_stack { + struct _location_url_stack *parent; + CamelURL *url; +}; + +void +mail_display_push_content_location (MailDisplay *md, const char *location) +{ + struct _location_url_stack *node; + CamelURL *url; + + url = camel_url_new (location, NULL); + node = g_new (struct _location_url_stack, 1); + node->parent = md->urls; + node->url = url; + md->urls = node; +} + +CamelURL * +mail_display_get_content_location (MailDisplay *md) +{ + return md->urls ? md->urls->url : NULL; +} + +void +mail_display_pop_content_location (MailDisplay *md) +{ + struct _location_url_stack *node; + + if (!md->urls) { + g_warning ("content-location stack underflow!"); + return; + } + + node = md->urls; + md->urls = node->parent; + + if (node->url) + camel_url_free (node->url); + + g_free (node); +} + E_MAKE_TYPE (mail_display, "MailDisplay", MailDisplay, mail_display_class_init, mail_display_init, PARENT_TYPE); -- cgit v1.2.3