comparison src/protocols/oscar/family_feedbag.c @ 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 33294de08fe0
children e40263ba9680
comparison
equal deleted inserted replaced
13889:085b15c33ca4 13890:2bac009eaa0c
1087 * @param od The oscar odion. 1087 * @param od The oscar odion.
1088 * @param iconcsum The MD5 checksum of the icon you are using. 1088 * @param iconcsum The MD5 checksum of the icon you are using.
1089 * @param iconcsumlen Length of the MD5 checksum given above. Should be 0x10 bytes. 1089 * @param iconcsumlen Length of the MD5 checksum given above. Should be 0x10 bytes.
1090 * @return Return 0 if no errors, otherwise return the error number. 1090 * @return Return 0 if no errors, otherwise return the error number.
1091 */ 1091 */
1092 int aim_ssi_seticon(OscarData *od, guint8 *iconsum, guint16 iconsumlen) 1092 int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint16 iconsumlen)
1093 { 1093 {
1094 struct aim_ssi_item *tmp; 1094 struct aim_ssi_item *tmp;
1095 guint8 *csumdata; 1095 guint8 *csumdata;
1096 1096
1097 if (!od || !iconsum || !iconsumlen) 1097 if (!od || !iconsum || !iconsumlen)
1098 return -EINVAL; 1098 return -EINVAL;
1099 1099
1100 /* Find the ICONINFO item, or add it if it does not exist */ 1100 /* Find the ICONINFO item, or add it if it does not exist */
1101 if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) { 1101 if (!(tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO))) {
1102 tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0x51F4, AIM_SSI_TYPE_ICONINFO, NULL); 1102 tmp = aim_ssi_itemlist_add(&od->ssi.local, "1", 0x0000, 0xFFFF, AIM_SSI_TYPE_ICONINFO, NULL);
1103 } 1103 }
1104 1104
1105 /* Need to add the 0x00d5 TLV to the TLV chain */ 1105 /* Need to add the 0x00d5 TLV to the TLV chain */
1106 csumdata = (guint8 *)malloc((iconsumlen+2)*sizeof(guint8)); 1106 csumdata = (guint8 *)malloc((iconsumlen+2)*sizeof(guint8));
1107 csumdata[0] = 0x00; 1107 aimutil_put16(&csumdata[0], iconsumlen);
1108 csumdata[1] = 0x10;
1109 memcpy(&csumdata[2], iconsum, iconsumlen); 1108 memcpy(&csumdata[2], iconsum, iconsumlen);
1110 aim_tlvlist_replace_raw(&tmp->data, 0x00d5, (iconsumlen+2) * sizeof(guint8), csumdata); 1109 aim_tlvlist_replace_raw(&tmp->data, 0x00d5, (iconsumlen+2) * sizeof(guint8), csumdata);
1111 free(csumdata); 1110 free(csumdata);
1112 1111
1113 /* Need to add the 0x0131 TLV to the TLV chain, used to cache the icon */ 1112 /* Need to add the 0x0131 TLV to the TLV chain, used to cache the icon */
1120 1119
1121 /** 1120 /**
1122 * Remove a reference to a server stored buddy icon. This will make your 1121 * Remove a reference to a server stored buddy icon. This will make your
1123 * icon stop showing up to other people. 1122 * icon stop showing up to other people.
1124 * 1123 *
1125 * @param od The oscar odion. 1124 * Really this function just sets the icon to a dummy value. It's weird...
1125 * but I think the dummy value basically means "I don't have an icon!"
1126 *
1127 * @param od The oscar session.
1126 * @return Return 0 if no errors, otherwise return the error number. 1128 * @return Return 0 if no errors, otherwise return the error number.
1127 */ 1129 */
1128 int aim_ssi_delicon(OscarData *od) 1130 int aim_ssi_delicon(OscarData *od)
1129 { 1131 {
1130 struct aim_ssi_item *tmp; 1132 const guint8 csumdata[] = {0x02, 0x01, 0xd2, 0x04, 0x72};
1131 1133
1132 if (!od) 1134 return aim_ssi_seticon(od, csumdata, 5);
1133 return -EINVAL;
1134
1135 /* Find the ICONINFO item and delete it if it exists*/
1136 if ((tmp = aim_ssi_itemlist_finditem(od->ssi.local, NULL, "1", AIM_SSI_TYPE_ICONINFO)))
1137 aim_ssi_itemlist_del(&od->ssi.local, tmp);
1138
1139 /* Sync our local list with the server list */
1140 aim_ssi_sync(od);
1141 return 0;
1142 } 1135 }
1143 1136
1144 /** 1137 /**
1145 * Stores your setting for various SSI settings. Whether you 1138 * Stores your setting for various SSI settings. Whether you
1146 * should show up as idle or not, etc. 1139 * should show up as idle or not, etc.