Mercurial > pidgin
changeset 9164:76125b842b23
[gaim-migrate @ 9949]
This is proper yahoo japan support. Technically it worked before, but
you had to know the yahoo japan server, and typing in nonascii didn't work.
The account options are kind of ugly. Eventually Chip is going to replace
the check box with something more like a dropdown thingy, that automaticly
hides the settings that aren't used (Pager Host vs. Japan Pager Host, etc)
But it's not too bad now. And I think I orignally wrote this patch for
0.64 or something, so I got tired of waiting.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Wed, 02 Jun 2004 03:02:50 +0000 |
parents | 8d22bc97b7be |
children | 43ea2b858112 |
files | ChangeLog src/protocols/yahoo/util.c src/protocols/yahoo/yahoo.c src/protocols/yahoo/yahoo.h src/protocols/yahoo/yahoo_filexfer.c src/protocols/yahoo/yahoo_profile.c |
diffstat | 6 files changed, 72 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jun 02 01:26:21 2004 +0000 +++ b/ChangeLog Wed Jun 02 03:02:50 2004 +0000 @@ -4,6 +4,8 @@ New Features: * Display name changes are now shown in the conversation windows. (Robert Mibus) + * Yahoo! Japan support. Click More Options and check Yahoo Japan + in the account editor, to use your Yahoo! Japan account. Bug Fixes: * Non-looping animated icons no longer cause Gaim to freeze
--- a/src/protocols/yahoo/util.c Wed Jun 02 01:26:21 2004 +0000 +++ b/src/protocols/yahoo/util.c Wed Jun 02 03:02:50 2004 +0000 @@ -44,13 +44,20 @@ */ char *yahoo_string_encode(GaimConnection *gc, const char *str, gboolean *utf8) { + struct yahoo_data *yd = gc->proto_data; char *ret; char *to_codeset; + if (yd->jp && utf8 && *utf8) + *utf8 = FALSE; + if (utf8 && *utf8) /* FIXME: maybe don't use utf8 if it'll fit in latin1 */ return g_strdup(str); - to_codeset = "ISO-8859-1"; + if (yd->jp) + to_codeset = "SHIFT_JIS"; + else + to_codeset = "ISO-8859-1"; ret = g_convert_with_fallback(str, strlen(str), to_codeset, "UTF-8", "?", NULL, NULL, NULL); if (ret) @@ -69,6 +76,7 @@ */ char *yahoo_string_decode(GaimConnection *gc, const char *str, gboolean utf8) { + struct yahoo_data *yd = gc->proto_data; char *ret; char *from_codeset; @@ -77,7 +85,10 @@ return g_strdup(str); } - from_codeset = "ISO-8859-1"; + if (yd->jp) + from_codeset = "SHIFT_JIS"; + else + from_codeset = "ISO-8859-1"; ret = g_convert_with_fallback(str, strlen(str), "UTF-8", from_codeset, NULL, NULL, NULL, NULL);
--- a/src/protocols/yahoo/yahoo.c Wed Jun 02 01:26:21 2004 +0000 +++ b/src/protocols/yahoo/yahoo.c Wed Jun 02 03:02:50 2004 +0000 @@ -2256,15 +2256,27 @@ yahoo_server_check(account); - if (gaim_proxy_connect(account, - gaim_account_get_string(account, "server", YAHOO_PAGER_HOST), - gaim_account_get_int(account, "port", YAHOO_PAGER_PORT), - yahoo_got_connected, gc) != 0) - { - gaim_connection_error(gc, _("Connection problem")); - return; + if (gaim_account_get_bool(account, "yahoojp", FALSE)) { + yd->jp = TRUE; + if (gaim_proxy_connect(account, + gaim_account_get_string(account, "serverjp", YAHOOJP_PAGER_HOST), + gaim_account_get_int(account, "port", YAHOO_PAGER_PORT), + yahoo_got_connected, gc) != 0) + { + gaim_connection_error(gc, _("Connection problem")); + return; + } + } else { + yd->jp = FALSE; + if (gaim_proxy_connect(account, + gaim_account_get_string(account, "server", YAHOO_PAGER_HOST), + gaim_account_get_int(account, "port", YAHOO_PAGER_PORT), + yahoo_got_connected, gc) != 0) + { + gaim_connection_error(gc, _("Connection problem")); + return; + } } - #else gaim_url_fetch(WEBMESSENGER_URL, TRUE, "Gaim/" VERSION, FALSE, yahoo_login_page_cb, gc); @@ -3185,15 +3197,24 @@ { GaimAccountOption *option; + option = gaim_account_option_bool_new(_("Yahoo Japan"), "yahoojp", FALSE); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + option = gaim_account_option_string_new(_("Pager host"), "server", YAHOO_PAGER_HOST); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + option = gaim_account_option_string_new(_("Japan Pager host"), "serverjp", YAHOOJP_PAGER_HOST); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + option = gaim_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); option = gaim_account_option_string_new(_("File transfer host"), "xfer_host", YAHOO_XFER_HOST); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + option = gaim_account_option_string_new(_("Japan File transfer host"), "xferjp_host", YAHOOJP_XFER_HOST); + prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); + option = gaim_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
--- a/src/protocols/yahoo/yahoo.h Wed Jun 02 01:26:21 2004 +0000 +++ b/src/protocols/yahoo/yahoo.h Wed Jun 02 03:02:50 2004 +0000 @@ -34,6 +34,13 @@ #define YAHOO_XFER_PORT 80 #define YAHOO_ROOMLIST_URL "http://insider.msg.yahoo.com/ycontent/" +/* really we should get the list of servers from + http://update.messenger.yahoo.co.jp/servers.html */ +#define YAHOOJP_PAGER_HOST "cs.yahoo.co.jp" +#define YAHOOJP_XFER_HOST "filetransfer.msg.yahoo.co.jp" +#define YAHOOJP_WEBCAM_HOST "wc.yahoo.co.jp" +#define YAHOOJP_PROFILE_URL "profiles.yahoo.co.jp" + #define WEBMESSENGER_URL "http://login.yahoo.com/config/login?.src=pg" enum yahoo_service { /* these are easier to see in hex */ @@ -136,6 +143,7 @@ char *cookie_y; char *cookie_t; int session_id; + gboolean jp; }; struct yahoo_pair {
--- a/src/protocols/yahoo/yahoo_filexfer.c Wed Jun 02 01:26:21 2004 +0000 +++ b/src/protocols/yahoo/yahoo_filexfer.c Wed Jun 02 03:02:50 2004 +0000 @@ -201,13 +201,24 @@ "One Megabyte (1,048,576 bytes).")); gaim_xfer_cancel_local(xfer); } else { - if (gaim_proxy_connect(account, gaim_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), - gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), - yahoo_sendfile_connected, xfer) == -1) - { - gaim_notify_error(gc, NULL, _("File Transfer Aborted"), - _("Unable to establish file descriptor.")); - gaim_xfer_cancel_remote(xfer); + if (yd->jp) { + if (gaim_proxy_connect(account, gaim_account_get_string(account, "xferjp_host", YAHOOJP_XFER_HOST), + gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), + yahoo_sendfile_connected, xfer) == -1) + { + gaim_notify_error(gc, NULL, _("File Transfer Aborted"), + _("Unable to establish file descriptor.")); + gaim_xfer_cancel_remote(xfer); + } + } else { + if (gaim_proxy_connect(account, gaim_account_get_string(account, "xfer_host", YAHOO_XFER_HOST), + gaim_account_get_int(account, "xfer_port", YAHOO_XFER_PORT), + yahoo_sendfile_connected, xfer) == -1) + { + gaim_notify_error(gc, NULL, _("File Transfer Aborted"), + _("Unable to establish file descriptor.")); + gaim_xfer_cancel_remote(xfer); + } } } } else {
--- a/src/protocols/yahoo/yahoo_profile.c Wed Jun 02 01:26:21 2004 +0000 +++ b/src/protocols/yahoo/yahoo_profile.c Wed Jun 02 03:02:50 2004 +0000 @@ -900,6 +900,7 @@ void yahoo_get_info(GaimConnection *gc, const char *name) { + struct yahoo_data *yd = gc->proto_data; YahooGetInfoData *data; char *url; @@ -907,7 +908,7 @@ data->gc = gc; data->name = g_strdup(name); - if (strstr(gaim_account_get_string(gaim_connection_get_account(gc), "server", YAHOO_PAGER_HOST), "yahoo.co.jp")) { + if (yd->jp) { url = g_strdup_printf("%s%s", "http://profiles.yahoo.co.jp/", name); } else { url = g_strdup_printf("%s%s", YAHOO_PROFILE_URL, name);