Index: src/jpilot.c =================================================================== RCS file: /cvsroot/sylpheed/sylpheed/src/jpilot.c,v retrieving revision 1.9 retrieving revision 1.6 diff -u -p -r1.9 -r1.6 --- src/jpilot.c 15 Dec 2004 08:09:44 -0000 1.9 +++ src/jpilot.c 13 Mar 2002 09:27:03 -0000 1.6 @@ -52,7 +52,6 @@ #include "addritem.h" #include "addrcache.h" #include "jpilot.h" -#include "codeconv.h" #define JPILOT_DBHOME_DIR ".jpilot" #define JPILOT_DBHOME_FILE "AddressDB.pdb" @@ -148,13 +147,6 @@ typedef struct { unsigned char attrib; } PC3RecordHeader; -enum { - FAMILY_LAST = 0, - FAMILY_FIRST = 1 -} name_order; - -gboolean convert_charcode; - /* * Create new pilot file object. */ @@ -561,7 +553,6 @@ static void free_mem_rec_header(mem_rec_ *mem_rh = NULL; } -#if 0 /* Shamelessly copied from JPilot (libplugin.c) */ static int jpilot_free_db_list( GList **br_list ) { GList *temp_list, *first; @@ -586,7 +577,6 @@ static int jpilot_free_db_list( GList ** *br_list=NULL; return 0; } -#endif /* Shamelessly copied from JPilot (libplugin.c) */ /* Read file size */ @@ -1006,8 +996,6 @@ static void jpilot_load_address( JPilotF GList *node; gchar* extID; struct AddressAppInfo *ai; - gchar **firstName = NULL; - gchar **lastName = NULL; /* Retrieve address */ num = unpack_Address( & addr, buf->buf, buf->size ); @@ -1018,40 +1006,16 @@ static void jpilot_load_address( JPilotF cat_id = attrib & 0x0F; *fullName = *bufEMail = '\0'; - if( addrEnt[ IND_LABEL_FIRSTNAME ] ) { - firstName = g_strsplit( addrEnt[ IND_LABEL_FIRSTNAME ], "\01", 2 ); - } - if( 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 ); + strcat( fullName, addrEnt[ IND_LABEL_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 ); + if( addrEnt[ IND_LABEL_LASTNAME ] ) { + strcat( fullName, " " ); + strcat( fullName, addrEnt[ IND_LABEL_LASTNAME ] ); } + g_strchug( fullName ); + g_strchomp( fullName ); person = addritem_create_item_person(); addritem_person_set_common_name( person, fullName ); @@ -1071,7 +1035,6 @@ static void jpilot_load_address( JPilotF 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, @@ -1096,9 +1059,7 @@ static void jpilot_load_address( JPilotF /* 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 ) { /* @@ -1113,15 +1074,7 @@ static void jpilot_load_address( JPilotF email = addritem_create_item_email(); addritem_email_set_address( email, bufEMail ); - - if( convert_charcode ) { - conv_sjistoeuc( convertBuff, JPILOT_LEN_LABEL, ai->labels[ind] ); - addritem_email_set_remarks( email, convertBuff ); - } - else { - addritem_email_set_remarks( email, ai->labels[ind] ); - } - + addritem_email_set_remarks( email, ai->labels[ind] ); addrcache_id_email( pilotFile->addressCache, email ); addrcache_person_add_email ( pilotFile->addressCache, person, email ); @@ -1136,13 +1089,11 @@ static void jpilot_load_address( JPilotF /* Add to specified category */ addrcache_folder_add_person ( pilotFile->addressCache, folderInd[cat_id], person ); - } - else { + } else { /* Add to root folder */ addrcache_add_person( pilotFile->addressCache, person ); } - } - else { + } else { addritem_free_item_person( person ); person = NULL; } @@ -1280,13 +1231,6 @@ static gboolean jpilot_setup_labels( JPi 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; @@ -1312,13 +1256,7 @@ GList *jpilot_load_label( JPilotFile *pi 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 ) { - if( convert_charcode ) { - conv_sjistoeuc( convertBuff, JPILOT_LEN_LABEL, labelName ); - labelName = convertBuff; - } labelList = g_list_append( labelList, g_strdup( labelName ) ); } else { @@ -1381,7 +1319,6 @@ GList *jpilot_load_phone_label( JPilotFi */ GList *jpilot_load_custom_label( JPilotFile *pilotFile, GList *labelList ) { gint i; - char convertBuff[JPILOT_LEN_LABEL]; g_return_val_if_fail( pilotFile != NULL, NULL ); @@ -1393,10 +1330,6 @@ GList *jpilot_load_custom_label( JPilotF g_strchomp( labelName ); g_strchug( labelName ); if( *labelName != '\0' ) { - if( convert_charcode ) { - conv_sjistoeuc( convertBuff, JPILOT_LEN_LABEL, labelName ); - labelName = convertBuff; - } labelList = g_list_append( labelList, g_strdup( labelName ) ); } } @@ -1440,16 +1373,7 @@ static void jpilot_build_category_list( for( i = 0; i < JPILOT_NUM_CATEG; i++ ) { ItemFolder *folder = addritem_create_item_folder(); - - 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] ); - } - + addritem_folder_set_name( folder, cat->name[i] ); addrcache_id_folder( pilotFile->addressCache, folder ); addrcache_add_folder( pilotFile->addressCache, folder ); } @@ -1500,21 +1424,6 @@ static void jpilot_remove_empty( JPilotF * ============================================================================================ */ 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;