Mercurial > pidgin.yaz
changeset 27624:0d32c4c08deb
Simplify a block here and kill one of those uber-lines that annoy grim.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Wed, 15 Jul 2009 06:00:19 +0000 |
parents | 5c17c400153d |
children | b20d83875771 |
files | libpurple/protocols/yahoo/libymsg.c |
diffstat | 1 files changed, 17 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/libymsg.c Wed Jul 15 04:27:22 2009 +0000 +++ b/libpurple/protocols/yahoo/libymsg.c Wed Jul 15 06:00:19 2009 +0000 @@ -3408,6 +3408,9 @@ PurpleConnection *gc = purple_account_get_connection(account); struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); PurpleStatus *status = purple_account_get_active_status(account); + const char *server = NULL; + int pager_port = 0; + gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; purple_connection_update_progress(gc, _("Connecting"), 1, 2); @@ -3423,41 +3426,30 @@ yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); yd->xfer_peer_idstring_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - yd->peers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_p2p_disconnect_destroy_data); + yd->peers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, + yahoo_p2p_disconnect_destroy_data); yd->sms_carrier = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - yd->yahoo_p2p_timer = purple_timeout_add_seconds(YAHOO_P2P_KEEPALIVE_SECS, yahoo_p2p_keepalive, gc); + yd->yahoo_p2p_timer = purple_timeout_add_seconds(YAHOO_P2P_KEEPALIVE_SECS, + yahoo_p2p_keepalive, gc); yd->confs = NULL; yd->conf_id = 2; yd->last_keepalive = yd->last_ping = time(NULL); yd->current_status = get_yahoo_status_from_purple_status(status); + yd->jp = yahoo_is_japan(account); yahoo_server_check(account); yahoo_picture_check(account); - if (yahoo_is_japan(account)) { - yd->jp = TRUE; - if (purple_proxy_connect(gc, account, - purple_account_get_string(account, "server", YAHOOJP_PAGER_HOST), - purple_account_get_int(account, "port", YAHOO_PAGER_PORT), - yahoo_got_connected, gc) == NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } - } else { - yd->jp = FALSE; - if (purple_proxy_connect(gc, account, - purple_account_get_string(account, "server", YAHOO_PAGER_HOST), - purple_account_get_int(account, "port", YAHOO_PAGER_PORT), - yahoo_got_connected, gc) == NULL) - { - purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Unable to connect")); - return; - } - } + server = purple_account_get_string(account, "server", + yd->jp ? YAHOOJP_PAGER_HOST : YAHOO_PAGER_HOST); + pager_port = purple_account_get_int(account, "port", YAHOO_PAGER_PORT); + + if (purple_proxy_connect(gc, account, server, pager_port, yahoo_got_connected, gc) == NULL) + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Unable to connect")); + + return; } void yahoo_close(PurpleConnection *gc) {