changeset 13890:2bac009eaa0c

[gaim-migrate @ 16372] Some comments changes, and: 1. Don't buddy icons in Jabber 2. When clearing your buddy icon in oscar, do it the same way that WinAIM does it committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 29 Jun 2006 08:14:29 +0000
parents 085b15c33ca4
children da1046158b3b
files src/blist.h src/protocols/jabber/presence.c src/protocols/oscar/family_feedbag.c src/protocols/oscar/family_oservice.c src/protocols/oscar/oscar.h
diffstat 5 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/blist.h	Wed Jun 28 19:42:20 2006 +0000
+++ b/src/blist.h	Thu Jun 29 08:14:29 2006 +0000
@@ -286,6 +286,7 @@
 
 /**
  * Sets the server-sent alias of a buddy in the buddy list.
+ * PRPLs should call serv_got_alias() instead of this.
  *
  * @param buddy  The buddy whose alias will be changed.
  * @param alias  The buddy's "official" alias.
--- a/src/protocols/jabber/presence.c	Wed Jun 28 19:42:20 2006 +0000
+++ b/src/protocols/jabber/presence.c	Thu Jun 29 08:14:29 2006 +0000
@@ -256,13 +256,14 @@
 				char hash[41], *p;
 				int i;
 
-				gaim_cipher_digest_region("sha1", (guchar *)data, size,
+				gaim_cipher_digest_region("sha1", data, size,
 						sizeof(hashval), hashval, NULL);
 				p = hash;
 				for(i=0; i<20; i++, p+=2)
 					snprintf(p, 3, "%02x", hashval[i]);
 				gaim_blist_node_set_string((GaimBlistNode*)b, "avatar_hash", hash);
 			}
+			g_free(data);
 			g_free(text);
 		}
 	}
--- a/src/protocols/oscar/family_feedbag.c	Wed Jun 28 19:42:20 2006 +0000
+++ b/src/protocols/oscar/family_feedbag.c	Thu Jun 29 08:14:29 2006 +0000
@@ -1089,7 +1089,7 @@
  * @param iconcsumlen Length of the MD5 checksum given above.  Should be 0x10 bytes.
  * @return Return 0 if no errors, otherwise return the error number.
  */
-int aim_ssi_seticon(OscarData *od, guint8 *iconsum, guint16 iconsumlen)
+int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint16 iconsumlen)
 {
 	struct aim_ssi_item *tmp;
 	guint8 *csumdata;
@@ -1099,13 +1099,12 @@
 
 	/* Find the ICONINFO item, or add it if it does not exist */
 	if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) {
-		tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0x51F4, AIM_SSI_TYPE_ICONINFO, NULL);
+		tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0xFFFF, AIM_SSI_TYPE_ICONINFO, NULL);
 	}
 
 	/* Need to add the 0x00d5 TLV to the TLV chain */
 	csumdata = (guint8 *)malloc((iconsumlen+2)*sizeof(guint8));
-	csumdata[0] = 0x00;
-	csumdata[1] = 0x10;
+	aimutil_put16(&csumdata[0], iconsumlen);
 	memcpy(&csumdata[2], iconsum, iconsumlen);
 	aim_tlvlist_replace_raw(&tmp->data, 0x00d5, (iconsumlen+2) * sizeof(guint8), csumdata);
 	free(csumdata);
@@ -1122,23 +1121,17 @@
  * Remove a reference to a server stored buddy icon.  This will make your
  * icon stop showing up to other people.
  *
- * @param od The oscar odion.
+ * Really this function just sets the icon to a dummy value.  It's weird...
+ * but I think the dummy value basically means "I don't have an icon!"
+ *
+ * @param od The oscar session.
  * @return Return 0 if no errors, otherwise return the error number.
  */
 int aim_ssi_delicon(OscarData *od)
 {
-	struct aim_ssi_item *tmp;
-
-	if (!od)
-		return -EINVAL;
+	const guint8 csumdata[] = {0x02, 0x01, 0xd2, 0x04, 0x72};
 
-	/* Find the ICONINFO item and delete it if it exists*/
-	if ((tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO)))
-		aim_ssi_itemlist_del(&od->ssi.local, tmp);
-
-	/* Sync our local list with the server list */
-	aim_ssi_sync(od);
-	return 0;
+	return aim_ssi_seticon(od, csumdata, 5);
 }
 
 /**
--- a/src/protocols/oscar/family_oservice.c	Wed Jun 28 19:42:20 2006 +0000
+++ b/src/protocols/oscar/family_oservice.c	Thu Jun 29 08:14:29 2006 +0000
@@ -1064,6 +1064,11 @@
 	flags = byte_stream_get8(bs);
 	length = byte_stream_get8(bs);
 
+	/*
+	 * A flag of 0x01 could mean "this is the checksum we have for you"
+	 * A flag of 0x40 could mean "I don't have your icon, upload it"
+	 */
+
 	if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) {
 		switch (type) {
 		case 0x0000:
--- a/src/protocols/oscar/oscar.h	Wed Jun 28 19:42:20 2006 +0000
+++ b/src/protocols/oscar/oscar.h	Thu Jun 29 08:14:29 2006 +0000
@@ -1161,7 +1161,7 @@
 int aim_ssi_deletelist(OscarData *od);
 int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny, guint32 vismask);
 int aim_ssi_setpresence(OscarData *od, guint32 presence);
-int aim_ssi_seticon(OscarData *od, guint8 *iconsum, guint16 iconsumlen);
+int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint16 iconsumlen);
 int aim_ssi_delicon(OscarData *od);