pidgin: e2dc0cf4: Updates for federated/Yahoo buddies:
qulogic at pidgin.im
qulogic at pidgin.im
Wed Dec 10 01:56:33 EST 2008
-----------------------------------------------------------------
Revision: e2dc0cf4e0a3f0c81eb9c91c4d2041e87d2c4c68
Ancestor: a1b27d590ef43926850de80dae575e8353524fde
Author: qulogic at pidgin.im
Date: 2008-12-10T06:49:56
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/e2dc0cf4e0a3f0c81eb9c91c4d2041e87d2c4c68
Modified files:
libpurple/protocols/msn/contact.c
libpurple/protocols/msn/contact.h
ChangeLog:
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.
-------------- next part --------------
============================================================
--- libpurple/protocols/msn/contact.c 7d77d0e5de5bc91263633aa5b35eb80a82cdbaa6
+++ libpurple/protocols/msn/contact.c 5f27f96e8b77fe81df6e8f2745569108e3c64c04
@@ -982,13 +982,8 @@ msn_add_contact_read_cb(MsnSoapMessage *
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 @@ msn_add_contact_to_group_read_cb(MsnSoap
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 @@ msn_del_contact_from_list(MsnSession *se
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_del_contact_from_list(MsnSession *se
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 @@ msn_del_contact_from_list(MsnSession *se
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 @@ msn_add_contact_to_list(MsnSession *sess
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_add_contact_to_list(MsnSession *sess
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 @@ msn_add_contact_to_list(MsnSession *sess
state->cb = msn_add_contact_to_list_read_cb;
msn_contact_request(state);
+ g_free(federate);
g_free(member);
g_free(body);
}
============================================================
--- libpurple/protocols/msn/contact.h 496abe6aeaafc86a8a1c41a740da61534388e1e5
+++ libpurple/protocols/msn/contact.h ffe1cc2b41bd53183ed8a2d47304531cbaa002e4
@@ -396,19 +396,29 @@
#define MSN_DELETE_MEMBER_FROM_LIST_SOAP_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember"
#define MSN_MEMBER_PASSPORT_XML \
- "<Member xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"PassportMember\">"\
+ "<Member xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"%s\">"\
"<Type>Passport</Type>"\
"<State>Accepted</State>"\
"<PassportName>%s</PassportName>"\
+ "%s"\
"</Member>"
#define MSN_MEMBER_MEMBERSHIPID_XML \
- "<Member xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"PassportMember\">"\
+ "<Member xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"%s\">"\
"<Type>Passport</Type>"\
"<MembershipId>%u</MembershipId>"\
"<State>Accepted</State>"\
+ "%s"\
"</Member>"
+#define MSN_MEMBER_FEDERATED_ANNOTATION_XML \
+ "<Annotations>"\
+ "<Annotation>"\
+ "<Name>MSN.IM.BuddyType</Name>"\
+ "<Value>%02d:</Value>"\
+ "</Annotation>"\
+ "</Annotations>"
+
/* first delete contact from allow list */
#define MSN_CONTACT_DELETE_FROM_LIST_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
More information about the Commits
mailing list