cpw.qulogic.msn: 621812c2: Apparently, when the token expires, OIM ...

qulogic at pidgin.im qulogic at pidgin.im
Sat Jun 21 04:01:09 EDT 2008


-----------------------------------------------------------------
Revision: 621812c2af6d4293bb274877d3c334ed3e284ed3
Ancestor: 4a9b457a5610fed8b11dfa296d2f410691d4ee91
Author: qulogic at pidgin.im
Date: 2008-06-21T06:11:29
Branch: im.pidgin.cpw.qulogic.msn
URL: http://d.pidgin.im/viewmtn/revision/info/621812c2af6d4293bb274877d3c334ed3e284ed3

Modified files:
        libpurple/protocols/msn/oim.c

ChangeLog: 

Apparently, when the token expires, OIM requests get a 
detail/RequiredAuthPolicy element instead of a q0:BadContextToken 
faultcode.

References #4875.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/oim.c	0b6b36e04f06d21a150067252c9a88d48a91011c
+++ libpurple/protocols/msn/oim.c	dbe54d6bbd7d3b999fef673b52fe073dfddd3443
@@ -135,15 +135,15 @@ msn_oim_request_cb(MsnSoapMessage *reque
 	gpointer req_data)
 {
 	MsnOimRequestData *data = (MsnOimRequestData *)req_data;
-	xmlnode *xml;
-	xmlnode *faultcode;
-	gchar *faultcode_str;
+	xmlnode *fault = NULL;
+	xmlnode *faultcode = NULL;
 
-	xml = response->xml;
-	faultcode = xmlnode_get_child(xml, "Body/Fault/faultcode");
+	fault = xmlnode_get_child(response->xml, "Body/Fault");
+	if (fault)
+		faultcode = xmlnode_get_child(fault, "faultcode");
 
-	if (faultcode != NULL) {
-		faultcode_str = xmlnode_get_data(faultcode);
+	if (faultcode) {
+		gchar *faultcode_str = xmlnode_get_data(faultcode);
 
 		if (faultcode_str && g_str_equal(faultcode_str, "q0:BadContextToken")) {
 			purple_debug_error("msnp15", "OIM Request Error, Updating token now.");
@@ -152,6 +152,16 @@ msn_oim_request_cb(MsnSoapMessage *reque
 				(GSourceFunc)msn_oim_request_helper, data);
 			g_free(faultcode_str);
 			return;
+
+		} else if (faultcode_str && g_str_equal(faultcode_str, "q0:AuthenticationFailed")) {
+			if (xmlnode_get_child(fault, "detail/RequiredAuthPolicy") != NULL) {
+				purple_debug_error("msnp15", "OIM Request Error, Updating token now.");
+				msn_nexus_update_token(data->oim->session->nexus,
+					data->send ? MSN_AUTH_LIVE_SECURE : MSN_AUTH_MESSENGER_WEB,
+					(GSourceFunc)msn_oim_request_helper, data);
+				g_free(faultcode_str);
+				return;
+			}
 		}
 		g_free(faultcode_str);
 	}


More information about the Commits mailing list