src/protocols/oscar/tlv.c

changeset 8225
4ef47db8c9bc
parent 8092
ba92ce841814
child 8735
01248ea222d3
--- a/src/protocols/oscar/tlv.c	Wed Feb 11 04:04:48 2004 +0000
+++ b/src/protocols/oscar/tlv.c	Wed Feb 11 04:06:16 2004 +0000
@@ -510,6 +510,40 @@
 }
 
 /**
+ * Adds the given chatroom info to a TLV chain.
+ *
+ * @param list Destination chain.
+ * @param type TLV type to add.
+ * @param roomname The name of the chat.
+ * @param instance The instance.
+ * @retun The size of the value added.
+ */
+faim_internal int aim_tlvlist_add_chatroom(aim_tlvlist_t **list, fu16_t type, fu16_t exchange, const char *roomname, fu16_t instance)
+{
+	fu8_t *buf;
+	int len;
+	aim_bstream_t bs;
+
+	len = 2 + 1 + strlen(roomname) + 2;
+	
+	if (!(buf = malloc(len)))
+		return 0;
+
+	aim_bstream_init(&bs, buf, len);
+
+	aimbs_put16(&bs, exchange);
+	aimbs_put8(&bs, strlen(roomname));
+	aimbs_putraw(&bs, roomname, strlen(roomname));
+	aimbs_put16(&bs, instance);
+
+	len = aim_tlvlist_add_raw(list, type, aim_bstream_curpos(&bs), buf);
+
+	free(buf);
+
+	return len;
+}
+
+/**
  * Adds a TLV with a zero length to a TLV chain.
  *
  * @param list Destination chain.

mercurial