diff libpurple/protocols/msn/notification.c @ 20468:b888c2f15c79

Print the policies sent by the server (GCF command) in a human-readable way.
author Carlos Silva <typ0@pidgin.im>
date Sat, 14 Jul 2007 18:13:59 +0000
parents 86da6ab1f612
children 7d6f247f08d9
line wrap: on
line diff
--- a/libpurple/protocols/msn/notification.c	Sat Jul 14 00:04:48 2007 +0000
+++ b/libpurple/protocols/msn/notification.c	Sat Jul 14 18:13:59 2007 +0000
@@ -1492,14 +1492,30 @@
 gcf_cmd_post(MsnCmdProc *cmdproc, MsnCommand *cmd, char *payload,
 			 size_t len)
 {
-	/*get the payload content*/
-	purple_debug_info("MaYuan","GCF{%s}\n",cmd->payload);
+	xmlnode * root;
+	gchar * buf;
+
+	g_return_if_fail(cmd->payload != NULL);
+
+	if ( (root = xmlnode_from_str(cmd->payload, cmd->payload_len)) == NULL)
+	{
+		purple_debug_error("MSN","Unable to parse GCF payload into a XML tree");
+		return;
+	}
+	
+	buf = xmlnode_to_formatted_str(root, NULL);
+
+	/* get the payload content */
+	purple_debug_info("MaYuan","GCF command payload:\n\"%s\"\n",buf);
+	
+	g_free(buf);
+	xmlnode_free(root);
 }
 
 static void
 gcf_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
 {
-	purple_debug_info("MaYuan","Processing GCF... \n");
+	purple_debug_info("MaYuan","Processing GCF command\n");
 	cmdproc->last_cmd->payload_cb  = gcf_cmd_post;
 	return;
 }