pidgin.openq: 39dd86c3: 2008.12.28 - flos <lonicerae(at)gmail.co...

csyfek at gmail.com csyfek at gmail.com
Sat Dec 27 12:55:59 EST 2008


-----------------------------------------------------------------
Revision: 39dd86c333693d6ff65448e4dd442eab1dfe09a8
Ancestor: 5043805100d2fa5a371317e802d6a191c89ddaeb
Author: csyfek at gmail.com
Date: 2008-12-27T17:51:45
Branch: im.pidgin.pidgin.openq
URL: http://d.pidgin.im/viewmtn/revision/info/39dd86c333693d6ff65448e4dd442eab1dfe09a8

Modified files:
        libpurple/protocols/qq/ChangeLog
        libpurple/protocols/qq/qq_network.c

ChangeLog: 

2008.12.28 - flos <lonicerae(at)gmail.com>
	* References #7908

-------------- next part --------------
============================================================
--- libpurple/protocols/qq/ChangeLog	3dc460c9b93da32aeb0382388599876b2c5572a8
+++ libpurple/protocols/qq/ChangeLog	b4df2c0dfb6e95cd95fcd6f7b2819495f33053f9
@@ -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
============================================================
--- libpurple/protocols/qq/qq_network.c	8257f51bfa1d6db8e0878b23bd9f25122b2e9c32
+++ libpurple/protocols/qq/qq_network.c	aa75511cf024d1fe216dfee1f6fc87bf7dc0ee35
@@ -174,14 +174,16 @@ gboolean qq_connect_later(gpointer data)
  *  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,10 +193,12 @@ gboolean qq_connect_later(gpointer data)
 
 	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;
 		qd->connect_retry = QQ_CONNECT_MAX;
@@ -211,21 +215,26 @@ gboolean qq_connect_later(gpointer data)
 	}
 
 	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 */
 }


More information about the Commits mailing list