changeset 31566:c714ccbcdf00

Add a function to add/replace a TLV to a list.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 07 May 2011 07:28:05 +0000
parents 23f2c4dfc93d
children 968103d932d6
files libpurple/protocols/msn/tlv.c libpurple/protocols/msn/tlv.h
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/tlv.c	Sat May 07 07:22:03 2011 +0000
+++ b/libpurple/protocols/msn/tlv.c	Sat May 07 07:28:05 2011 +0000
@@ -228,6 +228,12 @@
 }
 
 int
+msn_tlvlist_add_tlv(GSList **list, const msn_tlv_t *tlv)
+{
+	return msn_tlvlist_add_raw(list, tlv->type, tlv->length, (const char *)tlv->value);
+}
+
+int
 msn_tlvlist_replace_raw(GSList **list, const guint8 type, const guint8 length, const char *value)
 {
 	GSList *cur;
@@ -288,6 +294,12 @@
 	return msn_tlvlist_replace_raw(list, type, 4, v32);
 }
 
+int
+msn_tlvlist_replace_tlv(GSList **list, const msn_tlv_t *tlv)
+{
+	return msn_tlvlist_replace_raw(list, tlv->type, tlv->length, (const char *)tlv->value);
+}
+
 void
 msn_tlvlist_remove(GSList **list, const guint8 type)
 {
--- a/libpurple/protocols/msn/tlv.h	Sat May 07 07:22:03 2011 +0000
+++ b/libpurple/protocols/msn/tlv.h	Sat May 07 07:28:05 2011 +0000
@@ -61,6 +61,7 @@
 int msn_tlvlist_add_16(GSList **list, const guint8 type, const guint16 value);
 int msn_tlvlist_add_32(GSList **list, const guint8 type, const guint32 value);
 int msn_tlvlist_add_str(GSList **list, const guint8 type, const char *value);
+int msn_tlvlist_add_tlv(GSList **list, const msn_tlv_t *tlv);
 
 int msn_tlvlist_replace_raw(GSList **list, const guint8 type, const guint8 lenth, const char *value);
 int msn_tlvlist_replace_str(GSList **list, const guint8 type, const char *str);
@@ -68,6 +69,7 @@
 int msn_tlvlist_replace_8(GSList **list, const guint8 type, const guint8 value);
 int msn_tlvlist_replace_16(GSList **list, const guint8 type, const guint16 value);
 int msn_tlvlist_replace_32(GSList **list, const guint8 type, const guint32 value);
+int msn_tlvlist_replace_tlv(GSList **list, const msn_tlv_t *tlv);
 
 void msn_tlvlist_remove(GSList **list, const guint8 type);