diff options
-rw-r--r-- | mail/ChangeLog | 4 | ||||
-rw-r--r-- | mail/mail-format.c | 22 |
2 files changed, 21 insertions, 5 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index ed1366124a..0789226ed8 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,9 @@ 2000-04-25 Dan Winship <danw@helixcode.com> + * mail-format.c (reply_body): Fix some bugs that crept into reply + generation. This needs a lot more work to deal correctly with + complicated bodies. + * mail-display.c, mail-format.c: Redo large chunks of this. The mail display now consists of a vbox in a scrolled window, in which we put multiple GtkHTML objects. This means broken HTML in one diff --git a/mail/mail-format.c b/mail/mail-format.c index 08a2f98f98..6d303f49fb 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -983,7 +983,7 @@ reply_body (CamelDataWrapper *data, gboolean *html) { CamelMultipart *mp; CamelMimePart *subpart; - int i, nparts; + int i, nparts, disparts; char *subtext, *old; const char *boundary, *disp, *subtype; char *text = NULL; @@ -1036,14 +1036,23 @@ reply_body (CamelDataWrapper *data, gboolean *html) * - are text/plain or message * - are not explicitly tagged with non-inline disposition */ + *html = FALSE; boundary = camel_multipart_get_boundary (mp); - for (i = 0; i < nparts; i++) { + for (i = disparts = 0; i < nparts; i++) { subpart = CAMEL_MIME_PART (camel_multipart_get_part (mp, i)); + mime_type = camel_mime_part_get_content_type (subpart); + if (strcasecmp (mime_type->type, "text") == 0) { + if (strcasecmp (mime_type->subtype, "plain") != 0) + continue; + } else if (strcasecmp (mime_type->type, "message") != 0) + continue; + disp = camel_mime_part_get_disposition (subpart); if (disp && strcasecmp (disp, "inline") != 0) continue; + data = camel_medium_get_content_object (CAMEL_MEDIUM (subpart)); subtext = get_data_wrapper_text (data); if (text) { old = text; @@ -1051,6 +1060,7 @@ reply_body (CamelDataWrapper *data, gboolean *html) boundary, subtext); g_free (subtext); g_free (old); + disparts++; } else text = subtext; } @@ -1058,9 +1068,11 @@ reply_body (CamelDataWrapper *data, gboolean *html) if (!text) return NULL; - old = text; - text = g_strdup_printf ("%s\n--%s--\n", text, boundary); - g_free (old); + if (disparts > 1) { + old = text; + text = g_strdup_printf ("%s\n--%s--\n", text, boundary); + g_free (old); + } return text; } |