Mercurial > pidgin
diff libpurple/protocols/msn/contact.c @ 25458:b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Fixes #8080.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 15 Feb 2009 21:15:39 +0000 |
parents | 8387f195c4af |
children | c729cdeb88c8 |
line wrap: on
line diff
--- a/libpurple/protocols/msn/contact.c Sun Feb 15 21:14:06 2009 +0000 +++ b/libpurple/protocols/msn/contact.c Sun Feb 15 21:15:39 2009 +0000 @@ -198,6 +198,8 @@ MsnCallbackState *state = data; xmlnode *fault; char *faultcode_str; + xmlnode *cachekey; + char *changed; if (resp == NULL) { purple_debug_error("msn", @@ -206,6 +208,21 @@ return; } + /* Update CacheKey if necessary */ + cachekey = xmlnode_get_child(resp->xml, "Header/ServiceHeader/CacheKeyChanged"); + if (cachekey != NULL) { + changed = xmlnode_get_data(cachekey); + if (changed && !strcmp(changed, "true")) { + cachekey = xmlnode_get_child(resp->xml, "Header/ServiceHeader/CacheKey"); + g_free(state->session->abch_cachekey); + state->session->abch_cachekey = xmlnode_get_data(cachekey); + purple_debug_info("msn", "Updated CacheKey for %s to '%s'.\n", + purple_account_get_username(state->session->account), + state->session->abch_cachekey); + } + g_free(changed); + } + fault = xmlnode_get_child(resp->xml, "Body/Fault"); if (fault == NULL) { @@ -247,6 +264,14 @@ static gboolean msn_contact_request(MsnCallbackState *state) { + xmlnode *cachekey = xmlnode_get_child(state->body, + "Header/ABApplicationHeader/CacheKey"); + if (cachekey != NULL) + xmlnode_free(cachekey); + if (state->session->abch_cachekey != NULL) { + cachekey = xmlnode_new_child(xmlnode_get_child(state->body, "Header/ABApplicationHeader"), "CacheKey"); + xmlnode_insert_data(cachekey, state->session->abch_cachekey, -1); + } if (state->token == NULL) state->token = xmlnode_get_child(state->body, "Header/ABAuthHeader/TicketToken");