changeset 17333:b9c0a8bb94b9

Add msim_msg_get_binary() - retrieves binary data values from an MsimMessage.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Fri, 01 Jun 2007 05:28:46 +0000
parents f3ec513efb59
children af7083a8ada7
files libpurple/protocols/myspace/message.c libpurple/protocols/myspace/message.h
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/message.c	Fri Jun 01 05:10:01 2007 +0000
+++ b/libpurple/protocols/myspace/message.c	Fri Jun 01 05:28:46 2007 +0000
@@ -631,9 +631,26 @@
 			return GPOINTER_TO_UINT(elem->data);
 
 		case MSIM_TYPE_STRING:
+			/* TODO: find out if we need larger integers */
 			return (guint)atoi((gchar *)elem->data);
 
 		default:
 			return 0;
 	}
 }
+
+/** Return the data of an element of a given name, as a binary GString.
+ *
+ * @return GString * of binary data, or NULL.
+ */
+GString *msim_msg_get_binary(MsimMessage *msg, gchar *name)
+{
+	switch (elem->type)
+	{
+		case MSIM_TYPE_BINARY:
+			return (GString *)elem->data;
+
+		default:
+			return NULL;
+	}
+}
--- a/libpurple/protocols/myspace/message.h	Fri Jun 01 05:10:01 2007 +0000
+++ b/libpurple/protocols/myspace/message.h	Fri Jun 01 05:28:46 2007 +0000
@@ -60,5 +60,6 @@
 MsimMessageElement *msim_msg_get_element(MsimMessage *msg, gchar *name);
 gchar *msim_msg_get_string(MsimMessage *msg, gchar *name);
 guint msim_msg_get_integer(MsimMessage *msg, gchar *name);
+GString *msim_msg_get_binary(MsimMessage *msg, gchar *name);
 
 #endif /* _MYSPACE_MESSAGE_H */