From 9015d4ea1e1b27135ba91755278560bd79ff76fd Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Thu, 23 Dec 2010 08:45:57 +0000 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ PATCHSETS | 1 + configure.ac | 2 +- src/compose.c | 39 ++++++++++++++++++++++++++------------- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index a91c5384f..8f7f1d087 100644 --- 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 diff --git a/PATCHSETS b/PATCHSETS index 56f758732..55667d4df 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -4096,3 +4096,4 @@ ( 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 diff --git a/configure.ac b/configure.ac index 6298a84ce..81238a45e 100644 --- a/configure.ac +++ b/configure.ac @@ -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= diff --git a/src/compose.c b/src/compose.c index 16894ec70..ca3532d6f 100644 --- a/src/compose.c +++ b/src/compose.c @@ -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 -- 2.25.1