# HG changeset patch # User Elliott Sales de Andrade # Date 1229232272 0 # Node ID f3950234b164b6fbf8ff76ab81c4637eba18470b # Parent daabf16bd511043a0450c32ac367cac9f91c2c3c 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. diff -r daabf16bd511 -r f3950234b164 libpurple/protocols/msn/msn.c --- a/libpurple/protocols/msn/msn.c Sun Dec 14 05:22:52 2008 +0000 +++ b/libpurple/protocols/msn/msn.c Sun Dec 14 05:24:32 2008 +0000 @@ -1418,6 +1418,7 @@ MsnSession *session; MsnUserList *userlist; const char *who; + MsnUser *user; session = gc->proto_data; userlist = session->userlist; @@ -1446,9 +1447,10 @@ /* 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 */ diff -r daabf16bd511 -r f3950234b164 libpurple/protocols/msn/userlist.c --- a/libpurple/protocols/msn/userlist.c Sun Dec 14 05:22:52 2008 +0000 +++ b/libpurple/protocols/msn/userlist.c Sun Dec 14 05:24:32 2008 +0000 @@ -775,6 +775,7 @@ /*MsnNetwork*/ int network) { MsnUser *user = NULL; + MsnUser *user2; GList *l; char *group; @@ -793,13 +794,18 @@ return; } - /* Bit of a hack, but by adding to userlist now, the rest of the code - * will know what network to use. - */ + 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_user(userlist, user); - - group = msn_user_remove_pending_group(user); msn_userlist_add_buddy(userlist, who, group); g_free(group); }