GnomeICU kanji_conv patch



Hello guys.

I made a patch to Japanese code translation patch for GnomeICU.
It's just like rus_conv(). (toggle with Preferences)

Japanese code is Shift_JIS, on Windows or MacOS.
But on Linux(and others), usual Japanese code is EUC-JP.
This patch provides function to convert them into mutually.

But the function kanji_con() use iconv(3).
So I modified also configure.in, acconfig.h and etc..

I would like to merge this patch to original tree.

Best regards.

-- 
Takuo KITAME / kitame@northeye.org
   - It was a dark and stormy night... -
Index: acconfig.h
===================================================================
RCS file: /home/cvs/gnomeicu/acconfig.h,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.1.2.2
diff -u -a -r1.1.1.2 -r1.1.1.1.2.2
--- acconfig.h	2000/05/24 11:58:57	1.1.1.2
+++ acconfig.h	2000/05/24 13:57:08	1.1.1.1.2.2
@@ -9,6 +9,7 @@
 #undef HAVE_LC_MESSAGES
 #undef HAVE_STPCPY
 #undef ENABLE_NLS
+#undef HAVE_ICONV
 #undef TRACE_FUNCTION
 #undef USE_NEW_STORAGE
 #undef USE_STATUS_MENU
Index: configure.in
===================================================================
RCS file: /home/cvs/gnomeicu/configure.in,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.1.2.3
diff -u -a -r1.1.1.2 -r1.1.1.1.2.3
--- configure.in	2000/05/24 11:58:57	1.1.1.2
+++ configure.in	2000/05/24 16:39:11	1.1.1.1.2.3
@@ -224,6 +224,8 @@
  AC_MSG_RESULT(yes)
 ])
 
