sync with 0.8.5cvs22
authorPaul Mangan <paul@claws-mail.org>
Mon, 11 Nov 2002 09:47:57 +0000 (09:47 +0000)
committerPaul Mangan <paul@claws-mail.org>
Mon, 11 Nov 2002 09:47:57 +0000 (09:47 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
src/codeconv.c

index 2ac8f40..1c90d7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-11-11
+
+       * src/codeconv.c: conv_encode_header(): enabled B-encoding of
+         headers on locales other than Japanese when not using libjconv.
+
 2002-11-11
 
        * src/inc.[ch]: added INC_IO_ERROR to IncState. Also added its
index 9ca35b1..abf06a1 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-11 [paul]      0.8.5claws120
+
+       * sync with 0.8.5cvs22
+               see ChangeLog 2002-11-11
+
 2002-11-11 [paul]      0.8.5claws119
 
        * sync with 0.8.5cvs21
index e625ad5..7836574 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-11
+
+       * src/codeconv.c: conv_encode_header(): libjconv Ì¤»ÈÍÑ»þ¤ËÆüËܸì
+         °Ê³°¤Î locale ¤Ç¥Ø¥Ã¥À¤Î B-encoding ¤òÍ­¸ú¤Ë¤·¤¿¡£
+
 2002-11-11
 
        * src/inc.[ch]: INC_IO_ERROR ¤ò IncState ¤ËÄɲᣤ½¤ì¤ËÂбþ¤¹¤ë
index 8ec4b1c..19ef404 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws119
+EXTRA_VERSION=claws120
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index f0c0722..658f1fa 100644 (file)
@@ -1056,6 +1056,11 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
 
        /* convert to wide-character string */
        wsrcp = wsrc = strdup_mbstowcs(src);
+       if (!wsrc) {
+               g_warning("Can't convert string to wide characters.\n");
+               strncpy2(dest, src, len);
+               return;
+       }
 
        mimehdr_len = strlen(mimehdr_init) + strlen(mimehdr_end) +
                strlen(mimehdr_charset) + strlen(mimehdr_enctype);
@@ -1065,8 +1070,6 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
        destp = dest;
        *dest = '\0';
 
-       g_return_if_fail(wsrc != NULL);
-
        while (*wsrcp) {
                wchar_t *wp, *wtmp, *wtmpp;
                gint nspc = 0;
@@ -1256,17 +1259,22 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
        gchar *mimehdr_end = "?=";
        gchar *mimehdr_enctype = "?B?";
        const gchar *mimehdr_charset;
+       gboolean do_conv = FALSE;
 
        /* g_print("src = %s\n", src); */
        mimehdr_charset = conv_get_outgoing_charset_str();
-       if (strcmp(mimehdr_charset, "ISO-2022-JP") != 0) {
-               /* currently only supports Japanese */
-               strncpy2(dest, src, len);
-               return;
-       }
+       if (strcmp(mimehdr_charset, "ISO-2022-JP") == 0)
+               do_conv = TRUE;
+       else if (strcmp(mimehdr_charset, "US-ASCII") == 0)
+               mimehdr_charset = "ISO-8859-1";
 
        /* convert to wide-character string */
        wsrcp = wsrc = strdup_mbstowcs(src);
+       if (!wsrc) {
+               g_warning("Can't convert string to wide characters.\n");
+               strncpy2(dest, src, len);
+               return;
+       }
 
        mimehdr_len = strlen(mimehdr_init) + strlen(mimehdr_end) +
                      strlen(mimehdr_charset) + strlen(mimehdr_enctype);
@@ -1276,8 +1284,6 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
        destp = dest;
        *dest = '\0';
 
-       g_return_if_fail(wsrc != NULL);
-
        while (*wsrcp) {
                wchar_t *wp, *wtmp, *wtmpp;
                gint nspc = 0;
@@ -1328,7 +1334,7 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
                                }
 
                                /* length of KI + KO */
-                               if (prev_mbl == 1 && mbl == 2)
+                               if (do_conv && prev_mbl == 1 && mbl == 2)
                                        mb_seqlen += JIS_SEQLEN * 2;
 
                                if (str_is_non_ascii) {
@@ -1389,18 +1395,21 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
                        }
 
                        if (str_is_non_ascii) {
-                               gchar *tmp_jis;
+                               gchar *raw;
 
-                               tmp_jis = g_new(gchar, tlen + mb_seqlen + 1);
-                               conv_euctojis(tmp_jis,
-                                             tlen + mb_seqlen + 1, tmp);
+                               raw = g_new(gchar, tlen + mb_seqlen + 1);
+                               if (do_conv)
+                                       conv_euctojis(raw, tlen + mb_seqlen + 1,
+                                                     tmp);
+                               else
+                                       strcpy(raw, tmp);
                                g_snprintf(destp, len - strlen(dest), "%s%s%s",
                                           mimehdr_init, mimehdr_charset,
                                           mimehdr_enctype);
                                destp += mimehdr_begin_len;
                                line_len += mimehdr_begin_len;
 
-                               base64_encode(destp, tmp_jis, strlen(tmp_jis));
+                               base64_encode(destp, raw, strlen(raw));
                                line_len += strlen(destp);
                                destp += strlen(destp);
 
@@ -1408,7 +1417,7 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src,
                                destp += strlen(mimehdr_end);
                                line_len += strlen(mimehdr_end);
 
-                               g_free(tmp_jis);
+                               g_free(raw);
                        } else {
                                strcpy(destp, tmp);
                                line_len += strlen(destp);