pidgin: e581b236: If the MSN user is in the userlist alre...

qulogic at pidgin.im qulogic at pidgin.im
Sun Dec 14 03:45:43 EST 2008


-----------------------------------------------------------------
Revision: e581b2365bfe005ee726a719e504103011bf01c7
Ancestor: 71b118a44b1df8c16e9123168fa8bd40c73a434e
Author: qulogic at pidgin.im
Date: 2008-12-14T05:24:32
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e581b2365bfe005ee726a719e504103011bf01c7

Modified files:
        libpurple/protocols/msn/msn.c
        libpurple/protocols/msn/userlist.c

ChangeLog: 

If the  MSN user is in the userlist already, then check whether we know the
network before adding them. If it's unknown (because the buddy's in the AB
or privacy lists only), then request network with an FQY.

References #3322.
References #6755.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/msn.c	2bad808fd25f0b6f9374d6ae8adc9cf843fbd8c9
+++ libpurple/protocols/msn/msn.c	7c36df4d86117f0a4ea199f2b25f2f1a40f2dfd2
@@ -1418,6 +1418,7 @@ msn_add_buddy(PurpleConnection *gc, Purp
 	MsnSession *session;
 	MsnUserList *userlist;
 	const char *who;
+	MsnUser *user;
 
 	session = gc->proto_data;
 	userlist = session->userlist;
@@ -1446,9 +1447,10 @@ msn_add_buddy(PurpleConnection *gc, Purp
 	/* XXX - Would group ever be NULL here?  I don't think so...
 	 * shx: Yes it should; MSN handles non-grouped buddies, and this is only
 	 * internal. */
-	if (msn_userlist_find_user(userlist, who) != NULL) {
-		/* We already know this buddy. This function takes care of users
-		   already in the list and stuff... */
+	user = msn_userlist_find_user(userlist, who);
+	if ((user != NULL) && (user->networkid != MSN_NETWORK_UNKNOWN)) {
+		/* We already know this buddy and their network. This function knows
+		   what to do with users already in the list and stuff... */
 		msn_userlist_add_buddy(userlist, who, group ? group->name : NULL);
 	} else {
 		/* We need to check the network for this buddy first */
============================================================
--- libpurple/protocols/msn/userlist.c	ac7810b2d4a83b0d9cb803b08a54c7314fc74c2b
+++ libpurple/protocols/msn/userlist.c	74a0c3e9dec6492843df037df61e185fc4038736
@@ -775,6 +775,7 @@ msn_userlist_add_pending_buddy(MsnUserLi
                                /*MsnNetwork*/ int network)
 {
 	MsnUser *user = NULL;
+	MsnUser *user2;
 	GList *l;
 	char *group;
 
@@ -793,13 +794,18 @@ msn_userlist_add_pending_buddy(MsnUserLi
 		return;
 	}
 
-	/* Bit of a hack, but by adding to userlist now, the rest of the code
-	 * will know what network to use.
-	 */
-	msn_user_set_network(user, network);
-	msn_userlist_add_user(userlist, user);
+	group = msn_user_remove_pending_group(user);
 
-	group = msn_user_remove_pending_group(user);
+	user2 = msn_userlist_find_user(userlist, who);
+	if (user2 != NULL) {
+		/* User already in userlist, so just update it. */
+		msn_user_destroy(user);
+		user = user2;
+	} else {
+		msn_userlist_add_user(userlist, user);
+	}
+
+	msn_user_set_network(user, network);
 	msn_userlist_add_buddy(userlist, who, group);
 	g_free(group);
 }


More information about the Commits mailing list