talons

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

commit 44c5c29fb0fc71ca5401002b309a45433b0f0e0f
parent d8caddd50772e401e920631c6157d5eb57eec876
Author: Colin Leroy <colin@colino.net>
Date:   Wed, 14 May 2008 19:00:10 +0000

2008-05-14 [colin]	3.4.0cvs34

	* src/compose.c
		Always use the specified encoding and charset if it is
		specified, even if the mail is ASCII.

Diffstat:
MChangeLog | 6++++++
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Msrc/compose.c | 146++++++++++++++++++++++++++++++++++++++-----------------------------------------
4 files changed, 78 insertions(+), 77 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,9 @@ +2008-05-14 [colin] 3.4.0cvs34 + + * src/compose.c + Always use the specified encoding and charset if it is + specified, even if the mail is ASCII. + 2008-05-13 [paul] 3.4.0cvs33 * src/ldapupdate.c diff --git a/PATCHSETS b/PATCHSETS @@ -3329,3 +3329,4 @@ ( cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/addressbook_foldersel.c; ) > 3.4.0cvs31.patchset ( cvs diff -u -r 1.3.2.55 -r 1.3.2.56 src/prefs_themes.c; ) > 3.4.0cvs32.patchset ( cvs diff -u -r 1.1.2.18 -r 1.1.2.19 src/ldapupdate.c; ) > 3.4.0cvs33.patchset +( cvs diff -u -r 1.382.2.448 -r 1.382.2.449 src/compose.c; ) > 3.4.0cvs34.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=33 +EXTRA_VERSION=34 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/compose.c b/src/compose.c @@ -5140,6 +5140,7 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool EncodingType encoding; MimeInfo *mimemsg, *mimetext; gint line; + const gchar *src_codeset = CS_INTERNAL; if (action == COMPOSE_WRITE_FOR_SEND) attach_parts = TRUE; @@ -5158,91 +5159,84 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool gtk_text_buffer_get_start_iter(buffer, &start); gtk_text_buffer_get_end_iter(buffer, &end); chars = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); - if (is_ascii_str(chars)) { - buf = chars; - chars = NULL; + + out_codeset = conv_get_charset_str(compose->out_encoding); + + if (!out_codeset && is_ascii_str(chars)) { out_codeset = CS_US_ASCII; - encoding = ENC_7BIT; - } else { - const gchar *src_codeset = CS_INTERNAL; + } - out_codeset = conv_get_charset_str(compose->out_encoding); + if (!out_codeset) { + gchar *test_conv_global_out = NULL; + gchar *test_conv_reply = NULL; - if (!out_codeset) { - gchar *test_conv_global_out = NULL; - gchar *test_conv_reply = NULL; + /* automatic mode. be automatic. */ + codeconv_set_strict(TRUE); - /* automatic mode. be automatic. */ - codeconv_set_strict(TRUE); - - out_codeset = conv_get_outgoing_charset_str(); - if (out_codeset) { - debug_print("trying to convert to %s\n", out_codeset); - test_conv_global_out = conv_codeset_strdup(chars, src_codeset, out_codeset); - } - - if (!test_conv_global_out && compose->orig_charset - && strcmp(compose->orig_charset, CS_US_ASCII)) { - out_codeset = compose->orig_charset; - debug_print("failure; trying to convert to %s\n", out_codeset); - test_conv_reply = conv_codeset_strdup(chars, src_codeset, out_codeset); - } - - if (!test_conv_global_out && !test_conv_reply) { - /* we're lost */ - out_codeset = CS_INTERNAL; - debug_print("failure; finally using %s\n", out_codeset); - } - g_free(test_conv_global_out); - g_free(test_conv_reply); - codeconv_set_strict(FALSE); + out_codeset = conv_get_outgoing_charset_str(); + if (out_codeset) { + debug_print("trying to convert to %s\n", out_codeset); + test_conv_global_out = conv_codeset_strdup(chars, src_codeset, out_codeset); } - if (!g_ascii_strcasecmp(out_codeset, CS_US_ASCII)) - out_codeset = CS_ISO_8859_1; + if (!test_conv_global_out && compose->orig_charset + && strcmp(compose->orig_charset, CS_US_ASCII)) { + out_codeset = compose->orig_charset; + debug_print("failure; trying to convert to %s\n", out_codeset); + test_conv_reply = conv_codeset_strdup(chars, src_codeset, out_codeset); + } - if (prefs_common.encoding_method == CTE_BASE64) - encoding = ENC_BASE64; - else if (prefs_common.encoding_method == CTE_QUOTED_PRINTABLE) - encoding = ENC_QUOTED_PRINTABLE; - else if (prefs_common.encoding_method == CTE_8BIT) - encoding = ENC_8BIT; - else - encoding = procmime_get_encoding_for_charset(out_codeset); - - debug_print("src encoding = %s, out encoding = %s, transfer encoding = %s\n", - src_codeset, out_codeset, procmime_get_encoding_str(encoding)); - - if (action == COMPOSE_WRITE_FOR_SEND) { - codeconv_set_strict(TRUE); - buf = conv_codeset_strdup(chars, src_codeset, out_codeset); - codeconv_set_strict(FALSE); - - if (!buf) { - AlertValue aval; - gchar *msg; - - msg = g_strdup_printf(_("Can't convert the character encoding of the message \n" - "to the specified %s charset.\n" - "Send it as %s?"), out_codeset, src_codeset); - aval = alertpanel_full(_("Error"), msg, GTK_STOCK_CANCEL, _("+_Send"), NULL, FALSE, - NULL, ALERT_ERROR, G_ALERTDEFAULT); - g_free(msg); - - if (aval != G_ALERTALTERNATE) { - g_free(chars); - return -3; - } else { - buf = chars; - out_codeset = src_codeset; - chars = NULL; - } + if (!test_conv_global_out && !test_conv_reply) { + /* we're lost */ + out_codeset = CS_INTERNAL; + debug_print("failure; finally using %s\n", out_codeset); + } + g_free(test_conv_global_out); + g_free(test_conv_reply); + codeconv_set_strict(FALSE); + } + + if (prefs_common.encoding_method == CTE_BASE64) + encoding = ENC_BASE64; + else if (prefs_common.encoding_method == CTE_QUOTED_PRINTABLE) + encoding = ENC_QUOTED_PRINTABLE; + else if (prefs_common.encoding_method == CTE_8BIT) + encoding = ENC_8BIT; + else + encoding = procmime_get_encoding_for_charset(out_codeset); + + debug_print("src encoding = %s, out encoding = %s, transfer encoding = %s\n", + src_codeset, out_codeset, procmime_get_encoding_str(encoding)); + + if (action == COMPOSE_WRITE_FOR_SEND) { + codeconv_set_strict(TRUE); + buf = conv_codeset_strdup(chars, src_codeset, out_codeset); + codeconv_set_strict(FALSE); + + if (!buf) { + AlertValue aval; + gchar *msg; + + msg = g_strdup_printf(_("Can't convert the character encoding of the message \n" + "to the specified %s charset.\n" + "Send it as %s?"), out_codeset, src_codeset); + aval = alertpanel_full(_("Error"), msg, GTK_STOCK_CANCEL, _("+_Send"), NULL, FALSE, + NULL, ALERT_ERROR, G_ALERTDEFAULT); + g_free(msg); + + if (aval != G_ALERTALTERNATE) { + g_free(chars); + return -3; + } else { + buf = chars; + out_codeset = src_codeset; + chars = NULL; } - } else { - buf = chars; - out_codeset = src_codeset; - chars = NULL; } + } else { + buf = chars; + out_codeset = src_codeset; + chars = NULL; } g_free(chars);