2010-12-23 [colin] 3.7.8cvs23
authorColin Leroy <colin@colino.net>
Thu, 23 Dec 2010 08:45:57 +0000 (08:45 +0000)
committerColin Leroy <colin@colino.net>
Thu, 23 Dec 2010 08:45:57 +0000 (08:45 +0000)
* src/compose.c
Finish fixing bug #2203: When forwarding (inline) and there
are some text/* parts with no name, set them a name and
set their disposition to attachment, so that recipients with
MUAs preferring HTML parts don't show them by default.

ChangeLog
PATCHSETS
configure.ac
src/compose.c

index a91c538..8f7f1d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-12-23 [colin]     3.7.8cvs23
+
+       * src/compose.c
+               Finish fixing bug #2203: When forwarding (inline) and there
+               are some text/* parts with no name, set them a name and
+               set their disposition to attachment, so that recipients with
+               MUAs preferring HTML parts don't show them by default.
+
 2010-12-22 [paul]      3.7.8cvs22
 
        * src/compose.h
index 56f7587..55667d4 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.382.2.563 -r 1.382.2.564 src/compose.c;  ) > 3.7.8cvs20.patchset
 ( cvs diff -u -r 1.207.2.217 -r 1.207.2.218 src/folderview.c;  cvs diff -u -r 1.20.2.26 -r 1.20.2.27 src/folderview.h;  ) > 3.7.8cvs21.patchset
 ( cvs diff -u -r 1.50.2.60 -r 1.50.2.61 src/compose.h;  ) > 3.7.8cvs22.patchset
+( cvs diff -u -r 1.382.2.564 -r 1.382.2.565 src/compose.c;  ) > 3.7.8cvs23.patchset
index 6298a84..81238a4 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=22
+EXTRA_VERSION=23
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 16894ec..ca3532d 100644 (file)
@@ -1676,6 +1676,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
        GtkTextView *textview;
        GtkTextBuffer *textbuf;
        GtkTextIter iter;
+       ComposeMode mode;
 
        cm_return_val_if_fail(msginfo != NULL, NULL);
        cm_return_val_if_fail(msginfo->folder != NULL, NULL);
@@ -1685,7 +1686,11 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
                                (msginfo)))
                account = cur_account;
 
-       compose = compose_create(account, msginfo->folder, COMPOSE_FORWARD, batch);
+       if (!prefs_common.forward_as_attachment)
+               mode = COMPOSE_FORWARD_INLINE;
+       else
+               mode = COMPOSE_FORWARD;
+       compose = compose_create(account, msginfo->folder, mode, batch);
 
        compose->updating = TRUE;
        compose->fwdinfo = procmsg_msginfo_get_full_info(msginfo);
@@ -5970,20 +5975,28 @@ static int compose_add_attachments(Compose *compose, MimeInfo *parent)
                if (mimepart->type == MIMETYPE_MESSAGE && 
                    !g_ascii_strcasecmp(mimepart->subtype, "rfc822")) {
                        mimepart->disposition = DISPOSITIONTYPE_INLINE;
-               } else {
-                       if (ainfo->name) {
-                               if (mimepart->type == MIMETYPE_APPLICATION && 
-                                  !strcmp2(mimepart->subtype, "octet-stream"))
-                                       g_hash_table_insert(mimepart->typeparameters,
-                                                   g_strdup("name"), g_strdup(ainfo->name));
-                               g_hash_table_insert(mimepart->dispositionparameters,
-                                           g_strdup("filename"), g_strdup(ainfo->name));
+               } else if (mimepart->type == MIMETYPE_TEXT) {
+                       if (!ainfo->name && compose->mode == COMPOSE_FORWARD_INLINE) {
+                               /* Text parts with no name come from multipart/alternative
+                               * forwards. Make sure the recipient won't look at the 
+                               * original HTML part by mistake. */
                                mimepart->disposition = DISPOSITIONTYPE_ATTACHMENT;
+                               ainfo->name = g_strdup_printf(_("Original %s part"),
+                                                               mimepart->subtype);
                        }
+                       if (ainfo->charset)
+                               g_hash_table_insert(mimepart->typeparameters,
+                                                   g_strdup("charset"), g_strdup(ainfo->charset));
+               }
+               if (ainfo->name && mimepart->type != MIMETYPE_MESSAGE) {
+                       if (mimepart->type == MIMETYPE_APPLICATION && 
+                          !strcmp2(mimepart->subtype, "octet-stream"))
+                               g_hash_table_insert(mimepart->typeparameters,
+                                               g_strdup("name"), g_strdup(ainfo->name));
+                       g_hash_table_insert(mimepart->dispositionparameters,
+                                       g_strdup("filename"), g_strdup(ainfo->name));
+                       mimepart->disposition = DISPOSITIONTYPE_ATTACHMENT;
                }
-               if (mimepart->type == MIMETYPE_TEXT && ainfo->charset)
-                       g_hash_table_insert(mimepart->typeparameters,
-                                       g_strdup("charset"), g_strdup(ainfo->charset));
 
                if (mimepart->type == MIMETYPE_MESSAGE
                    || mimepart->type == MIMETYPE_MULTIPART)
@@ -7608,7 +7621,7 @@ static Compose *compose_create(PrefsAccount *account,
                        }
                }
        }
-    compose->gtkaspell = gtkaspell;
+       compose->gtkaspell = gtkaspell;
        compose_spell_menu_changed(compose);
        claws_spell_entry_set_gtkaspell(CLAWS_SPELL_ENTRY(subject_entry), gtkaspell);
 #endif