comparison libpurple/protocols/yahoo/libymsg.c @ 27401:430eb9e9042a

Correctly determine if the prpl calling a given function is the Yahoo! JAPAN prpl or not. Both Yahoo! prpl's now appear to me to work. Further testing and a migration path is still required.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Mon, 06 Jul 2009 00:16:00 +0000
parents 31534ae3406a
children 09772222714a
comparison
equal deleted inserted replaced
27400:31534ae3406a 27401:430eb9e9042a
62 #define KEEPALIVE_TIMEOUT 60 62 #define KEEPALIVE_TIMEOUT 60
63 63
64 #ifdef TRY_WEBMESSENGER_LOGIN 64 #ifdef TRY_WEBMESSENGER_LOGIN
65 static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); 65 static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message);
66 #endif /* TRY_WEBMESSENGER_LOGIN */ 66 #endif /* TRY_WEBMESSENGER_LOGIN */
67
68 static gboolean yahoo_is_japan(PurpleAccount *account)
69 {
70 return purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoojp");
71 }
67 72
68 static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f) 73 static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f)
69 { 74 {
70 char *status = NULL; 75 char *status = NULL;
71 76
1829 g_free(auth_data); 1834 g_free(auth_data);
1830 } 1835 }
1831 else { 1836 else {
1832 /* OK to login, correct information provided */ 1837 /* OK to login, correct information provided */
1833 PurpleUtilFetchUrlData *url_data = NULL; 1838 PurpleUtilFetchUrlData *url_data = NULL;
1839 PurpleAccount *account = purple_connection_get_account(gc);
1834 char *url = NULL; 1840 char *url = NULL;
1835 gboolean yahoojp = purple_account_get_bool(purple_connection_get_account(gc), 1841 gboolean yahoojp = yahoo_is_japan(account);
1836 "yahoojp", 0);
1837 1842
1838 url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token); 1843 url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token);
1839 url_data = purple_util_fetch_url_request_len_with_account( 1844 url_data = purple_util_fetch_url_request_len_with_account(account, url,
1840 purple_connection_get_account(gc), url, TRUE, 1845 TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1,
1841 YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1,
1842 yahoo_auth16_stage2, auth_data); 1846 yahoo_auth16_stage2, auth_data);
1843 g_free(url); 1847 g_free(url);
1844 g_free(token); 1848 g_free(token);
1845 } 1849 }
1846 } 1850 }
1860 if(!purple_ssl_is_supported()) { 1864 if(!purple_ssl_is_supported()) {
1861 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); 1865 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable"));
1862 return; 1866 return;
1863 } 1867 }
1864 1868
1865 yahoojp = purple_account_get_bool(purple_connection_get_account(gc), 1869 yahoojp = yahoo_is_japan(purple_connection_get_account(gc));
1866 "yahoojp", 0);
1867 auth_data = g_new0(struct yahoo_auth_data, 1); 1870 auth_data = g_new0(struct yahoo_auth_data, 1);
1868 auth_data->gc = gc; 1871 auth_data->gc = gc;
1869 auth_data->seed = g_strdup(seed); 1872 auth_data->seed = g_strdup(seed);
1870 1873
1871 encoded_username = g_strdup(purple_url_encode(purple_account_get_username(purple_connection_get_account(gc)))); 1874 encoded_username = g_strdup(purple_url_encode(purple_account_get_username(purple_connection_get_account(gc))));
3424 yd->current_status = get_yahoo_status_from_purple_status(status); 3427 yd->current_status = get_yahoo_status_from_purple_status(status);
3425 3428
3426 yahoo_server_check(account); 3429 yahoo_server_check(account);
3427 yahoo_picture_check(account); 3430 yahoo_picture_check(account);
3428 3431
3429 if (purple_strequal(purple_account_get_protocol_id(account), "yahoojp")) { 3432 if (yahoo_is_japan(account)) {
3430 yd->jp = TRUE; 3433 yd->jp = TRUE;
3431 if (purple_proxy_connect(gc, account, 3434 if (purple_proxy_connect(gc, account,
3432 purple_account_get_string(account, "server", YAHOOJP_PAGER_HOST), 3435 purple_account_get_string(account, "server", YAHOOJP_PAGER_HOST),
3433 purple_account_get_int(account, "port", YAHOO_PAGER_PORT), 3436 purple_account_get_int(account, "port", YAHOO_PAGER_PORT),
3434 yahoo_got_connected, gc) == NULL) 3437 yahoo_got_connected, gc) == NULL)