2004-11-17 [paul] 0.9.12cvs152
authorPaul Mangan <paul@claws-mail.org>
Wed, 17 Nov 2004 12:18:36 +0000 (12:18 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 17 Nov 2004 12:18:36 +0000 (12:18 +0000)
* ChangeLog
* ChangeLog.jp
* NEWS
* src/compose.c
* src/jpilot.c
* src/procmime.c
sync with main 1.0.0beta3
see ChangeLog 2004-11-15 and 2004-11-16

ChangeLog
ChangeLog.claws
ChangeLog.jp
NEWS
PATCHSETS
configure.ac
src/compose.c
src/jpilot.c
src/procmime.c

index 994e71c..aec4e3b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2004-11-16
+
+       * version 1.0.0beta3
+
+2004-11-16
+
+       * src/pixmaps/error.xpm: made them smaller size to fit CList row.
+
+2004-11-16
+
+       * src/jpilot.c: applied the JPilot addressbook Japanese support
+         patch (thanks to IWAMOTO, Kouichi).
+
+2004-11-15
+
+       * src/compose.c
+         src/procmime.[ch]: use BASE64 encoding if the ratio of 8bit
+         characters in attaching text files is greater than 20%, otherwise
+         use quoted-printable (or 7bit if not at all).
+
+2004-11-12
+
+       * src/compose.c: compose_write_attach()
+         src/procmime.c: procmime_decode_content():
+         canonicalize text files before encoding to BASE64, and
+         uncanonicalize after decoding to conform with RFC 2045
+         (thanks to Nicolas Degory).
+
 2004-11-11
 
        * src/pixmaps/complete.xpm
index 4790f0f..d1d6a1c 100644 (file)
@@ -1,3 +1,14 @@
+2004-11-17 [paul]      0.9.12cvs152
+
+       * ChangeLog
+       * ChangeLog.jp
+       * NEWS
+       * src/compose.c
+       * src/jpilot.c
+       * src/procmime.c
+               sync with main 1.0.0beta3
+               see ChangeLog 2004-11-15 and 2004-11-16
+
 2004-11-17 [colin]     0.9.12cvs151
 
        * src/plugins/pgpmime/pgpmime.c
index 8c9b05a..c8e1842 100644 (file)
@@ -1,3 +1,31 @@
+2004-11-16
+
+       * version 1.0.0beta3
+
+2004-11-16
+
+       * src/pixmaps/error.xpm: CList ¤Î¹Ô¤Ë¹ç¤¦¤è¤¦¤Ë¤è¤ê¾®¤µ¤Ê¥µ¥¤¥º¤Ë¤·¤¿¡£
+
+2004-11-16
+
+       * src/jpilot.c: JPilot ¥¢¥É¥ì¥¹Ä¢¤ÎÆüËܸìÂбþ¥Ñ¥Ã¥Á¤òŬÍÑ
+         (IWAMOTO, Kouichi ¤µ¤ó thanks)¡£
+
+2004-11-15
+
+       * src/compose.c
+         src/procmime.[ch]: ÅºÉÕ¤¹¤ë¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ëÃæ¤Î 8bit Ê¸»ú¤Î³ä¹ç¤¬
+         20% ¤è¤ê¹â¤±¤ì¤Ð BASE64 ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ò»ÈÍѤ·¡¢¤½¤¦¤Ç¤Ê¤±¤ì¤Ð
+         quoted-printable ¤ò»ÈÍÑ(Á´¤¯¤Ê¤¤¾ì¹ç¤Ï 7bit)¡£
+
+2004-11-12
+
+       * src/compose.c: compose_write_attach()
+         src/procmime.c: procmime_decode_content():
+         ¥Æ¥­¥¹¥È¥Õ¥¡¥¤¥ë¤ò BASE64 ¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ëÁ°¤ËÀµµ¬²½¤·¡¢¥Ç¥³¡¼¥É
+         ¤·¤¿¸å¤ËÀµµ¬²½¤ò²ò½ü¤·¤Æ RFC 2045 ¤Ë½àµò¤¹¤ë¤è¤¦¤Ë¤·¤¿
+         (Nicolas Degory ¤µ¤ó thanks)¡£
+
 2004-11-11
 
        * src/pixmaps/complete.xpm
diff --git a/NEWS b/NEWS
index 3f0281f..f222b09 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,18 @@
 Changes of Sylpheed
 
-* 1.0beta2
+* 1.0.0beta3
+
+    * The Japanese JPilot address book has been supported.
+    * Back scrolling on Shift/Alt and Space key press has been enabled.
+    * Attached text files are now canonicalized before encoded to BASE64
+      to conform with RFC 2045.
+    * The optimal Content-Transfer-Encoding will be used when attaching
+      text files.
+    * The icons of the receive dialog have been modified.
+    * Mozilla Firefox has become a default web browser.
+    * The auto-expanding status bar has been fixed.
+
+* 1.0.0beta2
 
     * don't move or delete immediately at local filtering when immediate
       execution option is off.
@@ -10,7 +22,7 @@ Changes of Sylpheed
     * AND/OR matching option has been added to the summary search dialog.
     * APOP setting became a separate option for POP3.
 
-* 1.0beta1
+* 1.0.0beta1
 
     * Icons are added to the alert dialog and filter edit dialog.
     * Cc is added for the parameter of templates.
index 7b0585d..ffb472b 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.172 -r 1.173 src/procmsg.c; ) > 0.9.12cvs149.patchset
 ( cvs diff -u -r 1.9 -r 1.10 src/plugins/pgpmime/pgpmime.c; ) > 0.9.12cvs150.patchset
 ( cvs diff -u -r 1.10 -r 1.11 src/plugins/pgpmime/pgpmime.c; ) > 0.9.12cvs151.patchset
