# HG changeset patch # User Elliott Sales de Andrade # Date 1228891796 0 # Node ID 98afd76647bd6fbaddce97195572832e62e709da # Parent 2b68476468175ff5a0656f0b718bcb06231b8a51 Updates for federated/Yahoo buddies: First, set Member type to EmailMember instead of PassportMember for federated buddies when working with the AL/BL Membership lists. Second, add the MSN.IM.BuddyType annotation to the those same operations for federated buddies. Finally, always update the AL/FL when receiving a federated buddy from the AB, since the previous changes should fix these updates. References #3322. References #6755. diff -r 2b6847646817 -r 98afd76647bd libpurple/protocols/msn/contact.c --- a/libpurple/protocols/msn/contact.c Mon Dec 08 00:47:55 2008 +0000 +++ b/libpurple/protocols/msn/contact.c Wed Dec 10 06:49:56 2008 +0000 @@ -982,13 +982,8 @@ purple_debug_info("msn", "Contact added successfully\n"); - /* the code this block is replacing didn't send ADL for yahoo contacts, - * but i haven't confirmed this is WLM's behaviour wrt yahoo contacts - */ - if ( !msn_user_is_yahoo(session->account, state->who) ) { - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL); - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL); - } + msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL); + msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL); user = msn_userlist_find_add_user(userlist, state->who, state->who); msn_user_add_group_id(user, state->guid); @@ -1112,10 +1107,8 @@ g_free(uid); } - if ( !msn_user_is_yahoo(state->session->account, state->who) ) { - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL); - msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL); - } + msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_AL); + msn_userlist_add_buddy_to_list(userlist, state->who, MSN_LIST_FL); if (msn_userlist_user_is_in_list(user, MSN_LIST_PL)) { msn_del_contact_from_list(state->session, NULL, state->who, MSN_LIST_PL); @@ -1466,10 +1459,13 @@ const gchar *passport, const MsnListId list) { gchar *body = NULL, *member = NULL; + const char *type = "PassportMember"; + gchar *federate = NULL; MsnSoapPartnerScenario partner_scenario; MsnUser *user; g_return_if_fail(session != NULL); + g_return_if_fail(session->userlist != NULL); g_return_if_fail(passport != NULL); g_return_if_fail(list < 5); @@ -1481,18 +1477,24 @@ msn_callback_state_set_list_id(state, list); msn_callback_state_set_who(state, passport); + user = msn_userlist_find_user(session->userlist, passport); + if (user && user->networkid != MSN_NETWORK_PASSPORT) { + type = "EmailMember"; + federate = g_strdup_printf(MSN_MEMBER_FEDERATED_ANNOTATION_XML, + user->networkid); + } + if (list == MSN_LIST_PL) { - g_return_if_fail(session->userlist != NULL); - - user = msn_userlist_find_user(session->userlist, passport); - partner_scenario = MSN_PS_CONTACT_API; - member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, user->membership_id[MSN_LIST_PL]); + member = g_strdup_printf(MSN_MEMBER_MEMBERSHIPID_XML, + type, user->membership_id[MSN_LIST_PL], + federate ? federate : ""); } else { /* list == MSN_LIST_AL || list == MSN_LIST_BL */ partner_scenario = MSN_PS_BLOCK_UNBLOCK; - - member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, passport); + member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, + type, passport, + federate ? federate : ""); } body = g_strdup_printf(MSN_CONTACT_DELETE_FROM_LIST_TEMPLATE, @@ -1505,6 +1507,7 @@ state->cb = msn_del_contact_from_list_read_cb; msn_contact_request(state); + g_free(federate); g_free(member); g_free(body); } @@ -1552,7 +1555,10 @@ const gchar *passport, const MsnListId list) { gchar *body = NULL, *member = NULL; + const char *type = "PassportMember"; + gchar *federate = NULL; MsnSoapPartnerScenario partner_scenario; + MsnUser *user; g_return_if_fail(session != NULL); g_return_if_fail(passport != NULL); @@ -1566,9 +1572,16 @@ msn_callback_state_set_list_id(state, list); msn_callback_state_set_who(state, passport); - partner_scenario = (list == MSN_LIST_RL) ? MSN_PS_CONTACT_API : MSN_PS_BLOCK_UNBLOCK; + user = msn_userlist_find_user(session->userlist, passport); + if (user && user->networkid != MSN_NETWORK_PASSPORT) { + type = "EmailMember"; + federate = g_strdup_printf(MSN_MEMBER_FEDERATED_ANNOTATION_XML, + user->networkid); + } - member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, state->who); + partner_scenario = (list == MSN_LIST_RL) ? MSN_PS_CONTACT_API : MSN_PS_BLOCK_UNBLOCK; + member = g_strdup_printf(MSN_MEMBER_PASSPORT_XML, + type, state->who, federate ? federate : ""); body = g_strdup_printf(MSN_CONTACT_ADD_TO_LIST_TEMPLATE, MsnSoapPartnerScenarioText[partner_scenario], @@ -1580,6 +1593,7 @@ state->cb = msn_add_contact_to_list_read_cb; msn_contact_request(state); + g_free(federate); g_free(member); g_free(body); } diff -r 2b6847646817 -r 98afd76647bd libpurple/protocols/msn/contact.h --- a/libpurple/protocols/msn/contact.h Mon Dec 08 00:47:55 2008 +0000 +++ b/libpurple/protocols/msn/contact.h Wed Dec 10 06:49:56 2008 +0000 @@ -396,19 +396,29 @@ #define MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember" #define MSN_MEMBER_PASSPORT_XML \ - ""\ + ""\ "Passport"\ "Accepted"\ "%s"\ + "%s"\ "" #define MSN_MEMBER_MEMBERSHIPID_XML \ - ""\ + ""\ "Passport"\ "%u"\ "Accepted"\ + "%s"\ "" +#define MSN_MEMBER_FEDERATED_ANNOTATION_XML \ + ""\ + ""\ + "MSN.IM.BuddyType"\ + "%02d:"\ + ""\ + "" + /* first delete contact from allow list */ #define MSN_CONTACT_DELETE_FROM_LIST_TEMPLATE ""\