+AC_CHECK_HEADER([iconv.h], AC_DEFINE(HAVE_ICONV))
+
 AC_OUTPUT(
 Makefile
 po/Makefile.in
Index: src/Makefile.am
===================================================================
RCS file: /home/cvs/gnomeicu/src/Makefile.am,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.1.2.3
diff -u -a -r1.1.1.2 -r1.1.1.1.2.3
--- src/Makefile.am	2000/05/24 11:58:58	1.1.1.2
+++ src/Makefile.am	2000/05/24 16:14:37	1.1.1.1.2.3
@@ -50,6 +50,7 @@
 	sendmsg.c	\
 	server.c	\
 	showlist.c	\
+	kanji_conv.c	\
 	tcp.c		\
 	userserver.c	\
 	util.c		\
@@ -96,6 +97,7 @@
 	sendmsg.h	\
 	server.h	\
 	showlist.h	\
+	kanji_conv.h	\
 	tcp.h		\
 	timezone.h	\
 	userserver.h	\
Index: src/common.h
===================================================================
RCS file: /home/cvs/gnomeicu/src/common.h,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.1.2.2
diff -u -a -r1.1.1.2 -r1.1.1.1.2.2
--- src/common.h	2000/05/24 11:58:59	1.1.1.2
+++ src/common.h	2000/05/24 16:14:38	1.1.1.1.2.2
@@ -70,6 +70,7 @@
 	gboolean animate;
 	gboolean show_window;
 	gboolean russian;
+	gboolean kanji;
 	gboolean no_new_users;
 	gboolean hidetooltip;
 	gboolean sort_contacts;
@@ -568,6 +569,7 @@
 #include "pixmaps.h"
 #include "response.h"
 #include "rus_conv.h"
+#include "kanji_conv.h"
 #include "search.h"
 #include "sendcontact.h"
 #include "sendmsg.h"
Index: src/gnomecfg.c
===================================================================
RCS file: /home/cvs/gnomeicu/src/gnomecfg.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.1.2.2
diff -u -a -r1.1.1.2 -r1.1.1.1.2.2
--- src/gnomecfg.c	2000/05/24 11:58:59	1.1.1.2
+++ src/gnomecfg.c	2000/05/24 16:14:38	1.1.1.1.2.2
@@ -167,6 +167,7 @@
 	toggles->webpresence = gnome_config_get_bool( "Toggles/WebPresence=false" );
 	toggles->show_window = gnome_config_get_bool( "Toggles/ShowWindow=false" );
 	toggles->russian = gnome_config_get_bool( "Toggles/Russian=false" );
+	toggles->kanji = gnome_config_get_bool( "Toggles/Kanji=false" );
 	toggles->full_reply = gnome_config_get_bool( "Toggles/FullReply=true" );
 	toggles->auto_popup = gnome_config_get_bool( "Toggles/AutoPopup=false" );
 	toggles->no_new_users = gnome_config_get_bool( "Toggles/NoNewUsers=false" );
@@ -533,6 +534,7 @@
 	gnome_config_clean_key( "Toggles/Headers" );
 	gnome_config_set_bool( "Toggles/ShowWindow", toggles->show_window );
 	gnome_config_set_bool( "Toggles/Russian", toggles->russian );
+	gnome_config_set_bool( "Toggles/Kanji", toggles->kanji );
 	gnome_config_set_bool( "Toggles/FullReply", toggles->full_reply );
 	gnome_config_set_bool( "Toggles/AutoPopup", toggles->auto_popup );
 	gnome_config_set_bool( "Toggles/NoNewUsers", toggles->no_new_users );
Index: src/gtkconf.c
===================================================================
RCS file: /home/cvs/gnomeicu/src/gtkconf.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.1.2.3
diff -u -a -r1.1.1.2 -r1.1.1.1.2.3
--- src/gtkconf.c	2000/05/24 11:58:59	1.1.1.2
+++ src/gtkconf.c	2000/05/24 16:26:39	1.1.1.1.2.3
@@ -189,6 +189,7 @@
 	GtkWidget *frame4;
 	GtkWidget *vbox7;
 	GtkWidget *russian_button;
+	GtkWidget *kanji_button;
 	GtkWidget *dumpudp_button;
 	GtkWidget *dumptcp_button;
 	GtkWidget *frame5;
@@ -739,6 +740,15 @@
  	gtk_widget_show( russian_button );
  	gtk_box_pack_start( GTK_BOX( vbox7 ), russian_button, FALSE, FALSE, 0 );
 
+ 	/* Kanji reencoding toggle button*/
+ 	kanji_button = gtk_check_button_new_with_label( _("Kanji EUC<->SJIS translation (If have iconv.)") );
+	gtk_widget_set_name (kanji_button, "kanji_button");
+	gtk_widget_ref (kanji_button);
+	gtk_object_set_data_full (GTK_OBJECT (GnomeICU_Options), "kanji_button", kanji_button,
+	                          (GtkDestroyNotify) gtk_widget_unref);
+ 	gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( kanji_button ), temp_toggles->kanji );
+ 	gtk_widget_show( kanji_button );
+ 	gtk_box_pack_start( GTK_BOX( vbox7 ), kanji_button, FALSE, FALSE, 0 );
 
 	dumpudp_button = gtk_check_button_new_with_label (_("Dump UDP Packets"));
 	gtk_widget_set_name (dumpudp_button, "dumpudp_button");
@@ -1581,6 +1591,9 @@
 	gtk_signal_connect (GTK_OBJECT( russian_button ), "toggled",
 	                    GTK_SIGNAL_FUNC( toggle_switch ),
 	                    &temp_toggles->russian);
+	gtk_signal_connect (GTK_OBJECT( kanji_button ), "toggled",
+	                    GTK_SIGNAL_FUNC( toggle_switch ),
+	                    &temp_toggles->kanji);
 	gtk_signal_connect (GTK_OBJECT (fullreply_button), "toggled",
 	                    GTK_SIGNAL_FUNC (toggle_switch),
 	                    &temp_toggles->full_reply);
