pidgin: d28c3393: Requests are closed with the PurpleConne...

qulogic at pidgin.im qulogic at pidgin.im
Sun Jan 9 20:37:50 EST 2011


----------------------------------------------------------------------
Revision: d28c339303d73de1ceb4dce92f98c88a41c0cec9
Parent:   b57a2fabd83745a5622fe79384727baa017f7893
Author:   qulogic at pidgin.im
Date:     01/09/11 20:06:43
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/d28c339303d73de1ceb4dce92f98c88a41c0cec9

Changelog: 

Requests are closed with the PurpleConnection, so there's no need for
these checks here. Plus it seems like MsnSession is more useful in the
callback than a PurpleConnection.

Changes against parent b57a2fabd83745a5622fe79384727baa017f7893

  patched  libpurple/protocols/msn/error.c

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/error.c	37d7b0a9a226fd77b82b86f368af0d56c5878214
+++ libpurple/protocols/msn/error.c	0aa59b69acf25ea8a8452b810cb23d2bde37252a
@@ -31,7 +31,7 @@ typedef struct
 
 typedef struct
 {
-	PurpleConnection *gc;
+	MsnSession *session;
 	char *who;
 	char *group;
 	gboolean add;
@@ -293,9 +293,9 @@ msn_complete_sync_issue(MsnAddRemData *d
 		group = purple_find_group(data->group);
 
 	if (group != NULL)
-		buddy = purple_find_buddy_in_group(purple_connection_get_account(data->gc), data->who, group);
+		buddy = purple_find_buddy_in_group(data->session->account, data->who, group);
 	else
-		buddy = purple_find_buddy(purple_connection_get_account(data->gc), data->who);
+		buddy = purple_find_buddy(data->session->account, data->who);
 
 	if (buddy != NULL)
 		purple_blist_remove_buddy(buddy);
@@ -309,15 +309,10 @@ msn_add_cb(MsnAddRemData *data)
 	/* this *should* be necessary !! */
 	msn_complete_sync_issue(data);
 #endif
+	MsnUserList *userlist = data->session->userlist;
 
-	if (g_list_find(purple_connections_get_all(), data->gc) != NULL)
-	{
-		MsnSession *session = data->gc->proto_data;
-		MsnUserList *userlist = session->userlist;
+	msn_userlist_add_buddy(userlist, data->who, data->group);
 
-		msn_userlist_add_buddy(userlist, data->who, data->group);
-	}
-
 	g_free(data->group);
 	g_free(data->who);
 	g_free(data);
@@ -326,18 +321,14 @@ msn_rem_cb(MsnAddRemData *data)
 static void
 msn_rem_cb(MsnAddRemData *data)
 {
+	MsnUserList *userlist = data->session->userlist;
 	msn_complete_sync_issue(data);
 
-	if (g_list_find(purple_connections_get_all(), data->gc) != NULL)
-	{
-		MsnSession *session = data->gc->proto_data;
-		MsnUserList *userlist = session->userlist;
 
-		if (data->group == NULL) {
-			msn_userlist_rem_buddy_from_list(userlist, data->who, MSN_LIST_FL);
-		} else {
-			g_free(data->group);
-		}
+	if (data->group == NULL) {
+		msn_userlist_rem_buddy_from_list(userlist, data->who, MSN_LIST_FL);
+	} else {
+		g_free(data->group);
 	}
 
 	g_free(data->who);
@@ -356,10 +347,10 @@ msn_error_sync_issue(MsnSession *session
 	account = session->account;
 	gc = purple_account_get_connection(account);
 
-	data        = g_new0(MsnAddRemData, 1);
-	data->who   = g_strdup(passport);
-	data->group = g_strdup(group_name);
-	data->gc    = gc;
+	data          = g_new0(MsnAddRemData, 1);
+	data->who     = g_strdup(passport);
+	data->group   = g_strdup(group_name);
+	data->session = session;
 
 	msg = g_strdup_printf(_("Buddy list synchronization issue in %s (%s)"),
 						  purple_account_get_username(account),
@@ -382,7 +373,7 @@ msn_error_sync_issue(MsnSession *session
 	}
 
 	purple_request_action(gc, NULL, msg, reason, PURPLE_DEFAULT_ACTION_NONE,
-						purple_connection_get_account(gc), data->who, NULL,
+						account, data->who, NULL,
 						data, 2,
 						_("Yes"), G_CALLBACK(msn_add_cb),
 						_("No"), G_CALLBACK(msn_rem_cb));
@@ -390,3 +381,4 @@ msn_error_sync_issue(MsnSession *session
 	g_free(reason);
 	g_free(msg);
 }
+


More information about the Commits mailing list