pidgin: 2e35d702: Save and use the CacheKey for ABCH SOAP ...

qulogic at pidgin.im qulogic at pidgin.im
Sun Feb 15 18:15:49 EST 2009


-----------------------------------------------------------------
Revision: 2e35d702a220c2f699a00265c84fe3f4b874f129
Ancestor: 99ed7805b9c59f7109c549e16f4e81c2c0c2e908
Author: qulogic at pidgin.im
Date: 2009-02-15T21:15:39
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2e35d702a220c2f699a00265c84fe3f4b874f129

Modified files:
        libpurple/protocols/msn/contact.c
        libpurple/protocols/msn/session.c
        libpurple/protocols/msn/session.h

ChangeLog: 

Save and use the CacheKey for ABCH SOAP requests.

Fixes #8080.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/contact.c	1e4705b7ba0e026f141385c61c69badf5d4544a0
+++ libpurple/protocols/msn/contact.c	0a84c3963a25cdfcbed4b5417e640260ba66a9a7
@@ -198,6 +198,8 @@ msn_contact_request_cb(MsnSoapMessage *r
 	MsnCallbackState *state = data;
 	xmlnode *fault;
 	char *faultcode_str;
+	xmlnode *cachekey;
+	char *changed;
 
 	if (resp == NULL) {
 		purple_debug_error("msn",
@@ -206,6 +208,21 @@ msn_contact_request_cb(MsnSoapMessage *r
 		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 @@ msn_contact_request(MsnCallbackState *st
 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");
============================================================
--- libpurple/protocols/msn/session.c	21aedbbcc3931960ddb3dc322dbeccae784a470f
+++ libpurple/protocols/msn/session.c	e04a0245a1a7586f62b42fbd97a8db4e9fb2b413
@@ -90,7 +90,7 @@ msn_session_destroy(MsnSession *session)
 	msn_userlist_destroy(session->userlist);
 
 	g_free(session->psm);
-
+	g_free(session->abch_cachekey);
 #if 0
 	g_free(session->blocked_text);
 #endif
============================================================
--- libpurple/protocols/msn/session.h	b07779caf8f341f796d3459243b0887fcab95e44
+++ libpurple/protocols/msn/session.h	984247a50594b306aafcc6e8aad380837c1b02a0
@@ -98,6 +98,7 @@ struct _MsnSession
 	MsnOim          *oim;
 	MsnSync         *sync;
 	MsnUserList     *userlist;
+	char            *abch_cachekey;
 
 	int servconns_count; /**< The count of server connections. */
 	GList *switches; /**< The list of all the switchboards. */


More information about the Commits mailing list