Index: src/kanji_conv.c
===================================================================
RCS file: kanji_conv.c
diff -N kanji_conv.c
--- /dev/null	Wed May 10 09:14:09 2000
+++ src/kanji_conv.c	Thu May 25 01:29:20 2000
@@ -0,0 +1,77 @@
+/* $Id: kanji_conv.c,v 1.1.2.4 2000/05/24 16:24:47 kitame Exp $
+
+  Copyright (C) 2000  Takuo KITAME <kitame@northeye.org>
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License with
+  the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL;
+  if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+  Suite 330, Boston, MA  02111-1307  USA
+
+ */
+
+#include "common.h"
+#include "gnomeicu.h"
+#include <stdio.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_ICONV
+#include <iconv.h>
+
+static const gchar *code[] = { "EUC-JP", "Shift_JIS" };
+
+void
+kanji_conv(gchar **str, gint from_code, gint to_code)
+{
+	iconv_t cd;
+	size_t isize;
+	size_t osize;    
+	gchar *outbuf, *p, *s0 = *str;
+    const gchar *from = code[from_code], *to = code[to_code];
+
+#ifdef TRACE_FUNCTION
+    printf("kanji_conv start (%s), %s to", *str, from, to);
+#endif
+
+    if(!toggles->kanji) return;
+
+	isize = strlen(*str) + 1;
+	osize = isize * 4;
+	p = outbuf = (char *)malloc(osize);
+	cd = iconv_open( to, from );
+	iconv(cd, (const char **)str, &isize, &outbuf, &osize);
+	iconv_close(cd);
+	free(s0);
+	*str = (char *)strdup(p);
+    if(*p)
+        free(p);
+
+#ifdef TRACE_FUNCTION
+    printf(" %s (%s).\n", to, *str);
+#endif
+
+	return;
+}
+
+#else
+void kanji_conv(gchar **str, gint from_code, gint to_code)
+{
+#ifdef TRACE_FUNCTION
+    printf("kanji_conv, did nothing.\n");
+#endif
+    /* do nothing */
+    return;
+}
+#endif
Index: src/kanji_conv.h
===================================================================
RCS file: kanji_conv.h
diff -N kanji_conv.h
--- /dev/null	Wed May 10 09:14:09 2000
+++ src/kanji_conv.h	Thu May 25 01:29:20 2000
@@ -0,0 +1,34 @@
+/*  $Id: kanji_conv.h,v 1.1.2.2 2000/05/24 16:24:53 kitame Exp $
+ 
+  Copyright (C) 2000  Takuo KITAME <kitame@northeye.org>
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License with
+  the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL;
+  if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+  Suite 330, Boston, MA  02111-1307  USA
+
+ */
+
+#ifndef __KANJI_CONV__H__
+#define __KANJI_CONV__H__
+
+#include <glib.h>
+
+enum {
+    KANJI_EUC,
+    KANJI_SJIS
+};
+
+void kanji_conv(gchar **str, gint from_code, gint to_code);
+
+#endif
Index: src/response.c
===================================================================
RCS file: /home/cvs/gnomeicu/src/response.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.1.2.5
diff -u -a -r1.1.1.2 -r1.1.1.1.2.5
--- src/response.c	2000/05/24 11:59:00	1.1.1.2
+++ src/response.c	2000/05/24 16:36:51	1.1.1.1.2.5
@@ -58,7 +58,7 @@
 	r_mesg = ( RECV_MESSAGE_PTR )pak.data;
 	last_recv_uin = Chars_2_DW( r_mesg->uin );
 
-	msg_time->tm_year = Chars_2_Word( r_mesg->year ) - 1900;
+	msg_time->tm_year = Chars_2_Word( r_mesg->year );
 	msg_time->tm_mon = r_mesg->month - 1;
 	msg_time->tm_mday = r_mesg->day;
 	msg_time->tm_min = r_mesg->minute;
