Mercurial > pidgin
changeset 21112:13279824fe64
merge of '821557bd1a14108389bdbbd1eafc32a93b12b018'
and 'e63bc20929b0a0f977fecd9e62cf10f37a1a8b4d'
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Tue, 30 Oct 2007 06:45:24 +0000 |
parents | cc43e75a1da7 (current diff) c5df2bf2bf8e (diff) |
children | 0d6e582f2679 31611d5d6a4a |
files | libpurple/protocols/msn/contact.c |
diffstat | 2 files changed, 39 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c Thu Oct 25 08:33:59 2007 +0000 +++ b/libpurple/protocols/msn/contact.c Tue Oct 30 06:45:24 2007 +0000 @@ -389,13 +389,13 @@ g_free(cb_data); } -/* SOAP get contact list*/ +/*SOAP get contact list*/ void msn_get_contact_list(MsnContact * contact, const MsnSoapPartnerScenario partner_scenario, const char *update_time) { gchar *body = NULL; - gchar * update_str; + gchar *update_str = NULL; GetContactListCbData cb_data = { contact, partner_scenario }; const gchar *partner_scenario_str = MsnSoapPartnerScenarioText[partner_scenario]; @@ -406,8 +406,7 @@ update_str = g_strdup_printf(MSN_GET_CONTACT_UPDATE_XML,update_time); } - body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str, - update_str); + body = g_strdup_printf(MSN_GET_CONTACT_TEMPLATE, partner_scenario_str, update_str ? update_str : ""); msn_soap_message_send(contact->session, msn_soap_message_new(MSN_GET_CONTACT_SOAP_ACTION, @@ -657,7 +656,7 @@ if ((node2 = xmlnode_get_child(abNode, "lastChange"))) tmp = xmlnode_get_data(node2); - purple_debug_info("MsnAB"," lastchanged Time:{%s}\n", tmp ? tmp : "(null)"); + purple_debug_info("MSNAB"," lastchanged Time:{%s}\n", tmp ? tmp : "(null)"); purple_account_set_string(session->account, "ablastChange", tmp); g_free(tmp); tmp = NULL; @@ -691,10 +690,6 @@ msn_send_privacy(session->account->gc); msn_notification_dump_contact(session); } - - /*free the read buffer*/ - msn_soap_free_read_buf(soapconn); - return TRUE; } else { /* This is making us loop infinitely when we fail to parse the address book, disable for now (we should re-enable when we @@ -705,7 +700,6 @@ */ msn_session_disconnect(session); purple_connection_error(session->account->gc, _("Unable to retrieve MSN Address Book")); - return FALSE; } } @@ -715,26 +709,17 @@ MsnSoapPartnerScenario partner_scenario, const char *LastChanged, const char *dynamicItemLastChange) { - char *body = NULL; - char *ab_update_str,*update_str; + char *body, *update_str = NULL; purple_debug_misc("MSNAB","Getting Address Book\n"); /*build SOAP and POST it*/ - if ( LastChanged != NULL ) { - ab_update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML,LastChanged); - } else { - ab_update_str = g_strdup(""); - } - if ( dynamicItemLastChange != NULL ) { - update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, - dynamicItemLastChange); - } else { - update_str = g_strdup(ab_update_str); - } - - body = g_strdup_printf(MSN_GET_ADDRESS_TEMPLATE, MsnSoapPartnerScenarioText[partner_scenario], update_str); - g_free(update_str); + if (dynamicItemLastChange != NULL) + update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, dynamicItemLastChange); + else if (LastChanged != NULL) + update_str = g_strdup_printf(MSN_GET_ADDRESS_UPDATE_XML, LastChanged); + + body = g_strdup_printf(MSN_GET_ADDRESS_TEMPLATE, MsnSoapPartnerScenarioText[partner_scenario], update_str ? update_str : ""); msn_soap_message_send(contact->session, msn_soap_message_new(MSN_GET_ADDRESS_SOAP_ACTION, @@ -742,7 +727,7 @@ MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, msn_get_address_cb, contact); - g_free(ab_update_str); + g_free(update_str); g_free(body); } @@ -763,22 +748,17 @@ // 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_notification_send_fqy(session, state->who); user = msn_userlist_find_add_user(userlist, state->who, state->who); msn_user_add_group_id(user, state->guid); + } - if (msn_userlist_user_is_in_list(user, MSN_LIST_PL)) { - msn_del_contact_from_list(session->contact, NULL, state->who, MSN_LIST_PL); - } - } - msn_callback_state_free(state); } @@ -931,12 +911,11 @@ MsnCallbackState *state = data; if (resp != NULL) { - MsnUser *user; MsnUserList *userlist = state->session->userlist; + MsnUser *user = msn_userlist_find_user_with_id(userlist, state->uid); purple_debug_info("MSNCL","Delete contact successful\n"); - user = msn_userlist_find_user_with_id(userlist, state->uid); if (user != NULL) { msn_userlist_remove_user(userlist, user); } @@ -951,7 +930,7 @@ { gchar *body = NULL; gchar *contact_id_xml = NULL ; - MsnCallbackState *state; + MsnCallbackState *state; g_return_if_fail(contactId != NULL); contact_id_xml = g_strdup_printf(MSN_CONTACT_ID_XML, contactId); @@ -962,8 +941,7 @@ /* build SOAP request */ purple_debug_info("MSNCL","Deleting contact with contactId: %s\n", contactId); body = g_strdup_printf(MSN_DEL_CONTACT_TEMPLATE, contact_id_xml); - - msn_soap_message_send(state->session, + msn_soap_message_send(contact->session, msn_soap_message_new(MSN_CONTACT_DEL_SOAP_ACTION, xmlnode_from_str(body, -1)), MSN_CONTACT_SERVER, MSN_ADDRESS_BOOK_POST_URL, @@ -1086,10 +1064,15 @@ MsnCallbackState *state = data; MsnSession *session = state->session; - if (resp != NULL) { + if (resp != NULL) { purple_debug_info("MSN CL", "Contact %s deleted successfully from %s list on server!\n", state->who, MsnMemberRole[state->list_id]); if (state->list_id == MSN_LIST_PL) { + MsnUser *user = msn_userlist_find_user(session->userlist, state->who); + + if (user != NULL) + msn_user_unset_op(user, MSN_LIST_PL_OP); + msn_add_contact_to_list(session->contact, state, state->who, MSN_LIST_RL); } else if (state->list_id == MSN_LIST_AL) { purple_privacy_permit_remove(session->account, state->who, TRUE); @@ -1166,23 +1149,24 @@ if (resp != NULL) { purple_debug_info("MSN CL", "Contact %s added successfully to %s list on server!\n", state->who, MsnMemberRole[state->list_id]); - if (state->list_id == MSN_LIST_RL && - (state->action & MSN_DENIED_BUDDY)) { + if (state->list_id == MSN_LIST_RL) { + MsnUser *user = msn_userlist_find_user(state->session->userlist, state->who); + + if (user != NULL) { + msn_user_set_op(user, MSN_LIST_RL_OP); + } - msn_add_contact_to_list(state->session->contact, NULL, state->who, MSN_LIST_BL); - } else if (state->list_id == MSN_LIST_AL) { - purple_privacy_permit_add(state->session->account, state->who, TRUE); - } else if (state->list_id == MSN_LIST_BL) { - purple_privacy_deny_add(state->session->account, state->who, TRUE); + if (state->action & MSN_DENIED_BUDDY) { + + msn_add_contact_to_list(state->session->contact, NULL, state->who, MSN_LIST_BL); + } else if (state->list_id == MSN_LIST_AL) { + purple_privacy_permit_add(state->session->account, state->who, TRUE); + } else if (state->list_id == MSN_LIST_BL) { + purple_privacy_deny_add(state->session->account, state->who, TRUE); + } } } - if (state->list_id == MSN_LIST_AL) { - purple_privacy_permit_add(state->session->account, state->who, TRUE); - } else if (state->list_id == MSN_LIST_BL) { - purple_privacy_deny_add(state->session->account, state->who, TRUE); - } - msn_callback_state_free(state); } @@ -1267,7 +1251,7 @@ if (resp == NULL) { msn_callback_state_free(state); - return TRUE; + return; } if (state) {
--- a/libpurple/protocols/msn/nexus.c Thu Oct 25 08:33:59 2007 +0000 +++ b/libpurple/protocols/msn/nexus.c Tue Oct 30 06:45:24 2007 +0000 @@ -174,7 +174,7 @@ g_free(password); msn_nexus_destroy(nexus); session->nexus = NULL; - return FALSE; + return; } /* @@ -216,7 +216,5 @@ soap = msn_soap_message_new(NULL, xmlnode_from_str(tail, -1)); msn_soap_message_send(nexus->session, soap, MSN_TWN_SERVER, TWN_POST_URL, nexus_got_response_cb, nexus); - - return TRUE; }