|
sylpheed-jp:2652
From: Harada kazutaka <kazutaka@xxxxxxxxxx> ハラダです。 > > というわけで、現状のSylpheedのjpilotアドレス帳対応では、 > > 日本語は使えないと思った方がいいと思います。 > > うーん、そうなんですか…。 > せっかくあるのに使えないのはもったいないですよね。 と言うことで初めてPatchを作ってみました。 が、正直言ってC言語が良く分からないまま見よう見まねで 適当に作った為、自分が困らない程度のひどい代物です。。。 かなり問題が多いと思いますので、後学の為に指摘/アドバイス等 して頂けると助かります。 #本当はLocaleとか見て処理を分けるべきなんでしょうが、 あまり需要は無いかと…。 --- sylpheed-0.9.10/src/jpilot.c.orig 2004-05-11 22:15:52.000000000 +0900 +++ sylpheed-0.9.10/src/jpilot.c 2004-05-13 13:32:48.000000000 +0900 @@ -997,6 +997,8 @@ gchar* extID; struct AddressAppInfo *ai; + gchar convName[ FULLNAME_BUFSIZE ]; /* for sjis conversion */ + /* Retrieve address */ num = unpack_Address( & addr, buf->buf, buf->size ); if( num > 0 ) { @@ -1006,17 +1008,21 @@ cat_id = attrib & 0x0F; *fullName = *bufEMail = '\0'; - if( addrEnt[ IND_LABEL_FIRSTNAME ] ) { - strcat( fullName, addrEnt[ IND_LABEL_FIRSTNAME ] ); + if( addrEnt[ IND_LABEL_LASTNAME ] ) { + strcat( fullName, g_strsplit( addrEnt[ IND_LABEL_LASTNAME ], "\1", -1 )[0] ); } - if( addrEnt[ IND_LABEL_LASTNAME ] ) { + if( addrEnt[ IND_LABEL_FIRSTNAME ] ) { strcat( fullName, " " ); - strcat( fullName, addrEnt[ IND_LABEL_LASTNAME ] ); + strcat( fullName, g_strsplit( addrEnt[ IND_LABEL_FIRSTNAME ], "\1", -1 )[0] ); } g_strchug( fullName ); g_strchomp( fullName ); + /* convert to sjis */ + conv_sjistoeuc( convName, NULL, fullName ); + strcpy(fullName, convName); + person = addritem_create_item_person(); addritem_person_set_common_name( person, fullName ); addritem_person_set_first_name( person, addrEnt[ IND_LABEL_FIRSTNAME ] ); @@ -1370,10 +1376,12 @@ struct AddressAppInfo *ai = & pilotFile->addrInfo; struct CategoryAppInfo *cat = & ai->category; gint i; + gchar* catName; for( i = 0; i < JPILOT_NUM_CATEG; i++ ) { ItemFolder *folder = addritem_create_item_folder(); - addritem_folder_set_name( folder, cat->name[i] ); + conv_sjistoeuc( catName, NULL, cat->name[i]); + addritem_folder_set_name( folder, catName ); addrcache_id_folder( pilotFile->addressCache, folder ); addrcache_add_folder( pilotFile->addressCache, folder ); } -------------------------------------- Kazutaka Harada e-mail:kazutaka@xxxxxxxxxx -------------------------------------- 2647 2004-05-11 00:05 [kazutaka@xxxxxxxxxx ] JPilotアドレス帳で文字化け 2649 2004-05-11 18:30 ┗[sue@xxxxxxxxxx ] 2651 2004-05-11 23:57 ┗[kazutaka@xxxxxxxxxx ] -> 2652 2004-05-13 14:19 ┗[kazutaka@xxxxxxxxxx ] @ 2654 2004-05-16 11:00 ┗[sue@xxxxxxxxxx ] 2655 2004-05-17 01:10 ┗[kazutaka@xxxxxxxxxx ] |