@@ -519,6 +519,7 @@
 	DestContact->info->nick = (char*)g_malloc( strlen( &pak.data[6] ) + 1 );
 	strcpy( DestContact->info->nick, &pak.data[6] );
 	rus_conv(RUS_WIN_KOI, DestContact->info->nick);
+	kanji_conv(&(DestContact->info->nick), KANJI_SJIS, KANJI_EUC);
 
 
 	if( atoi( DestContact->nick ) == DestContact->uin && DestContact->uin &&
@@ -536,12 +537,14 @@
 	DestContact->info->first = (char*)g_malloc( strlen( tmp+2 ) + 1 );
 	strcpy( DestContact->info->first, tmp+2 );
 	rus_conv(RUS_WIN_KOI, DestContact->info->first);
+	kanji_conv(&(DestContact->info->first), KANJI_SJIS, KANJI_EUC);
 	tmp += len + 2;
 	
 	len = Chars_2_Word( tmp );
 	DestContact->info->last = (char*)g_malloc( strlen( tmp+2 ) + 1 );
 	strcpy( DestContact->info->last, tmp+2 );
 	rus_conv(RUS_WIN_KOI, DestContact->info->last);
+	kanji_conv(&(DestContact->info->last), KANJI_SJIS, KANJI_EUC);
 	tmp += len + 2;
    
 	len = Chars_2_Word( tmp );
@@ -670,6 +673,7 @@
 			*tmp = '\0';
 			tmp++;
 			rus_conv(RUS_WIN_KOI,data);
+            /* kanji_conv(&data, KANJI_SJIS, KANJI_EUC); */
 			data = tmp;
 			tmp = strchr( tmp, '\xFE' );
 
@@ -682,6 +686,7 @@
 			*tmp = '\0';
 			tmp++;
 			rus_conv(RUS_WIN_KOI,data);
+            /* kanji_conv(&data, KANJI_SJIS, KANJI_EUC); */
 			data = tmp;
 			tmp = strchr( tmp, '\xFE' );
 			if ( tmp == NULL )
@@ -694,6 +699,7 @@
 			tmp++;
 			rus_conv(RUS_WIN_KOI,data);
 			data = tmp;
+            kanji_conv(&data, KANJI_SJIS, KANJI_EUC); /* kanji_conv is needed only one */
 			Do_Msg( time( NULL ), 0, data, uin, MESSAGE_USER_ADD );
 			break;
 		case AUTH_REQ_MESS:
@@ -707,6 +713,7 @@
 			*tmp = '\0';
 			rus_conv(RUS_WIN_KOI,data);
 			rus_conv(RUS_WIN_KOI,data);
+            /* kanji_conv(&data, KANJI_SJIS, KANJI_EUC); */
 			tmp++;
 			data = tmp;
 			tmp = strchr( tmp, '\xFE' );
@@ -729,6 +736,7 @@
 			*tmp = '\0';
 			tmp++;
 			rus_conv(RUS_WIN_KOI,data);
+            /* kanji_conv(&data, KANJI_SJIS, KANJI_EUC); */
 			data = tmp;
 			tmp = strchr( tmp, '\xFE' );
 			if ( tmp == NULL )
@@ -740,6 +748,7 @@
 			*tmp = '\0';
 			tmp++;
 			rus_conv(RUS_WIN_KOI,data);
+            /* kanji_conv(&data, KANJI_SJIS, KANJI_EUC); */
 			data = tmp;
 			tmp = strchr( tmp, '\xFE' );
 	
@@ -752,14 +761,17 @@
 			tmp ++;
 			rus_conv(RUS_WIN_KOI,data);
 			data = tmp;
+            kanji_conv(&data, KANJI_SJIS, KANJI_EUC);
 			Do_Msg( time( NULL ), 0, data, uin, MESSAGE_AUTH_REQ );
 			break;
 
 		case URL_MESS:
+            kanji_conv(&data, KANJI_SJIS, KANJI_EUC);
 			Do_Msg( time( NULL ), 0, data, uin, MESSAGE_URL );
 			break;
 
 		case AUTH_MESS:
+            kanji_conv(&data, KANJI_SJIS, KANJI_EUC);
 			Do_Msg( time( NULL ), 0, data, uin, MESSAGE_USER_AUTHD );
 			break;
 			
@@ -768,14 +780,17 @@
 			{
 				case MESSAGE_USER_AUTHD:
 					rus_conv( RUS_WIN_KOI, data );
+                    kanji_conv(&data, KANJI_SJIS, KANJI_EUC);
 					gnomeicu_event( EV_AUTH , uin );
 					break;
 				case MESSAGE_FILE_REQ:
 					rus_conv( RUS_WIN_KOI, data );
+                    kanji_conv(&data, KANJI_SJIS, KANJI_EUC);
 					gnomeicu_event( EV_FILEREQ,uin );
 					break;
 				case MESSAGE_CHAT_REQ:
 					rus_conv( RUS_WIN_KOI, data );
+                    kanji_conv(&data, KANJI_SJIS, KANJI_EUC);
 					gnomeicu_event( EV_CHATREQ,uin );
 					break;
 				case MESSAGE_URL:
@@ -793,6 +808,7 @@
 				case MESSAGE_TEXT:
 				default:
 					rus_conv( RUS_WIN_KOI, data );
+                    kanji_conv(&data, KANJI_SJIS, KANJI_EUC);
 					gnomeicu_event( EV_MSGRECV,uin );
 			}
 			if( uin != 0 )
@@ -877,6 +893,10 @@
 				if( toggles->applet )
 					applet_update( Current_Status, NULL );
 				Show_Quick_Status();
+#ifdef HAVE_CONV
+                if((uin > 0) && data)
+                    g_free(data);
+#endif
 			}
 	}
 	return contact;
