talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 4f9f8d5b26f7954bdb09841bbd3d3a8ad89ffc41
parent 28201ba1f4f304321329ad164a633c3e39068657
Author: Colin Leroy <colin@colino.net>
Date:   Wed,  4 Jun 2008 16:00:25 +0000

2008-06-04 [colin]	3.4.0cvs82

	* src/messageview.c
		Complete handling of html parts in multipart/alternative
		mails

Diffstat:
MChangeLog | 6++++++
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Msrc/messageview.c | 48+++++++++++++++++++++++++++++++++++++++++++-----
4 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-04 [colin] 3.4.0cvs82 + + * src/messageview.c + Complete handling of html parts in multipart/alternative + mails + 2008-06-03 [paul] 3.4.0cvs81 * src/prefs_message.c diff --git a/PATCHSETS b/PATCHSETS @@ -3377,3 +3377,4 @@ ( cvs diff -u -r 1.60.2.116 -r 1.60.2.117 src/addressbook.c; cvs diff -u -r 1.94.2.178 -r 1.94.2.179 src/messageview.c; cvs diff -u -r 1.204.2.170 -r 1.204.2.171 src/prefs_common.c; cvs diff -u -r 1.103.2.108 -r 1.103.2.109 src/prefs_common.h; cvs diff -u -r 1.1.2.25 -r 1.1.2.26 src/prefs_message.c; ) > 3.4.0cvs79.patchset ( cvs diff -u -r 1.274.2.245 -r 1.274.2.246 src/mainwindow.c; cvs diff -u -r 1.39.2.46 -r 1.39.2.47 src/mainwindow.h; ) > 3.4.0cvs80.patchset ( cvs diff -u -r 1.1.2.26 -r 1.1.2.27 src/prefs_message.c; ) > 3.4.0cvs81.patchset +( cvs diff -u -r 1.94.2.179 -r 1.94.2.180 src/messageview.c; ) > 3.4.0cvs82.patchset diff --git a/configure.ac b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=4 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=81 +EXTRA_VERSION=82 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/messageview.c b/src/messageview.c @@ -1155,15 +1155,53 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo, strcasecmp(mimeinfo->subtype, "signed"))) { if (strcasecmp(mimeinfo->subtype, "html")) { MimeInfo *saved_mimeinfo = mimeinfo; - if (!strcasecmp(mimeinfo->subtype, "alternative") && prefs_common.promote_html_part) { + MimeInfo *alt_parent = mimeinfo; + + /* if multipart/{related,mixed} part, look inside for a multipart/alternative child */ + if (prefs_common.promote_html_part && + mimeinfo->type == MIMETYPE_MULTIPART && + (!strcasecmp(mimeinfo->subtype, "related") || + !strcasecmp(mimeinfo->subtype, "mixed"))) { + for (; mimeinfo; mimeinfo = procmime_mimeinfo_next(mimeinfo)) { + if (mimeinfo->node->parent != saved_mimeinfo->node) { + /* only consider children of the + * multipart/{related,mixed} part */ + continue; + } + if (mimeinfo->type == MIMETYPE_MULTIPART && + !strcasecmp(mimeinfo->subtype, "alternative")) { + /* we got an alternative part */ + alt_parent = mimeinfo; + break; + } + } + } + + /* if we now have a multipart/alternative part (possibly inside a + * multipart/{related,mixed} part, look for an HTML part inside */ + if (prefs_common.promote_html_part && mimeinfo && + mimeinfo->type == MIMETYPE_MULTIPART && + !strcasecmp(mimeinfo->subtype, "alternative")) { for (; mimeinfo; mimeinfo = procmime_mimeinfo_next(mimeinfo)) { - if (mimeinfo->type == MIMETYPE_TEXT && !strcasecmp(mimeinfo->subtype, "html")) { - mimeview_select_mimepart_icon(messageview->mimeview, mimeinfo); - goto done; + if (mimeinfo->node->parent != alt_parent->node) { + /* only consider children of the + * multipart/alternative part, so as + * not to show html attachments */ + continue; + } + if (mimeinfo->type == MIMETYPE_TEXT && + !strcasecmp(mimeinfo->subtype, "html")) { + /* we got it */ + mimeview_select_mimepart_icon(messageview->mimeview, mimeinfo); + goto done; } } } - if (!mimeinfo) mimeinfo = saved_mimeinfo; + + /* if we didn't find anything, go back to start */ + if (!mimeinfo) + mimeinfo = saved_mimeinfo; + mimeview_show_part(messageview->mimeview,mimeinfo); goto done; } else if (prefs_common.invoke_plugin_on_html) {