commit 9953ab60621a7028a7bd6eaf3f1e1ca949164c1e
parent 44c5c29fb0fc71ca5401002b309a45433b0f0e0f
Author: Colin Leroy <colin@colino.net>
Date: Wed, 14 May 2008 20:24:26 +0000
2008-05-14 [colin] 3.4.0cvs35
* src/compose.c
* src/prefs_common.c
* src/prefs_common.h
* src/prefs_send.c
Add a preference to be able to specify an
outgoing charset/encoding but still fallback
to 7bit US-ASCII when possible (default TRUE,
same behavior as pre-cvs34)
Diffstat:
7 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,14 @@
+2008-05-14 [colin] 3.4.0cvs35
+
+ * src/compose.c
+ * src/prefs_common.c
+ * src/prefs_common.h
+ * src/prefs_send.c
+ Add a preference to be able to specify an
+ outgoing charset/encoding but still fallback
+ to 7bit US-ASCII when possible (default TRUE,
+ same behavior as pre-cvs34)
+
2008-05-14 [colin] 3.4.0cvs34
* src/compose.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -3330,3 +3330,4 @@
( 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
+( cvs diff -u -r 1.382.2.449 -r 1.382.2.450 src/compose.c; cvs diff -u -r 1.204.2.169 -r 1.204.2.170 src/prefs_common.c; cvs diff -u -r 1.103.2.107 -r 1.103.2.108 src/prefs_common.h; cvs diff -u -r 1.1.2.20 -r 1.1.2.21 src/prefs_send.c; ) > 3.4.0cvs35.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=34
+EXTRA_VERSION=35
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/compose.c b/src/compose.c
@@ -5137,7 +5137,7 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
gchar *chars;
gchar *buf;
const gchar *out_codeset;
- EncodingType encoding;
+ EncodingType encoding = ENC_UNKNOWN;
MimeInfo *mimemsg, *mimetext;
gint line;
const gchar *src_codeset = CS_INTERNAL;
@@ -5164,6 +5164,10 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
if (!out_codeset && is_ascii_str(chars)) {
out_codeset = CS_US_ASCII;
+ } else if (prefs_common.outgoing_fallback_to_ascii &&
+ is_ascii_str(chars)) {
+ out_codeset = CS_US_ASCII;
+ encoding = ENC_7BIT;
}
if (!out_codeset) {
@@ -5196,14 +5200,16 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
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);
+ if (encoding == ENC_UNKNOWN) {
+ 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));
diff --git a/src/prefs_common.c b/src/prefs_common.c
@@ -208,6 +208,8 @@ static PrefParam param[] = {
NULL, NULL, NULL},
{"encoding_method", "0", &prefs_common.encoding_method, P_ENUM,
NULL, NULL, NULL},
+ {"outgoing_fallback_to_ascii", "TRUE", &prefs_common.outgoing_fallback_to_ascii, P_BOOL,
+ NULL, NULL, NULL},
{"allow_jisx0201_kana", "FALSE", &prefs_common.allow_jisx0201_kana,
P_BOOL, NULL, NULL, NULL},
diff --git a/src/prefs_common.h b/src/prefs_common.h
@@ -123,6 +123,7 @@ struct _PrefsCommon
gint sendwin_height;
gchar *outgoing_charset;
TransferEncodingMethod encoding_method;
+ gboolean outgoing_fallback_to_ascii;
gboolean allow_jisx0201_kana;
diff --git a/src/prefs_send.c b/src/prefs_send.c
@@ -53,6 +53,7 @@ typedef struct _SendPage
GtkWidget *checkbtn_senddialog;
GtkWidget *combobox_charset;
GtkWidget *combobox_encoding_method;
+ GtkWidget *checkbtn_outgoing_fallback_to_ascii;
} SendPage;
static gchar * prefs_common_charset_set_data_from_optmenu(GtkWidget *widget)
@@ -134,6 +135,7 @@ static void prefs_send_create_widget(PrefsPage *_page, GtkWindow *window,
GtkWidget *vbox1;
GtkWidget *vbox2;
GtkWidget *checkbtn_savemsg;
+ GtkWidget *checkbtn_outgoing_fallback_to_ascii;
GtkWidget *label_outcharset;
GtkWidget *combobox_charset;
GtkListStore *optmenu;
@@ -168,7 +170,7 @@ static void prefs_send_create_widget(PrefsPage *_page, GtkWindow *window,
PACK_CHECK_BUTTON(vbox2, checkbtn_senddialog,
_("Show send dialog"));
- table = gtk_table_new(2, 2, FALSE);
+ table = gtk_table_new(2, 3, FALSE);
gtk_widget_show(table);
gtk_container_add (GTK_CONTAINER (vbox1), table);
gtk_table_set_row_spacings(GTK_TABLE(table), 4);
@@ -294,6 +296,15 @@ static void prefs_send_create_widget(PrefsPage *_page, GtkWindow *window,
COMBOBOX_ADD(optmenu, "quoted-printable", CTE_QUOTED_PRINTABLE);
COMBOBOX_ADD(optmenu, "8bit", CTE_8BIT);
+ checkbtn_outgoing_fallback_to_ascii = gtk_check_button_new_with_label(
+ _("Fallback to 7bit US-ASCII when possible"));
+ gtk_widget_show(checkbtn_outgoing_fallback_to_ascii);
+ gtk_table_attach(GTK_TABLE(table), checkbtn_outgoing_fallback_to_ascii,
+ 0, 3, 3, 4,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_outgoing_fallback_to_ascii),
+ prefs_common.outgoing_fallback_to_ascii);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_savemsg),
prefs_common.savemsg);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_confirm_send_queued_messages),
@@ -310,6 +321,7 @@ static void prefs_send_create_widget(PrefsPage *_page, GtkWindow *window,
prefs_send->window = GTK_WIDGET(window);
prefs_send->checkbtn_savemsg = checkbtn_savemsg;
+ prefs_send->checkbtn_outgoing_fallback_to_ascii = checkbtn_outgoing_fallback_to_ascii;
prefs_send->checkbtn_confirm_send_queued_messages = checkbtn_confirm_send_queued_messages;
prefs_send->checkbtn_never_send_retrcpt = checkbtn_never_send_retrcpt;
prefs_send->checkbtn_senddialog = checkbtn_senddialog;
@@ -325,6 +337,8 @@ static void prefs_send_save(PrefsPage *_page)
prefs_common.savemsg = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(page->checkbtn_savemsg));
+ prefs_common.outgoing_fallback_to_ascii = gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(page->checkbtn_outgoing_fallback_to_ascii));
prefs_common.confirm_send_queued_messages = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(page->checkbtn_confirm_send_queued_messages));
prefs_common.never_send_retrcpt = gtk_toggle_button_get_active(