@@ -924,6 +944,7 @@
 
 		strcpy( sender, ((CONTACT_PTR)contact->data)->nick );
 		rus_conv(RUS_WIN_KOI,((CONTACT_PTR)contact->data)->nick );
+        kanji_conv(&(((CONTACT_PTR)contact->data)->nick), KANJI_SJIS, KANJI_EUC);
 		if( Current_Status == STATUS_FREE_CHAT )
 			return contact;
 
@@ -936,7 +957,7 @@
 		((CONTACT_PTR)contact->data)->chat_reason = (char*)g_malloc( strlen( data ) + 1 );
 		strcpy( ((CONTACT_PTR)contact->data)->chat_reason, data );
 		rus_conv(RUS_WIN_KOI,((CONTACT_PTR)contact->data)->chat_reason);
-
+        kanji_conv(&(((CONTACT_PTR)contact->data)->chat_reason), KANJI_SJIS, KANJI_EUC);
 		((CONTACT_PTR)contact->data)->chat_seq = seq;
 
 		new_stored_message = g_new0( stored_message, 1 );
@@ -1062,6 +1083,7 @@
 	DestContact->info->city = (char*)g_malloc( strlen( &pak.data[6] ) + 1 );
 	strcpy( DestContact->info->city, &pak.data[6] );
 	rus_conv(RUS_WIN_KOI, DestContact->info->city);
+    kanji_conv(&(DestContact->info->city), KANJI_SJIS, KANJI_EUC);
 	tmp = &pak.data[6 + len ];
 
 	tmp += 2; /* Bypass COUNTRY_CODE */
@@ -1071,6 +1093,7 @@
 	DestContact->info->state = (char*)g_malloc( strlen( tmp+2 ) + 1 );
 	strcpy( DestContact->info->state, tmp+2 );
 	rus_conv(RUS_WIN_KOI, DestContact->info->state);
