changeset 17281:d8afaaf24f34

Trivial fixes to clean up MsimMessage.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Fri, 01 Jun 2007 06:11:40 +0000
parents d3e17c9d16e9
children ec50eafd1823
files libpurple/protocols/myspace/message.c libpurple/protocols/myspace/message.h
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/message.c	Fri Jun 01 06:09:32 2007 +0000
+++ b/libpurple/protocols/myspace/message.c	Fri Jun 01 06:11:40 2007 +0000
@@ -393,7 +393,7 @@
 		case MSIM_TYPE_BINARY:
 		case MSIM_TYPE_DICTIONARY:
 		case MSIM_TYPE_LIST:
-			string = g_strconcat("%s", "\\", data_string, NULL);
+			string = g_strconcat(elem->name, "\\", data_string, NULL);
 			break;
 
 		/* Boolean is represented by absence or presence of name. */
@@ -647,8 +647,12 @@
  *
  * @return TRUE if successful, FALSE if not.
  */
-gboolean msim_msg_get_binary(MsimMessage *msg, gchar *name, gchar **binary_data, guint *binary_length)
+gboolean msim_msg_get_binary(MsimMessage *msg, gchar *name, gchar **binary_data, gsize *binary_length)
 {
+	MsimMessageElement *elem;
+
+	elem = msim_msg_get(msg, name);
+
 	switch (elem->type)
 	{
 		case MSIM_TYPE_STRING:
@@ -670,7 +674,7 @@
 			 * by msimprpl code for things like instant messages - stuff that should be
 			 * escaped if needed). DWIM.
 			 */
-			*binary_data = (guchar *)purple_base64_decode((gchar *)elem->data, binary_length);
+			*binary_data = (gchar *)purple_base64_decode((const gchar *)elem->data, binary_length);
 			return TRUE;
 
 		case MSIM_TYPE_BINARY:
@@ -681,7 +685,7 @@
 
 				/* Duplicate data, so caller can g_free() it. */
 				*binary_data = g_new0(char, gs->len);
-				memcpy(*binary_data, gs->data, gs->len);
+				memcpy(*binary_data, gs->str, gs->len);
 
 				*binary_length = gs->len;
 
--- a/libpurple/protocols/myspace/message.h	Fri Jun 01 06:09:32 2007 +0000
+++ b/libpurple/protocols/myspace/message.h	Fri Jun 01 06:11:40 2007 +0000
@@ -61,6 +61,6 @@
 MsimMessageElement *msim_msg_get(MsimMessage *msg, gchar *name);
 gchar *msim_msg_get_string(MsimMessage *msg, gchar *name);
 guint msim_msg_get_integer(MsimMessage *msg, gchar *name);
-gboolean msim_msg_get_binary(MsimMessage *msg, gchar *name, gchar **binary_data, guint *binary_length);
+gboolean msim_msg_get_binary(MsimMessage *msg, gchar *name, gchar **binary_data, gsize *binary_length);
 
 #endif /* _MYSPACE_MESSAGE_H */