im.pidgin.pidgin: 28981c935948f2d4e944f786a01e16ecadfd4848

khc at pidgin.im khc at pidgin.im
Sun Nov 18 22:05:37 EST 2007


-----------------------------------------------------------------
Revision: 28981c935948f2d4e944f786a01e16ecadfd4848
Ancestor: bebf7d7e6a79c7790d2a56820eecfce4e8f2cd9e
Author: khc at pidgin.im
Date: 2007-11-19T02:45:41
Branch: im.pidgin.pidgin

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

ChangeLog: 

soap faults are now properly handled

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/soap2.c	72bc1e36610319a84e1df4f101aa8b7d40ccc6fe
+++ libpurple/protocols/msn/soap2.c	226411eaa6290724ef3c408919ebc358d9fc143d
@@ -208,45 +208,44 @@ msn_soap_handle_body(MsnSoapConnection *
 msn_soap_handle_body(MsnSoapConnection *conn, MsnSoapMessage *response)
 {
 	xmlnode *body = xmlnode_get_child(response->xml, "Body");
+	xmlnode *fault = xmlnode_get_child(response->xml, "Fault");
 
-	if (body) {
-		MsnSoapRequest *request;
+	if (fault) {
+		xmlnode *faultcode = xmlnode_get_child(fault, "faultcode");
 
-		if (strcmp(body->name, "Fault") == 0) {
-			xmlnode *fault = xmlnode_get_child(body, "faultcode");
+		if (faultcode != NULL) {
+			char *faultdata = xmlnode_get_data(faultcode);
 
-			if (fault != NULL) {
-				char *faultdata = xmlnode_get_data(fault);
+			if (g_str_equal(faultdata, "psf:Redirect")) {
+				xmlnode *url = xmlnode_get_child(body, "redirectUrl");
 
-				if (strcmp(faultdata, "psf:Redirect") == 0) {
-					xmlnode *url = xmlnode_get_child(body, "redirectUrl");
+				if (url) {
+					char *urldata = xmlnode_get_data(url);
+					msn_soap_handle_redirect(conn, urldata);
+					g_free(urldata);
+				}
 
-					if (url) {
-						char *urldata = xmlnode_get_data(url);
-						msn_soap_handle_redirect(conn, urldata);
-						g_free(urldata);
-					}
+				g_free(faultdata);
+				return TRUE;
+			} else if (g_str_equal(faultdata, "wsse:FailedAuthentication")) {
+				xmlnode *reason = xmlnode_get_child(body, "faultstring");
+				char *reasondata = xmlnode_get_data(reason);
 
-					g_free(faultdata);
-					return TRUE;
-				} else if (strcmp(faultdata, "wsse:FailedAuthentication") == 0) {
-					xmlnode *reason = xmlnode_get_child(body, "faultstring");
-					char *reasondata = xmlnode_get_data(reason);
+				msn_soap_connection_sanitize(conn, TRUE);
+				msn_session_set_error(conn->session, MSN_ERROR_AUTH,
+					reasondata);
 
-					msn_soap_connection_sanitize(conn, TRUE);
-					msn_session_set_error(conn->session, MSN_ERROR_AUTH,
-						reasondata);
-
-					g_free(reasondata);
-					g_free(faultdata);
-					return FALSE;
-				}
-
+				g_free(reasondata);
 				g_free(faultdata);
+				return FALSE;
 			}
+
+			g_free(faultdata);
 		}
+	}
 
-		request = conn->current_request;
+	if (fault || body) {
+		MsnSoapRequest *request = conn->current_request;
 		conn->current_request = NULL;
 		request->cb(request->message, response,
 			request->cb_data);


More information about the Commits mailing list