2008-06-04 [colin] 3.4.0cvs82
authorColin Leroy <colin@colino.net>
Wed, 4 Jun 2008 16:00:25 +0000 (16:00 +0000)
committerColin Leroy <colin@colino.net>
Wed, 4 Jun 2008 16:00:25 +0000 (16:00 +0000)
* src/messageview.c
Complete handling of html parts in multipart/alternative
mails

ChangeLog
PATCHSETS
configure.ac
src/messageview.c

index e2e54dd..b22c936 100644 (file)
--- 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
index bb7c5db..aa3b5a8 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index 5b9bfe0..3d98753 100644 (file)
@@ -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=
 
index 18a4f74..c9cf88c 100644 (file)
@@ -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) {