im.pidgin.pidgin.khc.msnp15: 493ccf606032f5a0aeccddca1bc2b60e02ec3f9f

quantum.analyst at gmail.com quantum.analyst at gmail.com
Sat Jan 12 19:05:43 EST 2008


-----------------------------------------------------------------
Revision: 493ccf606032f5a0aeccddca1bc2b60e02ec3f9f
Ancestor: 4d012a1c6c1e3584daddd19ed2e5028537e11e6a
Author: quantum.analyst at gmail.com
Date: 2008-01-12T23:26:29
Branch: im.pidgin.pidgin.khc.msnp15

Modified files:
        libpurple/protocols/msn/contact.c
        libpurple/protocols/msn/nexus.c
        libpurple/protocols/msn/oim.c
        libpurple/protocols/msn/soap2.c
        libpurple/protocols/msn/soap2.h

ChangeLog: 

References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/contact.c	a06db8eb0537e22d8f9e9fa80da653bdf6f8229e
+++ libpurple/protocols/msn/contact.c	2902452c60afb5364cd2e4f709445e22575a227e
@@ -211,7 +211,7 @@ msn_create_address_cb(MsnSoapMessage *re
 static void
 msn_create_address_cb(MsnSoapMessage *req, MsnSoapMessage *resp, gpointer data)
 {
-	if (resp && msn_soap_xml_get(resp->xml, "Body/Fault") == NULL) {
+	if (resp && xmlnode_get_child(resp->xml, "Body/Fault") == NULL) {
 		purple_debug_info("msnab", "Address Book successfully created!\n");
 		msn_get_address_book((MsnContact *)data, MSN_PS_INITIAL, NULL, NULL);
 	} else {
@@ -272,7 +272,7 @@ msn_parse_each_service(MsnSession *sessi
 {
 	xmlnode *type;
 
-	if ((type = msn_soap_xml_get(service, "Info/Handle/Type"))) {
+	if ((type = xmlnode_get_child(service, "Info/Handle/Type"))) {
 		char *type_str = xmlnode_get_data(type);
 
 		if (g_str_equal(type_str, "Profile")) {
@@ -286,7 +286,7 @@ msn_parse_each_service(MsnSession *sessi
 			purple_account_set_string(session->account,	"CLLastChange",
 				lastchange_str);
 
-			for (membership = msn_soap_xml_get(service,
+			for (membership = xmlnode_get_child(service,
 					"Memberships/Membership");
 				 membership; membership = xmlnode_get_next_twin(membership)) {
 
@@ -298,7 +298,7 @@ msn_parse_each_service(MsnSession *sessi
 				purple_debug_info("msncl", "MemberRole role: %s, list: %d\n",
 					role_str, list);
 
-				for (member = msn_soap_xml_get(membership, "Members/Member");
+				for (member = xmlnode_get_child(membership, "Members/Member");
 					 member; member = xmlnode_get_next_twin(member)) {
 					const char *member_type = xmlnode_get_attrib(member, "type");
 					if (g_str_equal(member_type, "PassportMember")) {
@@ -334,14 +334,14 @@ msn_parse_contact_list(MsnContact *conta
 	 *
 	 * this is not handled yet
 	 */
-	if ((fault = msn_soap_xml_get(node, "Body/Fault"))) {
+	if ((fault = xmlnode_get_child(node, "Body/Fault"))) {
 		if ((faultnode = xmlnode_get_child(fault, "faultstring"))) {
 			char *faultstring = xmlnode_get_data(faultnode);
 			purple_debug_info("msncl", "Retrieving contact list failed: %s\n",
 				faultstring);
 			g_free(faultstring);
 		}
-		if ((faultnode = msn_soap_xml_get(fault, "detail/errorcode"))) {
+		if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) {
 			char *errorcode = xmlnode_get_data(faultnode);
 
 			if (g_str_equal(errorcode, "ABDoesNotExist")) {
@@ -357,7 +357,7 @@ msn_parse_contact_list(MsnContact *conta
 	} else {
 		xmlnode *service;
 
-		for (service = msn_soap_xml_get(node, "Body/FindMembershipResponse/"
+		for (service = xmlnode_get_child(node, "Body/FindMembershipResponse/"
 				"FindMembershipResult/Services/Service");
 			 service; service = xmlnode_get_next_twin(service)) {
 			msn_parse_each_service(contact->session, service);
@@ -602,7 +602,7 @@ msn_parse_addressbook(MsnContact * conta
 
 	session = contact->session;
 
-	if ((fault = msn_soap_xml_get(node, "Body/Fault"))) {
+	if ((fault = xmlnode_get_child(node, "Body/Fault"))) {
 		xmlnode *faultnode;
 
 		if ((faultnode = xmlnode_get_child(fault, "faultstring"))) {
@@ -611,7 +611,7 @@ msn_parse_addressbook(MsnContact * conta
 			g_free(faultstring);
 		}
 
-		if ((faultnode = msn_soap_xml_get(fault, "detail/errorcode"))) {
+		if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) {
 			gchar *errorcode = xmlnode_get_data(faultnode);
 
 			purple_debug_info("MSNAB", "Error Code: %s\n", errorcode);
@@ -625,7 +625,7 @@ msn_parse_addressbook(MsnContact * conta
 		return FALSE;
 	}
 
-	result = msn_soap_xml_get(node, "Body/ABFindAllResponse/ABFindAllResult");
+	result = xmlnode_get_child(node, "Body/ABFindAllResponse/ABFindAllResult");
 	if(result == NULL){
 		purple_debug_misc("MSNAB","receive no address book update\n");
 		return TRUE;
@@ -1304,7 +1304,7 @@ msn_group_read_cb(MsnSoapMessage *req, M
 			/* the response is taken from
 			   http://telepathy.freedesktop.org/wiki/Pymsn/MSNP/ContactListActions
 			   should copy it to msnpiki some day */
-			xmlnode *guid_node = msn_soap_xml_get(resp->xml,
+			xmlnode *guid_node = xmlnode_get_child(resp->xml,
 				"Body/ABGroupAddResponse/ABGroupAddResult/guid");
 
 			if (guid_node) {
============================================================
--- libpurple/protocols/msn/nexus.c	e4cec55946fe49190788bcb41e077225fb9b3ccc
+++ libpurple/protocols/msn/nexus.c	5e007a256122ccd5ba155b15e51ab74020585223
@@ -233,7 +233,7 @@ nexus_parse_response(MsnNexus *nexus, xm
 	xmlnode *node;
 	gboolean result = FALSE;
 
-	node = msn_soap_xml_get(xml, "Body/RequestSecurityTokenResponseCollection/RequestSecurityTokenResponse");
+	node = xmlnode_get_child(xml, "Body/RequestSecurityTokenResponseCollection/RequestSecurityTokenResponse");
 
 	if (node)
 		node = node->next;	/* The first one is not useful */
@@ -241,9 +241,9 @@ nexus_parse_response(MsnNexus *nexus, xm
 		return FALSE;
 
 	for (; node; node = node->next) {
-		xmlnode *token = msn_soap_xml_get(node, "RequestedSecurityToken/BinarySecurityToken");
-		xmlnode *secret = msn_soap_xml_get(node, "RequestedProofToken/BinarySecret");
-		xmlnode *expires = msn_soap_xml_get(node, "LifeTime/Expires");
+		xmlnode *token = xmlnode_get_child(node, "RequestedSecurityToken/BinarySecurityToken");
+		xmlnode *secret = xmlnode_get_child(node, "RequestedProofToken/BinarySecret");
+		xmlnode *expires = xmlnode_get_child(node, "LifeTime/Expires");
 
 		if (token) {
 			char *token_str, *expiry_str;
@@ -446,3 +446,4 @@ msn_nexus_get_token_str(MsnNexus *nexus,
 
 	return buf;
 }
+
============================================================
--- libpurple/protocols/msn/oim.c	d6b1b8a602b209c80241b0fd65589472ef7fb134
+++ libpurple/protocols/msn/oim.c	558b29fbed38b90b57e7b964b879f3ca954e6ccd
@@ -146,7 +146,7 @@ msn_oim_send_read_cb(MsnSoapMessage *req
 	if (response == NULL) {
 		purple_debug_info("MSNP14", "cannot send OIM: %s\n", msg->oim_msg);
 	} else {
-		xmlnode	*faultNode = msn_soap_xml_get(response->xml, "Body/Fault");
+		xmlnode	*faultNode = xmlnode_get_child(response->xml, "Body/Fault");
 
 		if (faultNode == NULL) {
 			/*Send OK! return*/
@@ -158,7 +158,7 @@ msn_oim_send_read_cb(MsnSoapMessage *req
 				char *faultcode_str = xmlnode_get_data(faultcode);
 
 				if (g_str_equal(faultcode_str, "q0:AuthenticationFailed")) {
-					xmlnode *challengeNode = msn_soap_xml_get(faultNode,
+					xmlnode *challengeNode = xmlnode_get_child(faultNode,
 						"detail/LockKeyChallenge");
 
 					g_free(faultcode_str);
@@ -269,7 +269,7 @@ msn_oim_delete_read_cb(MsnSoapMessage *r
 {
 	MsnOimRecvData *rdata = data;
 
-	if (response && msn_soap_xml_get(response->xml, "Body/Fault") == NULL) {
+	if (response && xmlnode_get_child(response->xml, "Body/Fault") == NULL) {
 		purple_debug_info("msnoim", "delete OIM success\n");
 		rdata->oim->oim_list = g_list_remove(rdata->oim->oim_list,
 			rdata->msg_id);
@@ -453,7 +453,7 @@ msn_oim_get_read_cb(MsnSoapMessage *requ
 	MsnOimRecvData *rdata = data;
 
 	if (response != NULL) {
-		xmlnode *msg_node = msn_soap_xml_get(response->xml,
+		xmlnode *msg_node = xmlnode_get_child(response->xml,
 			"Body/GetMessageResponse/GetMessageResult");
 
 		if (msg_node) {
@@ -489,7 +489,7 @@ msn_parse_oim_msg(MsnOim *oim,const char
 		return;
 	}
 
-	iu_node = msn_soap_xml_get(node, "E/IU");
+	iu_node = xmlnode_get_child(node, "E/IU");
 
 	if (iu_node != NULL && purple_account_get_check_mail(session->account))
 	{
============================================================
--- libpurple/protocols/msn/soap2.c	e0efef9501172e1cc109b1fdcc718f3f06b9df16
+++ libpurple/protocols/msn/soap2.c	fdee9a1991568bae8ca4b9321d65dfd18fa1e7b7
@@ -654,21 +654,3 @@ msn_soap_request_destroy(MsnSoapRequest 
 	g_free(req);
 }
 
-xmlnode *
-msn_soap_xml_get(xmlnode *parent, const char *node)
-{
-	xmlnode *ret = NULL;
-	char **tokens = g_strsplit(node, "/", -1);
-	int i;
-
-	for (i = 0; tokens[i]; i++) {
-		if ((ret = xmlnode_get_child(parent, tokens[i])) != NULL)
-			parent = ret;
-		else
-			break;
-	}
-
-	g_strfreev(tokens);
-	return ret;
-}
-
============================================================
--- libpurple/protocols/msn/soap2.h	7095cf59c22c08f101e406a42c838d3f4259c730
+++ libpurple/protocols/msn/soap2.h	79076c550a1716a51506268d690788a44b940190
@@ -53,6 +53,4 @@ void msn_soap_message_destroy(MsnSoapMes
 
 void msn_soap_message_destroy(MsnSoapMessage *message);
 
-xmlnode *msn_soap_xml_get(xmlnode *parent, const char *node);
-
 #endif


More information about the Commits mailing list