soc.2010.msn-tlc: c397960b: Add a function that will help debug of S...

masca at cpw.pidgin.im masca at cpw.pidgin.im
Mon Jul 5 23:01:32 EDT 2010


----------------------------------------------------------------------
Revision: c397960b11ce83ec8c1042f90070e6320809acdc
Parent:   9a64f9e04964b754330b4787eb611692416c30ed
Author:   masca at cpw.pidgin.im
Date:     06/30/10 16:41:58
Branch:   im.pidgin.soc.2010.msn-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/c397960b11ce83ec8c1042f90070e6320809acdc

Changelog: 

Add a function that will help debug of SlpMessages.

Changes against parent 9a64f9e04964b754330b4787eb611692416c30ed

  patched  libpurple/protocols/msn/slpmsg.c
  patched  libpurple/protocols/msn/slpmsg.h

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slpmsg.c	71f315b663e01960aebb936bcb0e674f16ac780e
+++ libpurple/protocols/msn/slpmsg.c	fde14bda67613c8c8589fb8691e071a353b8f922
@@ -327,3 +327,35 @@ char *msn_slpmsg_serialize(MsnSlpMessage
 
 	return base;
 }
+
+void msn_slpmsg_show_readable(MsnSlpMessage *slpmsg)
+{
+	GString *str;
+
+	str = g_string_new(NULL);
+
+	g_string_append_printf(str, "Session ID: %u\r\n", slpmsg->header->session_id);
+	g_string_append_printf(str, "ID:         %u\r\n", slpmsg->header->id);
+	g_string_append_printf(str, "Offset:     %" G_GUINT64_FORMAT "\r\n", slpmsg->header->offset);
+	g_string_append_printf(str, "Total size: %" G_GUINT64_FORMAT "\r\n", slpmsg->header->total_size);
+	g_string_append_printf(str, "Length:     %u\r\n", slpmsg->header->length);
+	g_string_append_printf(str, "Flags:      0x%x\r\n", slpmsg->header->flags);
+	g_string_append_printf(str, "ACK ID:     %u\r\n", slpmsg->header->ack_id);
+	g_string_append_printf(str, "SUB ID:     %u\r\n", slpmsg->header->ack_sub_id);
+	g_string_append_printf(str, "ACK Size:   %" G_GUINT64_FORMAT "\r\n", slpmsg->header->ack_size);
+
+	if (purple_debug_is_verbose() && slpmsg->buffer != NULL) {
+		g_string_append_len(str, slpmsg->buffer, slpmsg->size);
+
+		if (slpmsg->buffer[slpmsg->size - 1] == '\0') {
+			str->len--;
+			g_string_append(str, " 0x00");
+		}
+		g_string_append(str, "\r\n");
+
+	}
+
+	g_string_append_printf(str, "Footer:     %u\r\n", slpmsg->footer->value);
+
+	purple_debug_info("msn", "SlpMessage %s:\n{%s}\n", slpmsg->info, str->str);
+}
============================================================
--- libpurple/protocols/msn/slpmsg.h	d548f040bf4d972f284ad299c7b360bd5effa338
+++ libpurple/protocols/msn/slpmsg.h	edb15cde6c3385fb0265c4b24d9d581616339e20
@@ -172,4 +172,6 @@ char *msn_slpmsg_serialize(MsnSlpMessage
  */
 char *msn_slpmsg_serialize(MsnSlpMessage *slpmsg, size_t *ret_size);
 
+void msn_slpmsg_show_readable(MsnSlpMessage *slpmsg);
+
 #endif /* _MSN_SLPMSG_H_ */


More information about the Commits mailing list