comparison libpurple/buddyicon.c @ 27760:e9cf897bd873

propagate from branch 'im.pidgin.pidgin' (head ae7f8e3acb446776f833c3b44514295ae56184b3) to branch 'im.pidgin.pidgin.yaz' (head 952151791a1f3b4e3469a5621f4cfa2de608a8b8)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 30 Jan 2008 10:53:22 +0000
parents bc2e96c13556
children edca47ee06c5
comparison
equal deleted inserted replaced
27759:54479172725e 27760:e9cf897bd873
699 purple_account_set_string(account, "buddy_icon", NULL); 699 purple_account_set_string(account, "buddy_icon", NULL);
700 purple_account_set_int(account, "buddy_icon_timestamp", 0); 700 purple_account_set_int(account, "buddy_icon_timestamp", 0);
701 } 701 }
702 unref_filename(old_icon); 702 unref_filename(old_icon);
703 703
704 if (purple_account_is_connected(account))
705 {
706 PurpleConnection *gc;
707 PurplePluginProtocolInfo *prpl_info;
708
709 gc = purple_account_get_connection(account);
710 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
711
712 if (prpl_info && prpl_info->set_buddy_icon)
713 prpl_info->set_buddy_icon(gc, img);
714 }
715
716 if ((old_img = g_hash_table_lookup(pointer_icon_cache, account)))
717 purple_imgstore_unref(old_img);
718 else if (old_icon)
719 {
720 /* The old icon may not have been loaded into memory. In that
721 * case, we'll need to uncache the filename. The filenames
722 * are ref-counted, so this is safe. */
723 purple_buddy_icon_data_uncache_file(old_icon);
724 }
725 g_free(old_icon);
726
704 if (img) 727 if (img)
705 g_hash_table_insert(pointer_icon_cache, account, img); 728 g_hash_table_insert(pointer_icon_cache, account, img);
706 else 729 else
707 g_hash_table_remove(pointer_icon_cache, account); 730 g_hash_table_remove(pointer_icon_cache, account);
708
709 if (purple_account_is_connected(account))
710 {
711 PurpleConnection *gc;
712 PurplePluginProtocolInfo *prpl_info;
713
714 gc = purple_account_get_connection(account);
715 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
716
717 if (prpl_info && prpl_info->set_buddy_icon)
718 prpl_info->set_buddy_icon(gc, img);
719 }
720
721 if ((old_img = g_hash_table_lookup(pointer_icon_cache, account)))
722 purple_imgstore_unref(old_img);
723 else if (old_icon)
724 {
725 /* The old icon may not have been loaded into memory. In that
726 * case, we'll need to uncache the filename. The filenames
727 * are ref-counted, so this is safe. */
728 purple_buddy_icon_data_uncache_file(old_icon);
729 }
730 g_free(old_icon);
731 731
732 return img; 732 return img;
733 } 733 }
734 734
735 time_t 735 time_t