diff src/protocols/oscar/tlv.c @ 9933:cee849d17167

[gaim-migrate @ 10825] Another patch from Dave West. This makes the file transfer message show up when someone sends you an AIM file transfer. It also attempts to decode the message to UTF-8. The chat invitation messages also benefit from this attempted conversion. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 02 Sep 2004 03:46:53 +0000
parents 4048e93b8ece
children ecc0f22db510
line wrap: on
line diff
--- a/src/protocols/oscar/tlv.c	Thu Sep 02 02:49:00 2004 +0000
+++ b/src/protocols/oscar/tlv.c	Thu Sep 02 03:46:53 2004 +0000
@@ -785,6 +785,32 @@
 }
 
 /**
+ * Get the length of the data of the nth TLV in the given TLV chain.
+ *
+ * @param list Source chain.
+ * @param type Requested TLV type.
+ * @param nth Index of TLV of type to get.
+ * @return The length of the data in this TLV, or -1 if the TLV could not be
+ *         found.  Unless -1 is returned, this value will be 2 bytes.
+ */
+faim_internal int aim_tlv_getlength(aim_tlvlist_t *list, const fu16_t type, const int nth)
+{
+	aim_tlvlist_t *cur;
+	int i;
+
+	for (cur = list, i = 0; cur; cur = cur->next) {
+		if (cur && cur->tlv) {
+			if (cur->tlv->type == type)
+				i++;
+			if (i >= nth)
+				return cur->tlv->length;
+		}
+	}
+
+	return -1;
+}
+
+/**
  * Retrieve the data from the nth TLV in the given TLV chain as a string.
  *
  * @param list Source TLV chain.