+    kanji_conv(&(DestContact->info->state), KANJI_SJIS, KANJI_EUC);
 	tmp += len + 2;
 
 	DestContact->info->age = Chars_2_Word( tmp );
@@ -1104,7 +1127,7 @@
 	DestContact->info->about = (char*)g_malloc( strlen( tmp+2 ) + 1 );
 	strcpy( DestContact->info->about, tmp+2 );
 	rus_conv(RUS_WIN_KOI, DestContact->info->about);
-
+    kanji_conv(&(DestContact->info->about), KANJI_SJIS, KANJI_EUC);
 	if( contact != NULL )
 		dump_personal_info( DestContact->uin );
 	else
@@ -1264,6 +1287,7 @@
 				data += 2;
 				DestContact->info->nick = g_strdup( data );
 				rus_conv(RUS_WIN_KOI, DestContact->info->nick);
+                kanji_conv(&(DestContact->info->nick), KANJI_SJIS, KANJI_EUC);
 				gtk_clist_set_text( GTK_CLIST( DestContact->info->window ),
 				                    0, 1, DestContact->info->nick );
 				data += len_str;
@@ -1271,6 +1295,7 @@
 				data += 2;
 				DestContact->info->first = g_strdup( data );
 				rus_conv(RUS_WIN_KOI, DestContact->info->first);
+                kanji_conv(&(DestContact->info->first), KANJI_SJIS, KANJI_EUC);
 				gtk_clist_set_text( GTK_CLIST( DestContact->info->window ),
 				                    0, 2, DestContact->info->first );
 				data += len_str;
@@ -1278,6 +1303,7 @@
 				data += 2;
 				DestContact->info->last = g_strdup( data );
 				rus_conv(RUS_WIN_KOI, DestContact->info->last);
+                kanji_conv(&(DestContact->info->last), KANJI_SJIS, KANJI_EUC);
 				gtk_clist_set_text( GTK_CLIST( DestContact->info->window ),
 				                    0, 3, DestContact->info->last );
 				data += len_str;
@@ -1301,11 +1327,13 @@
 				data += 2;
 				DestContact->info->city = g_strdup( data );
 				rus_conv(RUS_WIN_KOI, DestContact->info->city);
+                kanji_conv(&(DestContact->info->city), KANJI_SJIS, KANJI_EUC);
 				data += len_str;
 				len_str = Chars_2_Word( data );
 				data += 2;
 				DestContact->info->state = g_strdup( data );
 				rus_conv(RUS_WIN_KOI, DestContact->info->state);
+                kanji_conv(&(DestContact->info->state), KANJI_SJIS, KANJI_EUC);
 				data += len_str;
 				len_str = Chars_2_Word( data );
 				data += 2;
@@ -1319,6 +1347,7 @@
 				data += 2;
 				DestContact->info->street = g_strdup( data );
 				rus_conv(RUS_WIN_KOI, DestContact->info->street);
+                kanji_conv(&(DestContact->info->street), KANJI_SJIS, KANJI_EUC);
 				data += len_str;
 				len_str = Chars_2_Word( data );
 				data += 2;
@@ -1439,6 +1468,7 @@
 			data += 2;
 			DestContact->info->about = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->about);
+            kanji_conv(&(DestContact->info->about), KANJI_SJIS, KANJI_EUC);
 			break;
 		case META_SRV_WORK:
 			data += 2;
@@ -1449,11 +1479,13 @@
 			data += 2;
 			DestContact->info->work_city = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->work_city);
+            kanji_conv(&(DestContact->info->work_city), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			len_str = Chars_2_Word( data );
 			data += 2;
 			DestContact->info->work_state = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->work_state);
+            kanji_conv(&(DestContact->info->work_state), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			len_str = Chars_2_Word( data );
 			data += 2;
@@ -1467,22 +1499,26 @@
 			data += 2;
 			DestContact->info->work_address = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->work_address);
