diff src/protocols/msn/state.c @ 19818:2e078c892e0b

[gaim-migrate @ 17003] add the PSM processing need to store the PSM info to XML. Thanks for Chris <ukdrizzle@yahoo.co.uk> 's code! committed by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Wed, 23 Aug 2006 15:07:17 +0000
parents 3a15b4e5c336
children bf8fb36097ee
line wrap: on
line diff
--- a/src/protocols/msn/state.c	Tue Aug 22 16:13:43 2006 +0000
+++ b/src/protocols/msn/state.c	Wed Aug 23 15:07:17 2006 +0000
@@ -80,6 +80,34 @@
 	return result;
 }
 
+/*get the PSM info from the XML string*/
+const char *
+msn_get_psm(char *xml_str,gsize len)
+{
+	xmlnode *payloadNode, *psmNode;
+	char *psm_str,*psm;
+
+	payloadNode = xmlnode_from_str(xml_str, len);
+	if (!payloadNode){
+		gaim_debug_error("MaYuan","PSM XML parse Error!\n");
+		return NULL;
+	}
+	psmNode = xmlnode_get_child(payloadNode, "PSM");
+	if (!psmNode){
+		gaim_debug_info("Ma Yuan","No PSM status Node");
+		g_free(payloadNode);
+		return NULL;
+	}
+	psm_str = xmlnode_get_data(psmNode);
+	gaim_debug_info("Ma Yuan","got PSM {%s}\n", psm_str);
+	psm = g_strdup(psm_str);
+
+	g_free(psmNode);
+	g_free(payloadNode);
+
+	return psm;
+}
+
 void
 msn_set_psm(MsnSession *session)
 {