# HG changeset patch # User Elliott Sales de Andrade # Date 1228697275 0 # Node ID 2b68476468175ff5a0656f0b718bcb06231b8a51 # Parent 77873bca18bb582a9944debc69b756959e9c4f4e Use ContactEmail to add federated buddies to the AddressBook. Those on Yahoo get Messenger2 type, and the others get Messenger3. I don't know the difference between them, but I'm going by empirical evidence (from many debug logs). I also don't know what the Capability field is, but I set it to 0 for now. This works in my limited testing with one Yahoo buddy. References #6755. diff -r 77873bca18bb -r 2b6847646817 libpurple/protocols/msn/contact.c --- a/libpurple/protocols/msn/contact.c Mon Dec 08 00:18:45 2008 +0000 +++ b/libpurple/protocols/msn/contact.c Mon Dec 08 00:47:55 2008 +0000 @@ -1007,6 +1007,7 @@ void msn_add_contact(MsnSession *session, MsnCallbackState *state, const char *passport) { + MsnUser *user; gchar *body = NULL; gchar *contact_xml = NULL; @@ -1024,7 +1025,21 @@ purple_debug_info("msn", "Adding contact %s to contact list\n", passport); - contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport); + user = msn_userlist_find_user(session->userlist, passport); + if (user == NULL) { + purple_debug_warning("msn", "Unable to retrieve user %s from the userlist!\n", passport); + return; /* guess this never happened! */ + } + + if (user->networkid != MSN_NETWORK_PASSPORT) { + contact_xml = g_strdup_printf(MSN_CONTACT_EMAIL_XML, + user->networkid == MSN_NETWORK_YAHOO ? + "Messenger2" : + "Messenger3", + passport, 0); + } else { + contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport); + } body = g_strdup_printf(MSN_ADD_CONTACT_TEMPLATE, contact_xml); state->body = xmlnode_from_str(body, -1); @@ -1155,8 +1170,14 @@ return; /* guess this never happened! */ } - if (user != NULL && user->uid != NULL) { + if (user->uid != NULL) { contact_xml = g_strdup_printf(MSN_CONTACT_ID_XML, user->uid); + } else if (user->networkid != MSN_NETWORK_PASSPORT) { + contact_xml = g_strdup_printf(MSN_CONTACT_EMAIL_XML, + user->networkid == MSN_NETWORK_YAHOO ? + "Messenger2" : + "Messenger3", + passport, 0); } else { contact_xml = g_strdup_printf(MSN_CONTACT_XML, passport); } diff -r 77873bca18bb -r 2b6847646817 libpurple/protocols/msn/contact.h --- a/libpurple/protocols/msn/contact.h Mon Dec 08 00:18:45 2008 +0000 +++ b/libpurple/protocols/msn/contact.h Mon Dec 08 00:47:55 2008 +0000 @@ -211,6 +211,27 @@ ""\ "" +#define MSN_CONTACT_ID_XML \ + ""\ + "%s"\ + "" + +#define MSN_CONTACT_EMAIL_XML \ + ""\ + ""\ + ""\ + ""\ + "%s"\ + "%s"\ + "true"\ + "%d"\ + "false"\ + ""\ + ""\ + ""\ + ""\ + "" + #define MSN_ADD_CONTACT_TEMPLATE ""\ "%s" #define MSN_DEL_CONTACT_TEMPLATE ""\ "