| 503 |
503 |
| 504 if (icon != NULL) |
504 if (icon != NULL) |
| 505 purple_buddy_icon_set_data(icon, icon_data, icon_len, checksum); |
505 purple_buddy_icon_set_data(icon, icon_data, icon_len, checksum); |
| 506 else if (icon_data && icon_len > 0) |
506 else if (icon_data && icon_len > 0) |
| 507 { |
507 { |
| 508 if (icon_data != NULL && icon_len > 0) |
508 PurpleBuddyIcon *icon = purple_buddy_icon_new(account, username, icon_data, icon_len, checksum); |
| 509 { |
509 |
| 510 PurpleBuddyIcon *icon = purple_buddy_icon_new(account, username, icon_data, icon_len, checksum); |
510 /* purple_buddy_icon_new() calls |
| 511 |
511 * purple_buddy_icon_set_data(), which calls |
| 512 /* purple_buddy_icon_new() calls |
512 * purple_buddy_icon_update(), which has the buddy list |
| 513 * purple_buddy_icon_set_data(), which calls |
513 * and conversations take references as appropriate. |
| 514 * purple_buddy_icon_update(), which has the buddy list |
514 * This function doesn't return icon, so we can't |
| 515 * and conversations take references as appropriate. |
515 * leave a reference dangling. */ |
| 516 * This function doesn't return icon, so we can't |
516 purple_buddy_icon_unref(icon); |
| 517 * leave a reference dangling. */ |
517 } |
| 518 purple_buddy_icon_unref(icon); |
518 else |
| 519 } |
519 { |
| 520 else |
520 /* If the buddy list or a conversation was holding a |
| 521 { |
521 * reference, we'd have found the icon in the cache. |
| 522 /* If the buddy list or a conversation was holding a |
522 * Since we know we're deleting the icon, we only |
| 523 * reference, we'd have found the icon in the cache. |
523 * need a subset of purple_buddy_icon_update(). */ |
| 524 * Since we know we're deleting the icon, we only |
524 |
| 525 * need a subset of purple_buddy_icon_update(). */ |
525 GSList *buddies = purple_find_buddies(account, username); |
| 526 |
526 while (buddies != NULL) |
| 527 GSList *buddies = purple_find_buddies(account, username); |
527 { |
| 528 while (buddies != NULL) |
528 PurpleBuddy *buddy = (PurpleBuddy *)buddies->data; |
| 529 { |
529 |
| 530 PurpleBuddy *buddy = (PurpleBuddy *)buddies->data; |
530 unref_filename(purple_blist_node_get_string((PurpleBlistNode *)buddy, "buddy_icon")); |
| 531 |
531 purple_blist_node_remove_setting((PurpleBlistNode *)buddy, "buddy_icon"); |
| 532 unref_filename(purple_blist_node_get_string((PurpleBlistNode *)buddy, "buddy_icon")); |
532 purple_blist_node_remove_setting((PurpleBlistNode *)buddy, "icon_checksum"); |
| 533 purple_blist_node_remove_setting((PurpleBlistNode *)buddy, "buddy_icon"); |
533 |
| 534 purple_blist_node_remove_setting((PurpleBlistNode *)buddy, "icon_checksum"); |
534 buddies = g_slist_delete_link(buddies, buddies); |
| 535 |
|
| 536 buddies = g_slist_delete_link(buddies, buddies); |
|
| 537 } |
|
| 538 |
|
| 539 } |
535 } |
| 540 } |
536 } |
| 541 } |
537 } |
| 542 |
538 |
| 543 char *purple_buddy_icon_get_full_path(PurpleBuddyIcon *icon) |
539 char *purple_buddy_icon_get_full_path(PurpleBuddyIcon *icon) |