清水です 自己フォローです。 Shimizu Hitoshi wrote: > 自分でもこれからソースを見て調べようと思っています。 > わかったら報告します。 カンファレンスのソースが日本語未対応のようですので パッチを作ってみました。 とりあえず、カンファレンスもうまく表示されるようになりました。 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff -cr gtkyahoo-0.18.3.org/window-conference.c gtkyahoo-0.18.3/window-conference.c *** gtkyahoo-0.18.3.org/window-conference.c 2001-09-03 22:30:23.000000000 +0900 --- gtkyahoo-0.18.3/window-conference.c 2003-08-31 01:10:57.000000000 +0900 *************** *** 1,4 **** --- 1,11 ---- #include "gtkyahoo.h" + #ifdef JAPANESE + # include <jconv.h> + # include <time.h> + static char *kconv(char*, char*); + static char *tagstrip(char*); + #define FREE(x) if (x) { free(x); x=NULL; } + #endif /* Maybe I should put these in a "private" header file */ static void on_chat_activate(GtkEditable * editable, gpointer user_data); *************** *** 33,38 **** --- 40,48 ---- char *coloured_user = NULL, *colour = NULL; int coloured_user_len = -1; GtkText *blah = NULL; + #ifdef JAPANESE + char *tmp_message; + #endif if (0L == ((long) conf_id | (long) sender | (long) message | (long) colour | *************** *** 66,72 **** --- 76,88 ---- coloured_user = NULL; coloured_user_len = -1; + #ifdef JAPANESE + tmp_message = kconv("EUCJP", (char *) message); + append_to_textbox(GTK_WIDGET(window), GTK_WIDGET(blah), tmp_message); + FREE(tmp_message); + #else append_to_textbox(GTK_WIDGET(window), GTK_WIDGET(blah), message); + #endif append_to_textbox(GTK_WIDGET(window), GTK_WIDGET(blah), "\n"); gdk_window_raise(GTK_WIDGET(window)->window); *************** *** 385,387 **** --- 401,431 ---- return conf; } + #ifdef JAPANESE + static char *kconv(char *dstset, char *msg) + { + char *tmp_msg = tagstrip(msg); + char *conv_msg = convert_kanji(tmp_msg, dstset); + FREE(tmp_msg); + return conv_msg; + } + + static char *tagstrip(char *msg) + { + char *p, *q; + q = strdup(msg); + memset(q, 0, strlen(msg)); + for (p = msg; *p != 0; p++) { + if ( strncmp(p, "<font ", 6) == 0 ) { + while ( *(++p) != '>' && *p != 0 ) {} + } else if ( strncmp(p, "\033[", 2) == 0 ) { + while ( *(++p) != 'm' && *p != 0 ) {} + } else { + strncat(q, p, 1); + } + } + strncat(q, "\0", 1); + return q; + } + #endif ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~