diff src/protocols/oscar/ssi.c @ 6101:e4a5085fb870

[gaim-migrate @ 6560] This should fix some icon uploading looping. Sean, the problem was that, when adding the md5 sum to ssi, the code was checking if it existed by looking for an item named "0", but it was actually adding an item named "1." So for accounts with no icon info yet, Gaim would end up getting in a loop and spiraling into oblivion, only far less dramatic. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 12 Jul 2003 19:08:19 +0000
parents da8939ad60b6
children 34c07f5f34a0
line wrap: on
line diff
--- a/src/protocols/oscar/ssi.c	Sat Jul 12 17:38:06 2003 +0000
+++ b/src/protocols/oscar/ssi.c	Sat Jul 12 19:08:19 2003 +0000
@@ -214,29 +214,9 @@
 	if (!cur1->data && cur2->data)
 		return 3;
 
-	if (cur1->data && cur2->data) {
-		/* Write each TLV list to a bstream and then memcmp them */
-		aim_bstream_t bs1, bs2;
-
-		if (aim_sizetlvchain(&cur1->data) != aim_sizetlvchain(&cur2->data))
+	if ((cur1->data && cur2->data) && (aim_tlvlist_cmp(cur1->data, cur2->data)))
 			return 4;
 
-		aim_bstream_init(&bs1, ((fu8_t *)malloc(aim_sizetlvchain(&cur1->data)*sizeof(fu8_t))), aim_sizetlvchain(&cur1->data));
-		aim_bstream_init(&bs2, ((fu8_t *)malloc(aim_sizetlvchain(&cur2->data)*sizeof(fu8_t))), aim_sizetlvchain(&cur2->data));
-
-		aim_writetlvchain(&bs1, &cur1->data);
-		aim_writetlvchain(&bs2, &cur2->data);
-
-		if (memcmp(bs1.data, bs2.data, bs1.len)) {
-			free(bs1.data);
-			free(bs2.data);
-			return 4;
-		}
-
-		free(bs1.data);
-		free(bs2.data);
-	}
-
 	if (cur1->name && !cur2->name)
 		return 5;
 
@@ -1047,7 +1027,14 @@
 	/* This TLV is added to cache the icon. */
 	aim_addtlvtochain_noval(&data, 0x0131);
 
-	if ((tmp = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, "0", AIM_SSI_TYPE_ICONINFO))) {
+	if ((tmp = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) {
+		/* If the new tlvchain and oldtlvchain are the same, then do nothing */
+		if (!aim_tlvlist_cmp(tmp->data, data)) {
+			/* The new tlvlist is the identical to the old one */
+			aim_freetlvchain(&data);
+			free(csumdata);
+			return 0;
+		}
 		aim_freetlvchain(&tmp->data);
 		tmp->data = data;
 	} else {