pidgin: ec03cf27: GG: Move the "inpa" input watcher into p...

andrew.victor at mxit.com andrew.victor at mxit.com
Tue Oct 18 17:57:08 EDT 2011


----------------------------------------------------------------------
Revision: ec03cf27e2c134919ef7cd1adf951dd0afcec4b0
Parent:   db45046d172043350f30bcf66e23ff73d7061be5
Author:   andrew.victor at mxit.com
Date:     10/18/11 17:27:51
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ec03cf27e2c134919ef7cd1adf951dd0afcec4b0

Changelog: 

GG: Move the "inpa" input watcher into protocol_data.


Changes against parent db45046d172043350f30bcf66e23ff73d7061be5

  patched  libpurple/protocols/gg/gg.c
  patched  libpurple/protocols/gg/gg.h

-------------- next part --------------
============================================================
--- libpurple/protocols/gg/gg.c	4c91992273ee00eb14b99150b09ad43ac09efbb2
+++ libpurple/protocols/gg/gg.c	a7291521e92254509be5b68a50d91f831c4c27d2
@@ -1974,11 +1974,12 @@ static void ggp_async_login_handler(gpoi
 	purple_debug_info("gg", "login_handler: session: check = %d; state = %d;\n",
 			info->session->check, info->session->state);
 
-	purple_input_remove(gc->inpa);
+	purple_input_remove(info->inpa);
+	info->inpa = 0;
 
 	/** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */
 	if (info->session->fd >= 0)
-		gc->inpa = purple_input_add(info->session->fd,
+		info->inpa = purple_input_add(info->session->fd,
 			(info->session->check == 1) ? PURPLE_INPUT_WRITE :
 				PURPLE_INPUT_READ,
 			ggp_async_login_handler, gc);
@@ -1991,8 +1992,8 @@ static void ggp_async_login_handler(gpoi
 		case GG_EVENT_CONN_SUCCESS:
 			{
 				purple_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n");
-				purple_input_remove(gc->inpa);
-				gc->inpa = purple_input_add(info->session->fd,
+				purple_input_remove(info->inpa);
+				info->inpa = purple_input_add(info->session->fd,
 							  PURPLE_INPUT_READ,
 							  ggp_callback_recv, gc);
 
@@ -2002,8 +2003,8 @@ static void ggp_async_login_handler(gpoi
 			}
 			break;
 		case GG_EVENT_CONN_FAILED:
-			purple_input_remove(gc->inpa);
-			gc->inpa = 0;
+			purple_input_remove(info->inpa);
+			info->inpa = 0;
 			purple_debug_info("gg", "Connection failure: %d\n",
 				ev->event.failure);
 			switch (ev->event.failure) {
@@ -2365,7 +2366,7 @@ static void ggp_login(PurpleAccount *acc
 		g_free(glp);
 		return;
 	}
-	gc->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ,
+	info->inpa = purple_input_add(info->session->fd, PURPLE_INPUT_READ,
 				  ggp_async_login_handler, gc);
 }
 
@@ -2401,13 +2402,14 @@ static void ggp_close(PurpleConnection *
 		ggp_search_destroy(info->searches);
 		g_list_free(info->pending_richtext_messages);
 		g_hash_table_destroy(info->pending_images);
-		g_free(info);
+
+		if (info->inpa > 0)
+			purple_input_remove(info->inpa);
+
 		purple_connection_set_protocol_data(gc, NULL);
+		g_free(info);
 	}
 
-	if (gc->inpa > 0)
-		purple_input_remove(gc->inpa);
-
 	purple_debug_info("gg", "Connection closed.\n");
 }
 
============================================================
--- libpurple/protocols/gg/gg.h	7cc20972ffe3d5a54b6288f14dcf21c6f097a147
+++ libpurple/protocols/gg/gg.h	4ddeccbabe2125cb49d2c18fe0495056f64d7031
@@ -59,6 +59,7 @@ typedef struct {
 typedef struct {
 
 	struct gg_session *session;
+	guint inpa;
 	GGPToken *token;
 	GList *chats;
 	GGPSearches *searches;


More information about the Commits mailing list