Mercurial > pidgin.yaz
changeset 24840:1732b4c6379b
2008.12.28 - flos <lonicerae(at)gmail.com>
* References #7908
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Sat, 27 Dec 2008 17:51:45 +0000 |
parents | b74fa0d31c74 |
children | 3a2b95c12396 |
files | libpurple/protocols/qq/ChangeLog libpurple/protocols/qq/qq_network.c |
diffstat | 2 files changed, 24 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/qq/ChangeLog Fri Dec 26 13:00:57 2008 +0000 +++ b/libpurple/protocols/qq/ChangeLog Sat Dec 27 17:51:45 2008 +0000 @@ -1,3 +1,6 @@ +2008.12.28 - flos <lonicerae(at)gmail.com> + * References #7908 + 2008.12.25 - flos <lonicerae(at)gmail.com> * References #7821 * Updated authors
--- a/libpurple/protocols/qq/qq_network.c Fri Dec 26 13:00:57 2008 +0000 +++ b/libpurple/protocols/qq/qq_network.c Sat Dec 27 17:51:45 2008 +0000 @@ -174,14 +174,16 @@ * Please conside tcp_pending and udp_pending */ gboolean qq_connect_later(gpointer data) { - PurpleConnection *gc = (PurpleConnection *) data; - qq_data *qd; - char *server; + PurpleConnection *gc; + char *tmp_server; int port; gchar **segments; + qq_data *qd; + gc = (PurpleConnection *) data; g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE); qd = (qq_data *) gc->proto_data; + tmp_server = NULL; if (qd->check_watcher > 0) { purple_timeout_remove(qd->check_watcher); @@ -191,9 +193,11 @@ if (qd->redirect_ip.s_addr != 0) { /* redirect to new server */ - server = g_strdup_printf("%s:%d", inet_ntoa(qd->redirect_ip), qd->redirect_port); - qd->servers = g_list_append(qd->servers, server); - qd->curr_server = server; + tmp_server = g_strdup_printf("%s:%d", inet_ntoa(qd->redirect_ip), qd->redirect_port); + qd->servers = g_list_append(qd->servers, tmp_server); + + qd->curr_server = tmp_server; + tmp_server = NULL; qd->redirect_ip.s_addr = 0; qd->redirect_port = 0; @@ -211,21 +215,26 @@ } segments = g_strsplit_set(qd->curr_server, ":", 0); - server = g_strdup(segments[0]); - port = atoi(segments[1]); - if (port <= 0) { - purple_debug_info("QQ", "Port not define in %s\n", qd->curr_server); - port = QQ_DEFAULT_PORT; + tmp_server = g_strdup(segments[0]); + if (NULL != segments[1]) { + port = atoi(segments[1]); + if (port <= 0) { + purple_debug_info("QQ", "Port not define in %s\n", qd->curr_server); + port = QQ_DEFAULT_PORT; + } } g_strfreev(segments); qd->connect_retry--; - if ( !connect_to_server(gc, server, port) ) { + if ( !connect_to_server(gc, tmp_server, port) ) { purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to connect.")); } + g_free(tmp_server); + tmp_server = NULL; + qd->check_watcher = purple_timeout_add_seconds(QQ_CONNECT_CHECK, connect_check, gc); return FALSE; /* timeout callback stops */ }