comparison libpurple/protocols/oscar/oscar.c @ 16483:5e47b3427b28

propagate from branch 'im.pidgin.rlaager.gaim_migration' (head dcc40d46afbe3f87cc674e4fb1526ac722bc35cb) to branch 'im.pidgin.pidgin' (head 0ef5b6c44115778e329fd628324124f872f5253b)
author Sean Egan <seanegan@gmail.com>
date Fri, 27 Apr 2007 02:14:44 +0000
parents 08db93bbd798 6f197c81d478
children dbd0a01a9a81 fd6c3dc4641f
comparison
equal deleted inserted replaced
16467:b2044e10915a 16483:5e47b3427b28
1840 bi->typingnot = FALSE; 1840 bi->typingnot = FALSE;
1841 bi->ico_informed = FALSE; 1841 bi->ico_informed = FALSE;
1842 bi->ipaddr = info->icqinfo.ipaddr; 1842 bi->ipaddr = info->icqinfo.ipaddr;
1843 1843
1844 if (info->iconcsumlen) { 1844 if (info->iconcsumlen) {
1845 const char *filename, *saved_b16 = NULL; 1845 const char *saved_b16 = NULL;
1846 char *b16 = NULL, *filepath = NULL; 1846 char *b16 = NULL;
1847 PurpleBuddy *b = NULL; 1847 PurpleBuddy *b = NULL;
1848 1848
1849 b16 = purple_base16_encode(info->iconcsum, info->iconcsumlen); 1849 b16 = purple_base16_encode(info->iconcsum, info->iconcsumlen);
1850 b = purple_find_buddy(account, info->sn); 1850 b = purple_find_buddy(account, info->sn);
1851 /*
1852 * If for some reason the checksum is valid, but cached file is not..
1853 * we want to know.
1854 */
1855 if (b != NULL) 1851 if (b != NULL)
1856 filename = purple_blist_node_get_string((PurpleBlistNode*)b, "buddy_icon"); 1852 saved_b16 = purple_buddy_icons_get_checksum_for_user(b);
1857 else
1858 filename = NULL;
1859 if (filename != NULL) {
1860 if (g_file_test(filename, G_FILE_TEST_EXISTS))
1861 saved_b16 = purple_blist_node_get_string((PurpleBlistNode*)b,
1862 "icon_checksum");
1863 else {
1864 filepath = g_build_filename(purple_buddy_icons_get_cache_dir(),
1865 filename, NULL);
1866 if (g_file_test(filepath, G_FILE_TEST_EXISTS))
1867 saved_b16 = purple_blist_node_get_string((PurpleBlistNode*)b,
1868 "icon_checksum");
1869 g_free(filepath);
1870 }
1871 } else
1872 saved_b16 = NULL;
1873 1853
1874 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { 1854 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) {
1875 GSList *cur = od->requesticon; 1855 GSList *cur = od->requesticon;
1876 while (cur && aim_sncmp((char *)cur->data, info->sn)) 1856 while (cur && aim_sncmp((char *)cur->data, info->sn))
1877 cur = cur->next; 1857 cur = cur->next;
1914 static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { 1894 static int incomingim_chan1(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
1915 PurpleConnection *gc = od->gc; 1895 PurpleConnection *gc = od->gc;
1916 PurpleAccount *account = purple_connection_get_account(gc); 1896 PurpleAccount *account = purple_connection_get_account(gc);
1917 PurpleMessageFlags flags = 0; 1897 PurpleMessageFlags flags = 0;
1918 struct buddyinfo *bi; 1898 struct buddyinfo *bi;
1919 char *iconfile; 1899 PurpleStoredImage *img;
1920 GString *message; 1900 GString *message;
1921 gchar *tmp; 1901 gchar *tmp;
1922 aim_mpmsg_section_t *curpart; 1902 aim_mpmsg_section_t *curpart;
1923 const char *start, *end; 1903 const char *start, *end;
1924 GData *attribs; 1904 GData *attribs;
1951 bi->ico_csum = args->iconsum; 1931 bi->ico_csum = args->iconsum;
1952 bi->ico_time = args->iconstamp; 1932 bi->ico_time = args->iconstamp;
1953 } 1933 }
1954 } 1934 }
1955 1935
1956 iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(account)); 1936 img = purple_buddy_icons_find_account_icon(account);
1957 if ((iconfile != NULL) && 1937 if ((img != NULL) &&
1958 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) { 1938 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) {
1959 FILE *file; 1939 gconstpointer data = purple_imgstore_get_data(img);
1960 struct stat st; 1940 size_t len = purple_imgstore_get_size(img);
1961 1941 purple_debug_info("oscar",
1962 if (!g_stat(iconfile, &st)) { 1942 "Sending buddy icon to %s (%d bytes)\n",
1963 guchar *buf = g_malloc(st.st_size); 1943 userinfo->sn, len);
1964 file = g_fopen(iconfile, "rb"); 1944 /* TODO: XXX: FIXME: Does this actually need the mtime of the file? */
1965 if (file) { 1945 aim_im_sendch2_icon(od, userinfo->sn, data, len,
1966 /* XXX - Use g_file_get_contents() */ 1946 time(NULL), aimutil_iconsum(data, len));
1967 /* g_file_get_contents(iconfile, &data, &len, NULL); */ 1947 }
1968 int len = fread(buf, 1, st.st_size, file); 1948 purple_imgstore_unref(img);
1969 purple_debug_info("oscar",
1970 "Sending buddy icon to %s (%d bytes, "
1971 "%lu reported)\n",
1972 userinfo->sn, len, st.st_size);
1973 aim_im_sendch2_icon(od, userinfo->sn, buf, st.st_size,
1974 st.st_mtime, aimutil_iconsum(buf, st.st_size));
1975 fclose(file);
1976 } else
1977 purple_debug_error("oscar", "Can't open buddy icon file!\n");
1978 g_free(buf);
1979 } else
1980 purple_debug_error("oscar", "Can't stat buddy icon file!\n");
1981 }
1982 g_free(iconfile);
1983 1949
1984 message = g_string_new(""); 1950 message = g_string_new("");
1985 curpart = args->mpmsg.parts; 1951 curpart = args->mpmsg.parts;
1986 while (curpart != NULL) { 1952 while (curpart != NULL) {
1987 tmp = purple_plugin_oscar_decode_im_part(account, userinfo->sn, curpart->charset, 1953 tmp = purple_plugin_oscar_decode_im_part(account, userinfo->sn, curpart->charset,
2175 } 2141 }
2176 2142
2177 else if (args->type & OSCAR_CAPABILITY_BUDDYICON) 2143 else if (args->type & OSCAR_CAPABILITY_BUDDYICON)
2178 { 2144 {
2179 purple_buddy_icons_set_for_user(account, userinfo->sn, 2145 purple_buddy_icons_set_for_user(account, userinfo->sn,
2180 args->info.icon.icon, 2146 g_memdup(args->info.icon.icon, args->info.icon.length),
2181 args->info.icon.length); 2147 args->info.icon.length,
2148 NULL);
2182 } 2149 }
2183 2150
2184 else if (args->type & OSCAR_CAPABILITY_ICQSERVERRELAY) 2151 else if (args->type & OSCAR_CAPABILITY_ICQSERVERRELAY)
2185 { 2152 {
2186 purple_debug_error("oscar", "Got an ICQ Server Relay message of " 2153 purple_debug_error("oscar", "Got an ICQ Server Relay message of "
3276 /* 3243 /*
3277 * Some AIM clients will send a blank GIF image with iconlen 90 when 3244 * Some AIM clients will send a blank GIF image with iconlen 90 when
3278 * no icon is set. Ignore these. 3245 * no icon is set. Ignore these.
3279 */ 3246 */
3280 if ((iconlen > 0) && (iconlen != 90)) { 3247 if ((iconlen > 0) && (iconlen != 90)) {
3281 char *b16; 3248 char *b16 = purple_base16_encode(iconcsum, iconcsumlen);
3282 PurpleBuddy *b;
3283 purple_buddy_icons_set_for_user(purple_connection_get_account(gc), 3249 purple_buddy_icons_set_for_user(purple_connection_get_account(gc),
3284 sn, icon, iconlen); 3250 sn, g_memdup(icon, iconlen), iconlen, b16);
3285 b16 = purple_base16_encode(iconcsum, iconcsumlen); 3251 g_free(b16);
3286 b = purple_find_buddy(gc->account, sn);
3287 if ((b16 != NULL) && (b != NULL)) {
3288 purple_blist_node_set_string((PurpleBlistNode*)b, "icon_checksum", b16);
3289 g_free(b16);
3290 }
3291 } 3252 }
3292 3253
3293 cur = od->requesticon; 3254 cur = od->requesticon;
3294 while (cur) { 3255 while (cur) {
3295 char *cursn = cur->data; 3256 char *cursn = cur->data;
3323 } 3284 }
3324 return FALSE; 3285 return FALSE;
3325 } 3286 }
3326 3287
3327 if (od->set_icon) { 3288 if (od->set_icon) {
3328 struct stat st; 3289 PurpleAccount *account = purple_connection_get_account(gc);
3329 char *iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(purple_connection_get_account(gc))); 3290 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account);
3330 if (iconfile == NULL) { 3291 if (img == NULL) {
3331 aim_ssi_delicon(od); 3292 aim_ssi_delicon(od);
3332 } else if (!g_stat(iconfile, &st)) {
3333 guchar *buf = g_malloc(st.st_size);
3334 FILE *file = g_fopen(iconfile, "rb");
3335 if (file) {
3336 /* XXX - Use g_file_get_contents()? */
3337 fread(buf, 1, st.st_size, file);
3338 fclose(file);
3339 purple_debug_info("oscar",
3340 "Uploading icon to icon server\n");
3341 aim_bart_upload(od, buf, st.st_size);
3342 } else
3343 purple_debug_error("oscar",
3344 "Can't open buddy icon file!\n");
3345 g_free(buf);
3346 } else { 3293 } else {
3347 purple_debug_error("oscar", 3294 purple_debug_info("oscar",
3348 "Can't stat buddy icon file!\n"); 3295 "Uploading icon to icon server\n");
3349 } 3296 aim_bart_upload(od, purple_imgstore_get_data(img),
3350 g_free(iconfile); 3297 purple_imgstore_get_size(img));
3298 purple_imgstore_unref(img);
3299 }
3351 od->set_icon = FALSE; 3300 od->set_icon = FALSE;
3352 } 3301 }
3353 3302
3354 if (!od->requesticon) { 3303 if (!od->requesticon) {
3355 purple_debug_misc("oscar", 3304 purple_debug_misc("oscar",
4143 } 4092 }
4144 4093
4145 id = g_datalist_get_data(&attribs, "id"); 4094 id = g_datalist_get_data(&attribs, "id");
4146 4095
4147 /* ... if it refers to a valid purple image ... */ 4096 /* ... if it refers to a valid purple image ... */
4148 if (id && (image = purple_imgstore_get(atoi(id)))) { 4097 if (id && (image = purple_imgstore_find_by_id(atoi(id)))) {
4149 /* ... append the message from start to the tag ... */ 4098 /* ... append the message from start to the tag ... */
4150 unsigned long size = purple_imgstore_get_size(image); 4099 unsigned long size = purple_imgstore_get_size(image);
4151 const char *filename = purple_imgstore_get_filename(image); 4100 const char *filename = purple_imgstore_get_filename(image);
4152 gpointer imgdata = purple_imgstore_get_data(image); 4101 gconstpointer imgdata = purple_imgstore_get_data(image);
4153 4102
4154 oscar_id++; 4103 oscar_id++;
4155 4104
4156 /* ... insert a new img tag with the oscar id ... */ 4105 /* ... insert a new img tag with the oscar id ... */
4157 if (filename) 4106 if (filename)
4206 { 4155 {
4207 OscarData *od; 4156 OscarData *od;
4208 PurpleAccount *account; 4157 PurpleAccount *account;
4209 PeerConnection *conn; 4158 PeerConnection *conn;
4210 int ret; 4159 int ret;
4211 char *iconfile;
4212 char *tmp1, *tmp2; 4160 char *tmp1, *tmp2;
4213 4161
4214 od = (OscarData *)gc->proto_data; 4162 od = (OscarData *)gc->proto_data;
4215 account = purple_connection_get_account(gc); 4163 account = purple_connection_get_account(gc);
4216 ret = 0; 4164 ret = 0;
4217 iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(account));
4218 4165
4219 if (imflags & PURPLE_MESSAGE_AUTO_RESP) 4166 if (imflags & PURPLE_MESSAGE_AUTO_RESP)
4220 tmp1 = purple_str_sub_away_formatters(message, name); 4167 tmp1 = purple_str_sub_away_formatters(message, name);
4221 else 4168 else
4222 tmp1 = g_strdup(message); 4169 tmp1 = g_strdup(message);
4227 /* If we're directly connected, send a direct IM */ 4174 /* If we're directly connected, send a direct IM */
4228 purple_odc_send_im(conn, tmp1, imflags); 4175 purple_odc_send_im(conn, tmp1, imflags);
4229 } else { 4176 } else {
4230 struct buddyinfo *bi; 4177 struct buddyinfo *bi;
4231 struct aim_sendimext_args args; 4178 struct aim_sendimext_args args;
4232 struct stat st;
4233 gsize len; 4179 gsize len;
4234 PurpleConversation *conv; 4180 PurpleConversation *conv;
4181 PurpleStoredImage *img;
4235 4182
4236 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account); 4183 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, account);
4237 4184
4238 if (strstr(tmp1, "<IMG ")) 4185 if (strstr(tmp1, "<IMG "))
4239 purple_conversation_write(conv, "", 4186 purple_conversation_write(conv, "",
4278 "Sending buddy icon request with message\n"); 4225 "Sending buddy icon request with message\n");
4279 args.flags |= AIM_IMFLAGS_BUDDYREQ; 4226 args.flags |= AIM_IMFLAGS_BUDDYREQ;
4280 bi->ico_need = FALSE; 4227 bi->ico_need = FALSE;
4281 } 4228 }
4282 4229
4283 if (iconfile && !g_stat(iconfile, &st)) { 4230 img = purple_buddy_icons_find_account_icon(account);
4284 FILE *file = g_fopen(iconfile, "rb"); 4231 if (img) {
4285 if (file) { 4232 gconstpointer data = purple_imgstore_get_data(img);
4286 guchar *buf = g_malloc(st.st_size); 4233 args.iconlen = purple_imgstore_get_size(img);
4287 /* TODO: Use g_file_get_contents()? */ 4234 args.iconsum = aimutil_iconsum(data, args.iconlen);
4288 fread(buf, 1, st.st_size, file); 4235 /* TODO: XXX: FIXME: Deal with the timestamp issue. */
4289 fclose(file); 4236 args.iconstamp = time(NULL);
4290 4237
4291 args.iconlen = st.st_size; 4238 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) {
4292 args.iconsum = aimutil_iconsum(buf, st.st_size); 4239 bi->ico_informed = FALSE;
4293 args.iconstamp = st.st_mtime; 4240 bi->ico_sent = FALSE;
4294
4295 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) {
4296 bi->ico_informed = FALSE;
4297 bi->ico_sent = FALSE;
4298 }
4299
4300 /*
4301 * TODO:
4302 * For some reason sending our icon to people only works
4303 * when we're the ones who initiated the conversation. If
4304 * the other person sends the first IM then they never get
4305 * the icon. We should fix that.
4306 */
4307 if (!bi->ico_informed) {
4308 purple_debug_info("oscar",
4309 "Claiming to have a buddy icon\n");
4310 args.flags |= AIM_IMFLAGS_HASICON;
4311 bi->ico_me_len = args.iconlen;
4312 bi->ico_me_csum = args.iconsum;
4313 bi->ico_me_time = args.iconstamp;
4314 bi->ico_informed = TRUE;
4315 }
4316
4317 g_free(buf);
4318 } 4241 }
4319 } 4242
4320 g_free(iconfile); 4243 /*
4244 * TODO:
4245 * For some reason sending our icon to people only works
4246 * when we're the ones who initiated the conversation. If
4247 * the other person sends the first IM then they never get
4248 * the icon. We should fix that.
4249 */
4250 if (!bi->ico_informed) {
4251 purple_debug_info("oscar",
4252 "Claiming to have a buddy icon\n");
4253 args.flags |= AIM_IMFLAGS_HASICON;
4254 bi->ico_me_len = args.iconlen;
4255 bi->ico_me_csum = args.iconsum;
4256 bi->ico_me_time = args.iconstamp;
4257 bi->ico_informed = TRUE;
4258 }
4259
4260 purple_imgstore_unref(img);
4261 }
4321 4262
4322 args.destsn = name; 4263 args.destsn = name;
4323 4264
4324 /* 4265 /*
4325 * If we're IMing an SMS user or an ICQ user from an ICQ account, then strip HTML. 4266 * If we're IMing an SMS user or an ICQ user from an ICQ account, then strip HTML.
4789 PurpleAccount *account; 4730 PurpleAccount *account;
4790 PurpleGroup *g; 4731 PurpleGroup *g;
4791 PurpleBuddy *b; 4732 PurpleBuddy *b;
4792 struct aim_ssi_item *curitem; 4733 struct aim_ssi_item *curitem;
4793 guint32 tmp; 4734 guint32 tmp;
4794 const char *icon_path; 4735 PurpleStoredImage *img;
4795 char *cached_icon_path;
4796 va_list ap; 4736 va_list ap;
4797 guint16 fmtver, numitems; 4737 guint16 fmtver, numitems;
4798 guint32 timestamp; 4738 guint32 timestamp;
4799 4739
4800 gc = od->gc; 4740 gc = od->gc;
5023 /* 4963 /*
5024 * Make sure our server-stored icon is updated correctly in 4964 * Make sure our server-stored icon is updated correctly in
5025 * the event that the local user set a new icon while this 4965 * the event that the local user set a new icon while this
5026 * account was offline. 4966 * account was offline.
5027 */ 4967 */
5028 icon_path = purple_account_get_buddy_icon(account); 4968 img = purple_buddy_icons_find_account_icon(account);
5029 cached_icon_path = purple_buddy_icons_get_full_path(icon_path); 4969 oscar_set_icon(gc, img);
5030 oscar_set_icon(gc, cached_icon_path); 4970 purple_imgstore_unref(img);
5031 g_free(cached_icon_path);
5032 4971
5033 return 1; 4972 return 1;
5034 } 4973 }
5035 4974
5036 static int purple_ssi_parseack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 4975 static int purple_ssi_parseack(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {
5631 if (!flap_connection_getbytype(od, SNAC_FAMILY_BART) && !od->iconconnecting) { 5570 if (!flap_connection_getbytype(od, SNAC_FAMILY_BART) && !od->iconconnecting) {
5632 od->iconconnecting = TRUE; 5571 od->iconconnecting = TRUE;
5633 od->set_icon = TRUE; 5572 od->set_icon = TRUE;
5634 aim_srv_requestnew(od, SNAC_FAMILY_BART); 5573 aim_srv_requestnew(od, SNAC_FAMILY_BART);
5635 } else { 5574 } else {
5636 struct stat st; 5575 PurpleAccount *account = purple_connection_get_account(gc);
5637 char *iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(purple_connection_get_account(gc))); 5576 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account);
5638 if (iconfile == NULL) { 5577 if (img == NULL) {
5639 aim_ssi_delicon(od); 5578 aim_ssi_delicon(od);
5640 } else if (!g_stat(iconfile, &st)) {
5641 guchar *buf = g_malloc(st.st_size);
5642 FILE *file = g_fopen(iconfile, "rb");
5643 if (file) {
5644 /* XXX - Use g_file_get_contents()? */
5645 fread(buf, 1, st.st_size, file);
5646 fclose(file);
5647 purple_debug_info("oscar",
5648 "Uploading icon to icon server\n");
5649 aim_bart_upload(od, buf, st.st_size);
5650 } else
5651 purple_debug_error("oscar",
5652 "Can't open buddy icon file!\n");
5653 g_free(buf);
5654 } else { 5579 } else {
5655 purple_debug_error("oscar", 5580
5656 "Can't stat buddy icon file!\n"); 5581 purple_debug_info("oscar",
5582 "Uploading icon to icon server\n");
5583 aim_bart_upload(od, purple_imgstore_get_data(img),
5584 purple_imgstore_get_size(img));
5585 purple_imgstore_unref(img);
5657 } 5586 }
5658 g_free(iconfile);
5659 } 5587 }
5660 } else if (flags == 0x81) { 5588 } else if (flags == 0x81) {
5661 char *iconfile = purple_buddy_icons_get_full_path(purple_account_get_buddy_icon(purple_connection_get_account(gc))); 5589 PurpleAccount *account = purple_connection_get_account(gc);
5662 if (iconfile == NULL) 5590 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account);
5591 if (img == NULL)
5663 aim_ssi_delicon(od); 5592 aim_ssi_delicon(od);
5664 else { 5593 else {
5665 aim_ssi_seticon(od, md5, length); 5594 aim_ssi_seticon(od, md5, length);
5666 g_free(iconfile); 5595 purple_imgstore_unref(img);
5667 } 5596 }
5668 } 5597 }
5669 } break; 5598 } break;
5670 5599
5671 case 0x0002: { /* We just set an "available" message? */ 5600 case 0x0002: { /* We just set an "available" message? */
6251 { 6180 {
6252 PurpleConnection *gc = (PurpleConnection *) action->context; 6181 PurpleConnection *gc = (PurpleConnection *) action->context;
6253 purple_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); 6182 purple_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1");
6254 } 6183 }
6255 6184
6256 void oscar_set_icon(PurpleConnection *gc, const char *iconfile) 6185 void oscar_set_icon(PurpleConnection *gc, PurpleStoredImage *img)
6257 { 6186 {
6258 OscarData *od = gc->proto_data; 6187 OscarData *od = gc->proto_data;
6259 FILE *file; 6188
6260 struct stat st; 6189 if (img == NULL) {
6261
6262 if (iconfile == NULL) {
6263 aim_ssi_delicon(od); 6190 aim_ssi_delicon(od);
6264 } else if (!g_stat(iconfile, &st)) { 6191 } else {
6265 guchar *buf = g_malloc(st.st_size); 6192 PurpleCipher *cipher;
6266 file = g_fopen(iconfile, "rb"); 6193 PurpleCipherContext *context;
6267 if (file) 6194 guchar md5[16];
6268 { 6195 gconstpointer data = purple_imgstore_get_data(img);
6269 PurpleCipher *cipher; 6196 size_t len = purple_imgstore_get_size(img);
6270 PurpleCipherContext *context; 6197
6271 guchar md5[16]; 6198
6272 int len; 6199 cipher = purple_ciphers_find_cipher("md5");
6273 6200 context = purple_cipher_context_new(cipher, NULL);
6274 /* XXX - Use g_file_get_contents()? */ 6201 purple_cipher_context_append(context, data, len);
6275 len = fread(buf, 1, st.st_size, file); 6202 purple_cipher_context_digest(context, 16, md5, NULL);
6276 fclose(file); 6203 purple_cipher_context_destroy(context);
6277 6204
6278 cipher = purple_ciphers_find_cipher("md5"); 6205 aim_ssi_seticon(od, md5, 16);
6279 context = purple_cipher_context_new(cipher, NULL); 6206 }
6280 purple_cipher_context_append(context, buf, len);
6281 purple_cipher_context_digest(context, 16, md5, NULL);
6282 purple_cipher_context_destroy(context);
6283
6284 aim_ssi_seticon(od, md5, 16);
6285 } else
6286 purple_debug_error("oscar",
6287 "Can't open buddy icon file!\n");
6288 g_free(buf);
6289 } else
6290 purple_debug_error("oscar", "Can't stat buddy icon file!\n");
6291 } 6207 }
6292 6208
6293 /** 6209 /**
6294 * Called by the Purple core to determine whether or not we're 6210 * Called by the Purple core to determine whether or not we're
6295 * allowed to send a file to this user. 6211 * allowed to send a file to this user.