2006-12-19 [colin] 2.6.1cvs54
authorColin Leroy <colin@colino.net>
Tue, 19 Dec 2006 18:08:53 +0000 (18:08 +0000)
committerColin Leroy <colin@colino.net>
Tue, 19 Dec 2006 18:08:53 +0000 (18:08 +0000)
* src/jpilot.c
Fix bug 1059, 'Better jpilot charset
handling'. Use libpisync's charset conversion
if possible

ChangeLog
PATCHSETS
configure.ac
src/jpilot.c

index 2cc3b5f80fa923bb3729e6661425ea8686fb3eab..0e15a11df221c7d6062431059c20f7e94a87c4ac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-12-19 [colin]     2.6.1cvs54
+
+       * src/jpilot.c
+               Fix bug 1059, 'Better jpilot charset 
+               handling'. Use libpisync's charset conversion
+               if possible
+
 2006-12-19 [colin]     2.6.1cvs53
 
        * po/fr.po
 2006-12-19 [colin]     2.6.1cvs53
 
        * po/fr.po
index 05c654a827604a0aa7ab2e32c33aedd867e9908e..790d96ffffd1a4c7b64ac48f703b469d0fadd3db 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.12 -r 1.1.2.13 src/prefs_receive.c;  ) > 2.6.1cvs51.patchset
 ( cvs diff -u -r 1.4.2.45 -r 1.4.2.46 src/gtk/about.c;  ) > 2.6.1cvs52.patchset
 ( cvs diff -u -r 1.42.2.28 -r 1.42.2.29 po/fr.po;  ) > 2.6.1cvs53.patchset
 ( cvs diff -u -r 1.1.2.12 -r 1.1.2.13 src/prefs_receive.c;  ) > 2.6.1cvs51.patchset
 ( cvs diff -u -r 1.4.2.45 -r 1.4.2.46 src/gtk/about.c;  ) > 2.6.1cvs52.patchset
 ( cvs diff -u -r 1.42.2.28 -r 1.42.2.29 po/fr.po;  ) > 2.6.1cvs53.patchset
+( cvs diff -u -r 1.18.2.18 -r 1.18.2.19 src/jpilot.c;  ) > 2.6.1cvs54.patchset
index 7665fa893730fa125dbf34bdc75a609cd89884b3..2f405a99672819e740f925637b55d357bab0336d 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=6
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=53
+EXTRA_VERSION=54
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
@@ -587,7 +587,7 @@ if test "$ac_cv_enable_jpilot" = yes; then
                                   AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
        fi
 
                                   AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
        fi
 
-       AC_CHECK_LIB(pisock, unpack_Address, [JPILOT_LIBS="-lpisock"], [JPILOT_LIBS="" ac_cv_enable_jpilot="no"])
+       AC_CHECK_LIB(pisock, unpack_Address, [JPILOT_LIBS="-lpisock -lpisync"], [JPILOT_LIBS="" ac_cv_enable_jpilot="no"])
        if test x"$ac_cv_enable_jpilot" = xyes; then
                AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.)
        else
        if test x"$ac_cv_enable_jpilot" = xyes; then
                AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.)
        else
index 667fda5aaf6956c2282850c9f4d493716e554267..2b80ff10dbb37be979fffc29ee546f41655b10b1 100644 (file)
 #include <netinet/in.h>
 
 #ifdef HAVE_LIBPISOCK_PI_ARGS_H
 #include <netinet/in.h>
 
 #ifdef HAVE_LIBPISOCK_PI_ARGS_H
+#  include <libpisock/pi-util.h>
 #  include <libpisock/pi-args.h>
 #  include <libpisock/pi-appinfo.h>
 #  include <libpisock/pi-address.h>
 #  include <libpisock/pi-version.h>
 #else
 #  include <libpisock/pi-args.h>
 #  include <libpisock/pi-appinfo.h>
 #  include <libpisock/pi-address.h>
 #  include <libpisock/pi-version.h>
 #else
