From de5890b84b581099ab27937f9dd592f4658efdc0 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 17 Jul 2001 19:51:41 +0000 Subject: Cleaned up a bit. (handle_multipart_encrypted): Replace the encrypted part 2001-07-17 Jeffrey Stedfast * mail-format.c (mail_part_toggle_displayed): Cleaned up a bit. (handle_multipart_encrypted): Replace the encrypted part with the decrypted part. svn path=/trunk/; revision=11166 --- mail/ChangeLog | 6 ++++++ mail/mail-display.c | 4 ++-- mail/mail-format.c | 35 ++++++++++++++++++----------------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 5e5704bd25..1dd9b61909 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2001-07-17 Jeffrey Stedfast + + * mail-format.c (mail_part_toggle_displayed): Cleaned up a bit. + (handle_multipart_encrypted): Replace the encrypted part with the + decrypted part. + 2001-07-17 Iain Holmes * mail-accounts.c (mail_delete): Make a nicer dialog. diff --git a/mail/mail-display.c b/mail/mail-display.c index 2a0748eb39..53251430d1 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -1197,14 +1197,14 @@ mail_display_redisplay (MailDisplay *md, gboolean unscroll) mail_html_write (md->html, md->stream, "\n\n\n\n\n"); mail_html_write (md->html, md->stream, "\n"); - + if (md->current_message) { if (md->display_style == MAIL_CONFIG_DISPLAY_SOURCE) mail_format_raw_message (md->current_message, md); else mail_format_mime_message (md->current_message, md); } - + mail_html_write (md->html, md->stream, "\n"); gtk_html_end (md->html, md->stream, GTK_HTML_STREAM_OK); md->stream = NULL; diff --git a/mail/mail-format.c b/mail/mail-format.c index cfe68fb559..b5d28eafca 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -561,23 +561,22 @@ void mail_part_toggle_displayed (CamelMimePart *part, MailDisplay *md) { GHashTable *asht = g_datalist_get_data (md->data, "attachment_states"); + gpointer ostate, opart; gint state; - state = GPOINTER_TO_INT (g_hash_table_lookup (asht, part)); - - if (state & I_DISPLAYED) { - /*printf ("** part %p, hiding\n", part);*/ - state &= ~I_DISPLAYED; + if (g_hash_table_lookup_extended (asht, part, &opart, &ostate)) { + g_hash_table_remove (asht, part); + + state = GPOINTER_TO_INT (ostate); + + if (state & I_DISPLAYED) + state &= ~I_DISPLAYED; + else + state |= I_DISPLAYED; } else { - if (state == 0) { - /*printf ("** part %p: uninitialized attachment state! Showing.", part);*/ - state |= I_VALID; - } - - printf ("** part %p, showing\n", part); - state |= I_DISPLAYED; + state = I_VALID | I_DISPLAYED; } - + g_hash_table_insert (asht, part, GINT_TO_POINTER (state)); } @@ -1658,12 +1657,14 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type, camel_exception_clear (&ex); return handle_multipart_mixed (part, mime_type, md); } else { - gboolean retcode; - - retcode = format_mime_part (mime_part, md); + /* replace the encrypted part with the decrypted part */ + /* FIXME: will this cause problems anywhere? -- seems to work okay so far */ + camel_medium_set_content_object (CAMEL_MEDIUM (part), + camel_medium_get_content_object (CAMEL_MEDIUM (mime_part))); camel_object_unref (CAMEL_OBJECT (mime_part)); - return retcode; + /* and continue on our merry way... */ + return format_mime_part (part, md); } } -- cgit v1.2.3