+( cvs diff -u -r 1.446 -r 1.447 ChangeLog; cvs diff -u -r 1.441 -r 1.442 ChangeLog.jp; cvs diff -u -r 1.51 -r 1.52 NEWS; cvs diff -u -r 1.454 -r 1.455 src/compose.c; cvs diff -u -r 1.20 -r 1.21 src/jpilot.c; cvs diff -u -r 1.92 -r 1.93 src/procmime.c; ) > 0.9.12cvs152.patchset
index a13d3ef..c371ec0 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=12
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=151
+EXTRA_VERSION=152
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index bba250c..1cd6e60 100644 (file)
@@ -2140,7 +2140,7 @@ static void compose_attach_append(Compose *compose, const gchar *file,
                        MsgFlags flags = {0, 0};
                        gchar *name;
 
-                       if (procmime_get_encoding_for_file(file) == ENC_7BIT)
+                       if (procmime_get_encoding_for_text_file(file) == ENC_7BIT)
                                ainfo->encoding = ENC_7BIT;
                        else
                                ainfo->encoding = ENC_8BIT;
@@ -2156,8 +2156,7 @@ static void compose_attach_append(Compose *compose, const gchar *file,
                        procmsg_msginfo_free(msginfo);
                } else {
                        if (!g_strncasecmp(content_type, "text", 4))
-                               ainfo->encoding =
-                                       procmime_get_encoding_for_file(file);
+                               ainfo->encoding = procmime_get_encoding_for_text_file(file);
                        else
                                ainfo->encoding = ENC_BASE64;
                        ainfo->name = g_strdup
@@ -2170,7 +2169,8 @@ static void compose_attach_append(Compose *compose, const gchar *file,
                                g_strdup("application/octet-stream");
                        ainfo->encoding = ENC_BASE64;
                } else if (!g_strncasecmp(ainfo->content_type, "text", 4))
-                       ainfo->encoding = procmime_get_encoding_for_file(file);
+                       ainfo->encoding =
+                               procmime_get_encoding_for_text_file(file);
                else
                        ainfo->encoding = ENC_BASE64;
                ainfo->name = g_strdup(g_basename(filename ? filename : file)); 
index 66b329f..d37c026 100644 (file)
@@ -51,6 +51,7 @@
 #include "addritem.h"
 #include "addrcache.h"
 #include "jpilot.h"
+#include "codeconv.h"
 #include "adbookbase.h"
 
 #define JPILOT_DBHOME_DIR   ".jpilot"
@@ -147,7 +148,14 @@ typedef struct {
        unsigned char attrib;
 } PC3RecordHeader;
 
-/**
+enum {
+       FAMILY_LAST = 0,
+       FAMILY_FIRST = 1
+} name_order;
+
+gboolean convert_charcode;
+
+/*
 * Create new pilot file object.
 * \return Initialized JPilot file object.
 */
@@ -1087,8 +1095,17 @@ static void jpilot_parse_label( JPilotFile *pilotFile, gchar *labelEntry, ItemPe
                strcpy( buffer, labelEntry );
                node = list = jpilot_parse_email( buffer );
                while( node ) {
+                       gchar convertBuff[JPILOT_LEN_LABEL];
                        email = addritem_create_item_email();
                        addritem_email_set_address( email, node->data );
+                       if (convert_charcode) {
+                               conv_sjistoeuc(convertBuff, JPILOT_LEN_LABEL, buffer);
+                               addritem_email_set_remarks(email, convertBuff);
+                       }
+                       else {
+                               addritem_email_set_remarks(email, buffer);
+                       }
+
                        addrcache_id_email( pilotFile->addressCache, email );
                        addrcache_person_add_email( pilotFile->addressCache, person, email );
                        node = g_list_next( node );
@@ -1120,6 +1137,8 @@ static void jpilot_load_address(
        GList *node;
        gchar* extID;
        struct AddressAppInfo *ai;
+       gchar **firstName = NULL;
+       gchar **lastName = NULL;
 
        /* Retrieve address */
        num = unpack_Address( & addr, buf->buf, buf->size );
@@ -1130,16 +1149,41 @@ static void jpilot_load_address(
                cat_id = attrib & 0x0F;
 
                *fullName = '\0';
+
                if( addrEnt[ IND_LABEL_FIRSTNAME ] ) {
-                       strcat( fullName, addrEnt[ IND_LABEL_FIRSTNAME ] );
+                       firstName = g_strsplit( addrEnt[ IND_LABEL_FIRSTNAME ], "\01", 2 );
                }
 
                if( addrEnt[ IND_LABEL_LASTNAME ] ) {
-                       strcat( fullName, " " );
-                       strcat( fullName, addrEnt[ IND_LABEL_LASTNAME ] );
+                       lastName = g_strsplit( addrEnt[ IND_LABEL_LASTNAME ], "\01", 2 );
+               }
+
+               if( name_order == FAMILY_LAST ) {
+                       g_snprintf( fullName, FULLNAME_BUFSIZE, "%s %s",
+                                   firstName ? firstName[0] : "",
+                                   lastName ? lastName[0] : "" );
+               }
+               else {
+                       g_snprintf( fullName, FULLNAME_BUFSIZE, "%s %s",
+                                   lastName ? lastName[0] : "",
+                                   firstName ? firstName[0] : "" );
+               }
+
+               if( firstName ) {
+                       g_strfreev( firstName );
+               }
+               if( lastName ) {
+                       g_strfreev( lastName );
+               }
+
+               g_strstrip( fullName );
+
+               if( convert_charcode ) {
+                       gchar *nameConv;
+                       nameConv = g_strdup( fullName );
+                       conv_sjistoeuc( fullName, FULLNAME_BUFSIZE, nameConv );
+                       g_free( nameConv );
                }
-               g_strchug( fullName );
-               g_strchomp( fullName );
 
                person = addritem_create_item_person();
                addritem_person_set_common_name( person, fullName );
@@ -1159,6 +1203,7 @@ static void jpilot_load_address(
                indPhoneLbl = addr.phoneLabel;
                for( k = 0; k < JPILOT_NUM_ADDR_PHONE; k++ ) {
                        gint ind;
+
                        ind = indPhoneLbl[k];
                        /*
                        * fprintf( stdout, "%d : %d : %20s : %s\n", k, ind,
@@ -1173,7 +1218,9 @@ static void jpilot_load_address(
                /* Add entry for each custom label */
                node = pilotFile->labelInd;
                while( node ) {
+                       gchar convertBuff[JPILOT_LEN_LABEL];
                        gint ind;
+
                        ind = GPOINTER_TO_INT( node->data );
                        if( ind > -1 ) {
                                /*
@@ -1298,6 +1345,13 @@ static gboolean jpilot_setup_labels( JPilotFile *pilotFile ) {
                        gint i;
                        for( i = 0; i < JPILOT_NUM_LABELS; i++ ) {
                                gchar *labelName = ai->labels[i];
+                               gchar convertBuff[ JPILOT_LEN_LABEL ];
+
+                               if( convert_charcode ) {
+                                       conv_sjistoeuc( convertBuff, JPILOT_LEN_LABEL, labelName );
+                                       labelName = convertBuff;
+                               }
+
                                if( g_strcasecmp( labelName, lbl ) == 0 ) {
                                        ind = i;
                                        break;
@@ -1327,9 +1381,14 @@ GList *jpilot_load_label( JPilotFile *pilotFile, GList *labelList ) {
                struct AddressAppInfo *ai = & pilotFile->addrInfo;
                for( i = 0; i < JPILOT_NUM_LABELS; i++ ) {
                        gchar *labelName = ai->labels[i];
+                       gchar convertBuff[JPILOT_LEN_LABEL];
+
                        if( labelName ) {
-                               labelList = g_list_append(
-                                       labelList, g_strdup( labelName ) );
+                               if( convert_charcode ) {
+                                       conv_sjistoeuc( convertBuff, JPILOT_LEN_LABEL, labelName );
+                                       labelName = convertBuff;
+                               }
+                               labelList = g_list_append( labelList, g_strdup( labelName ) );
                        }
                        else {
                                labelList = g_list_append(
@@ -1402,6 +1461,7 @@ GList *jpilot_load_phone_label( JPilotFile *pilotFile, GList *labelList ) {
  */
 GList *jpilot_load_custom_label( JPilotFile *pilotFile, GList *labelList ) {
        gint i;
+       char convertBuff[JPILOT_LEN_LABEL];
 
        g_return_val_if_fail( pilotFile != NULL, NULL );
 
@@ -1413,8 +1473,11 @@ GList *jpilot_load_custom_label( JPilotFile *pilotFile, GList *labelList ) {
                                g_strchomp( labelName );
                                g_strchug( labelName );
                                if( *labelName != '\0' ) {
-                                       labelList = g_list_append( labelList,
-                                               g_strdup( labelName ) );
+                                       if( convert_charcode ) {
+                                               conv_sjistoeuc( convertBuff, JPILOT_LEN_LABEL, labelName );
+                                               labelName = convertBuff;
+                                       }
+                                       labelList = g_list_append( labelList, g_strdup( labelName ) );
                                }
                        }
                }
@@ -1462,7 +1525,16 @@ static void jpilot_build_category_list( JPilotFile *pilotFile ) {
 
        for( i = 0; i < JPILOT_NUM_CATEG; i++ ) {
                ItemFolder *folder = addritem_create_item_folder();
-               addritem_folder_set_name( folder, cat->name[i] );
+
+               if( convert_charcode ) {
+                       gchar catName[ JPILOT_LEN_CATEG ];
+                       conv_sjistoeuc( catName, JPILOT_LEN_CATEG, cat->name[i] );
+                       addritem_folder_set_name( folder, catName );
+               }
+               else {
+                       addritem_folder_set_name( folder, cat->name[i] );
+               }
+
                addrcache_id_folder( pilotFile->addressCache, folder );
                addrcache_add_folder( pilotFile->addressCache, folder );
        }
@@ -1575,6 +1647,21 @@ static gint jpilot_read_file( JPilotFile *pilotFile ) {
  *         successfully.
  */
 gint jpilot_read_data( JPilotFile *pilotFile ) {
+       const gchar *cur_locale;
+
+       name_order = FAMILY_LAST;
+       convert_charcode = FALSE;
+
+       cur_locale = conv_get_current_locale();
+
+       if( g_strncasecmp( cur_locale, "ja", 2 ) == 0 ) {
+               name_order = FAMILY_FIRST;
+       }
+
+       if( conv_get_current_charset() == C_EUC_JP ) {
+               convert_charcode = TRUE;
+       }
+
        g_return_val_if_fail( pilotFile != NULL, -1 );
 
        pilotFile->retVal = MGU_SUCCESS;
index 5ac1938..e630e6c 100644 (file)
@@ -997,31 +997,52 @@ EncodingType procmime_get_encoding_for_charset(const gchar *charset)
                return ENC_8BIT;
 }
 
-EncodingType procmime_get_encoding_for_file(const gchar *file)
+EncodingType procmime_get_encoding_for_text_file(const gchar *file)
 {
        FILE *fp;
-       guchar buf[BUFSIZ];
+       guchar buf[BUFFSIZE];
        size_t len;
+       size_t octet_chars = 0;
+       size_t total_len = 0;
+       gfloat octet_percentage;
 
        if ((fp = fopen(file, "rb")) == NULL) {
                FILE_OP_ERROR(file, "fopen");
                return ENC_UNKNOWN;
        }
 
-       while ((len = fread(buf, sizeof(gchar), sizeof(buf), fp)) > 0) {
+       while ((len = fread(buf, sizeof(guchar), sizeof(buf), fp)) > 0) {
                guchar *p;
                gint i;
 
-               for (p = buf, i = 0; i < len; p++, i++) {
-                       if (*p & 0x80) {
-                               fclose(fp);
-                               return ENC_BASE64;
-                       }
+               for (p = buf, i = 0; i < len; ++p, ++i) {
+                       if (*p & 0x80)
+                               ++octet_chars;
                }
+               total_len += len;
        }
 
        fclose(fp);
-       return ENC_7BIT;
+       
+       if (total_len > 0)
+               octet_percentage = (gfloat)octet_chars / (gfloat)total_len;
+       else
+               octet_percentage = 0.0;
+
+       debug_print("procmime_get_encoding_for_text_file(): "
+                   "8bit chars: %d / %d (%f%%)\n", octet_chars, total_len,
+                   100.0 * octet_percentage);
+
+       if (octet_percentage > 0.20) {
+               debug_print("using BASE64\n");
+               return ENC_BASE64;
+       } else if (octet_chars > 0) {
+               debug_print("using quoted-printable\n");
+               return ENC_QUOTED_PRINTABLE;
+       } else {
+               debug_print("using 7bit\n");
+               return ENC_7BIT;
+       }
 }
 
 struct EncodingTable