# HG changeset patch # User Elliott Sales de Andrade # Date 1304753285 0 # Node ID c714ccbcdf00155b6db0843832cf4f2b377b6033 # Parent 23f2c4dfc93d32335652a0c5a5619f6de3291c85 Add a function to add/replace a TLV to a list. diff -r 23f2c4dfc93d -r c714ccbcdf00 libpurple/protocols/msn/tlv.c --- 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) { diff -r 23f2c4dfc93d -r c714ccbcdf00 libpurple/protocols/msn/tlv.h --- 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);