diff src/protocols/oscar/ssi.c @ 5842:dbed8c87f750

[gaim-migrate @ 6273] Another reason not to use CVS. This saves your buddy icons to the OSCAR servers (I hope). It's not fully tested and it may screw things up, but I wanted to get it in CVS so other people can try to break this, and KingAnt can review my work (that libfaim wizard that he is.) Don't use CVS. I'd like to thank Christian Hammond, for his work on the account and prpl APIs that made it so easy to add the hook into buddy icon changing. I'd like to thank Mark Doliner for laying most of the groundwork and for his kind words of encouragement. I'd like to thank myself for making the buddy icon selector real sexy-like. I'd like to thank the Lord almighty for giving me the strength to do this. I promised myself I wouldn't cry. I never imagined I'd be committing this. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 12 Jun 2003 22:19:07 +0000
parents e1e6b2fda105
children da8939ad60b6
line wrap: on
line diff
--- a/src/protocols/oscar/ssi.c	Thu Jun 12 18:17:31 2003 +0000
+++ b/src/protocols/oscar/ssi.c	Thu Jun 12 22:19:07 2003 +0000
@@ -1023,7 +1023,7 @@
  *
  * @param sess The oscar session.
  * @param iconcsum The MD5 checksum of the icon you are using.
- * @param iconcsumlen Length of the MD5 checksum given above.  Should be 10 bytes.
+ * @param iconcsumlen Length of the MD5 checksum given above.  Should be 0x10 bytes.
  * @return Return 0 if no errors, otherwise return the error number.
  */
 faim_export int aim_ssi_seticon(aim_session_t *sess, fu8_t *iconsum, fu16_t iconsumlen)
@@ -1035,30 +1035,31 @@
 	if (!sess || !iconsum || !iconsumlen)
 		return -EINVAL;
 
-	/* Create the data for the TLV containing the icon checksum */
 	if (!(csumdata = (fu8_t *)malloc((iconsumlen+2)*sizeof(fu8_t))))
 		return -ENOMEM;
 	csumdata[0] = 0x00;
 	csumdata[1] = 0x10;
 	memcpy(&csumdata[2], iconsum, iconsumlen);
+	
+		
+	/* Need to add the x00d5 TLV to the TLV chain */
+	aim_addtlvtochain_raw(&data, 0x00d5, (iconsumlen+2) * sizeof(fu8_t), csumdata);
 
-	/* Need to add the x0131 TLV to the TLV chain */
+	/* This TLV is added to cache the icon. */
 	aim_addtlvtochain_noval(&data, 0x0131);
 
-	/* Need to add the x00d5 TLV to the TLV chain */
-	aim_addtlvtochain_raw(&data, 0x00d5, 0x0012, csumdata);
 
 	if ((tmp = aim_ssi_itemlist_finditem(sess->ssi.local, NULL, "0", AIM_SSI_TYPE_ICONINFO))) {
 		aim_freetlvchain(&tmp->data);
 		tmp->data = data;
 	} else {
-		tmp = aim_ssi_itemlist_add(&sess->ssi.local, "0", 0x0000, 0xFFFF, AIM_SSI_TYPE_ICONINFO, data);
+		tmp = aim_ssi_itemlist_add(&sess->ssi.local, "1", 0x0000, 0x51F4, AIM_SSI_TYPE_ICONINFO, data);
 		aim_freetlvchain(&data);
 	}
 
 	/* Sync our local list with the server list */
 	aim_ssi_sync(sess);
-
+	free(csumdata);
 	return 0;
 }