]> andersk Git - libfaim.git/blobdiff - aim_tlv.c
Hopefully fix msgbot's issue.
[libfaim.git] / aim_tlv.c
index 06f1f7a1d5e5ba40aeeb6f1fd5bb624b7bbb7fe0..42d36027ecb00e30990ff0c74a87a9a9bd6056d3 100644 (file)
--- a/aim_tlv.c
+++ b/aim_tlv.c
@@ -67,7 +67,21 @@ void aim_freetlvchain(struct aim_tlvlist_t **list)
   return;
 }
 
-int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str)
+int aim_counttlvchain(struct aim_tlvlist_t **list)
+{
+  struct aim_tlvlist_t *cur;
+  int count = 0;
+
+  if (!list || !(*list))
+    return 0;
+
+  for (cur = *list; cur; cur = cur->next)
+    count++;
+  return count;
+}
+
+int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len)
 {
   struct aim_tlvlist_t *new;
   struct aim_tlvlist_t *cur;
@@ -80,7 +94,7 @@ int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char
 
   new->tlv = aim_createtlv();  
   new->tlv->type = type;
-  new->tlv->length = strlen(str);
+  new->tlv->length = len;
   new->tlv->value = (u_char *)malloc(new->tlv->length*sizeof(u_char));
   memcpy(new->tlv->value, str, new->tlv->length);
 
This page took 0.033269 seconds and 4 git commands to generate.