+            kanji_conv(&(DestContact->info->work_address), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			data += 6; /* Skip unknown data */
 			len_str = Chars_2_Word( data );
 			data += 2;
 			DestContact->info->company_name = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->company_name);
+            kanji_conv(&(DestContact->info->company_name), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			len_str = Chars_2_Word( data );
 			data += 2;
 			DestContact->info->department = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->department);
+            kanji_conv(&(DestContact->info->department), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			len_str = Chars_2_Word( data );
 			data += 2;
 			DestContact->info->job_pos = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->job_pos);
+            kanji_conv(&(DestContact->info->job_pos), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			data += 2; /* Skip unknown data */
 			len_str = Chars_2_Word( data );
@@ -1499,6 +1535,7 @@
 			data += 2;
 			DestContact->info->nick = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->nick);
+            kanji_conv(&(DestContact->info->nick), KANJI_SJIS, KANJI_EUC);
 			if( atoi( DestContact->nick ) == DestContact->uin )
 			{
 				strcpy( DestContact->nick, DestContact->info->nick );
@@ -1518,11 +1555,13 @@
 			data += 2;
 			DestContact->info->first = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->first);
+            kanji_conv(&(DestContact->info->first), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			len_str = Chars_2_Word( data );
 			data += 2;
 			DestContact->info->last = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->last);
+            kanji_conv(&(DestContact->info->last), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			len_str = Chars_2_Word( data );
 			data += 2;
@@ -1542,11 +1581,13 @@
 			data += 2;
 			DestContact->info->city = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->city);
+            kanji_conv(&(DestContact->info->city), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			len_str = Chars_2_Word( data );
 			data += 2;
 			DestContact->info->state = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->state);
+            kanji_conv(&(DestContact->info->state), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			len_str = Chars_2_Word( data );
 			data += 2;
@@ -1560,6 +1601,7 @@
 			data += 2;
 			DestContact->info->street = g_strdup( data );
 			rus_conv(RUS_WIN_KOI, DestContact->info->street);
+            kanji_conv(&(DestContact->info->street), KANJI_SJIS, KANJI_EUC);
 			data += len_str;
 			len_str = Chars_2_Word( data );
 			data += 2;
Index: src/sendmsg.c
===================================================================
RCS file: /home/cvs/gnomeicu/src/sendmsg.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.1.2.5
diff -u -a -r1.1.1.2 -r1.1.1.1.2.5
--- src/sendmsg.c	2000/05/24 11:59:00	1.1.1.2
+++ src/sendmsg.c	2000/05/24 16:36:44	1.1.1.1.2.5
@@ -226,6 +226,7 @@
 	/* Add statement to personal history file */
 	add_outgoing_to_history( uin, new_text );
 	rus_conv(RUS_KOI_WIN, new_text);
+    kanji_conv(&new_text, KANJI_EUC, KANJI_SJIS);
 
 	if( !forced && !toggles->force && TCPSendMessage( uin, new_text) )
 	{
@@ -460,6 +461,9 @@
 	rus_conv(RUS_KOI_WIN, nick);
 	rus_conv(RUS_KOI_WIN, first);
 	rus_conv(RUS_KOI_WIN, last);
+    kanji_conv(&nick, KANJI_EUC, KANJI_SJIS);
+    kanji_conv(&first, KANJI_EUC, KANJI_SJIS);
+    kanji_conv(&last, KANJI_EUC, KANJI_SJIS);
 
 	Word_2_Chars( pak.head.ver, ICQ_VER );
 	Word_2_Chars( pak.head.cmd, CMD_SEARCH_USER );
@@ -517,6 +521,7 @@
 	g_print( "reg_new_user\n" );
 #endif
 	rus_conv(RUS_KOI_WIN, pass); /* Bad, but need */
+    kanji_conv(&pass, KANJI_EUC, KANJI_SJIS); /* Bad, but need? */
 
 	len = strlen( pass );
 	Word_2_Chars( pak.head.ver, ICQ_VER );


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]