+#  include <pi-util.h>
 #  include <pi-args.h>
 #  include <pi-appinfo.h>
 #  include <pi-address.h>
 #  include <pi-args.h>
 #  include <pi-appinfo.h>
 #  include <pi-address.h>
@@ -1102,11 +1104,17 @@ static void jpilot_parse_label( JPilotFile *pilotFile, gchar *labelEntry, ItemPe
                        email = addritem_create_item_email();
                        addritem_email_set_address( email, node->data );
                        if (convert_charcode) {
                        email = addritem_create_item_email();
                        addritem_email_set_address( email, node->data );
                        if (convert_charcode) {
-                               gchar *convertBuff;
+                               gchar *convertBuff = NULL;
+#if (PILOT_LINK_MAJOR > 11)
+                               convert_FromPilotChar(CS_INTERNAL, labelEntry, 
+                                               strlen(labelEntry), &convertBuff);
+#else
                                convertBuff = conv_codeset_strdup( labelEntry, 
                                                conv_get_locale_charset_str_no_utf8(), 
                                                CS_INTERNAL );
                                convertBuff = conv_codeset_strdup( labelEntry, 
                                                conv_get_locale_charset_str_no_utf8(), 
                                                CS_INTERNAL );
-                               addritem_email_set_remarks( email, convertBuff );
+#endif
+                               if (convertBuff)
+                                       addritem_email_set_remarks( email, convertBuff );
                                g_free( convertBuff );
                        }
                        else {
                                g_free( convertBuff );
                        }
                        else {
@@ -1201,11 +1209,17 @@ static void jpilot_load_address(
        g_strstrip( fullName );
 
        if( convert_charcode ) {
        g_strstrip( fullName );
 
        if( convert_charcode ) {
-               gchar *nameConv;
+               gchar *nameConv = NULL;
+#if (PILOT_LINK_MAJOR > 11)
+               convert_FromPilotChar(CS_INTERNAL, fullName, 
+                               strlen(fullName), &nameConv);
+#else
                nameConv = conv_codeset_strdup( fullName, 
                                conv_get_locale_charset_str_no_utf8(), 
                                CS_INTERNAL );
                nameConv = conv_codeset_strdup( fullName, 
                                conv_get_locale_charset_str_no_utf8(), 
                                CS_INTERNAL );
-               strncpy2( fullName, nameConv, FULLNAME_BUFSIZE );
+#endif
+               if (nameConv)
+                       strncpy2( fullName, nameConv, FULLNAME_BUFSIZE );
                g_free( nameConv );
        }
 
                g_free( nameConv );
        }
 
@@ -1366,15 +1380,20 @@ static gboolean jpilot_setup_labels( JPilotFile *pilotFile ) {
                        gint i;
                        for( i = 0; i < JPILOT_NUM_LABELS; i++ ) {
                                gchar *labelName = ai->labels[i];
                        gint i;
                        for( i = 0; i < JPILOT_NUM_LABELS; i++ ) {
                                gchar *labelName = ai->labels[i];
-                               gchar convertBuff[ JPILOT_LEN_LABEL ];
 
                                if( convert_charcode ) {
 
                                if( convert_charcode ) {
-                                       labelName = conv_codeset_strdup( labelName, 
+                                       gchar *convertBuff = NULL;
+#if (PILOT_LINK_MAJOR > 11)
+                                       convert_FromPilotChar(CS_INTERNAL, labelName, 
+                                                       strlen(labelName), &convertBuff);
+#else
+                                       convertBuff = conv_codeset_strdup( labelName, 
                                                        conv_get_locale_charset_str_no_utf8(), 
                                                        CS_INTERNAL );
                                                        conv_get_locale_charset_str_no_utf8(), 
                                                        CS_INTERNAL );
-                                       strncpy2( convertBuff, labelName, JPILOT_LEN_LABEL );
-                                       g_free( labelName );
-                                       labelName = convertBuff;
+#endif
+                                       if (convertBuff) {
+                                               labelName = convertBuff;
+                                       }
                                }
 
                                if( g_utf8_collate( labelName, lbl ) == 0 ) {
                                }
 
                                if( g_utf8_collate( labelName, lbl ) == 0 ) {
@@ -1409,9 +1428,18 @@ GList *jpilot_load_label( JPilotFile *pilotFile, GList *labelList ) {
 
                        if( labelName ) {
                                if( convert_charcode ) {
 
                        if( labelName ) {
                                if( convert_charcode ) {
-                                       labelName = conv_codeset_strdup( labelName, 
+                                       gchar *convertBuff = NULL;
+#if (PILOT_LINK_MAJOR > 11)
+                                       convert_FromPilotChar(CS_INTERNAL, labelName, 
+                                                       strlen(labelName), &convertBuff);
+#else
+                                       convertBuff = conv_codeset_strdup( labelName, 
                                                        conv_get_locale_charset_str_no_utf8(), 
                                                        CS_INTERNAL );
                                                        conv_get_locale_charset_str_no_utf8(), 
                                                        CS_INTERNAL );
+#endif
+                                       if (convertBuff) {
+                                               labelName = convertBuff;
+                                       }
                                }
                                else {
                                        labelName = g_strdup( labelName );
                                }
                                else {
                                        labelName = g_strdup( labelName );
@@ -1501,9 +1529,18 @@ GList *jpilot_load_custom_label( JPilotFile *pilotFile, GList *labelList ) {
                                g_strchug( labelName );
                                if( *labelName != '\0' ) {
                                        if( convert_charcode ) {
                                g_strchug( labelName );
                                if( *labelName != '\0' ) {
                                        if( convert_charcode ) {
-                                               labelName = conv_codeset_strdup( labelName, 
+                                               gchar *convertBuff = NULL;
+#if (PILOT_LINK_MAJOR > 11)
+                                               convert_FromPilotChar(CS_INTERNAL, labelName, 
+                                                               strlen(labelName), &convertBuff);
+#else
+                                               convertBuff = conv_codeset_strdup( labelName, 
                                                                conv_get_locale_charset_str_no_utf8(), 
                                                                CS_INTERNAL );
                                                                conv_get_locale_charset_str_no_utf8(), 
                                                                CS_INTERNAL );
+#endif
+                                               if (convertBuff) {
+                                                       labelName = convertBuff;
+                                               }
                                        }
                                        else {
                                                labelName = g_strdup( labelName );
                                        }
                                        else {
                                                labelName = g_strdup( labelName );
@@ -1558,12 +1595,21 @@ static void jpilot_build_category_list( JPilotFile *pilotFile ) {
                ItemFolder *folder = addritem_create_item_folder();
 
                if( convert_charcode ) {
                ItemFolder *folder = addritem_create_item_folder();
 
                if( convert_charcode ) {
-                       gchar *catName;
-                       catName = conv_codeset_strdup( cat->name[i], 
+                       gchar *convertBuff = NULL;
+#if (PILOT_LINK_MAJOR > 11)
+                       convert_FromPilotChar(CS_INTERNAL, cat->name[i], 
+                                       strlen(cat->name[i]), &convertBuff);
+#else
+                       convertBuff = conv_codeset_strdup( cat->name[i], 
                                        conv_get_locale_charset_str_no_utf8(), 
                                        CS_INTERNAL );
                                        conv_get_locale_charset_str_no_utf8(), 
                                        CS_INTERNAL );
-                       addritem_folder_set_name( folder, catName );
-                       g_free( catName );
+#endif
+                       if (convertBuff) {
+                               addritem_folder_set_name( folder, convertBuff );
+                               g_free( convertBuff );
+                       } else {
+                               addritem_folder_set_name( folder, cat->name[i] );
+                       }
                }
                else {
                        addritem_folder_set_name( folder, cat->name[i] );
                }
                else {
                        addritem_folder_set_name( folder, cat->name[i] );