comparison libpurple/blist.c @ 24806:8fb78d30ea83

We have a prpl function "buddy_free" that I don't think any of our in-tree prpls use, and it wasn't called from anywhere. But the facebook prpl uses it to free data associated with each buddy. I think it makes sense to call this function. In the future it would probably be cleaner to have prpls attach to a signal or something.
author Mark Doliner <mark@kingant.net>
date Thu, 18 Dec 2008 02:03:20 +0000
parents 123c78e48663
children fbfbebc9197e 4e8748f3374f
comparison
equal deleted inserted replaced
24805:22fd7467f0cc 24806:8fb78d30ea83
1808 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); 1808 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
1809 PurpleBlistNode *node, *cnode, *gnode; 1809 PurpleBlistNode *node, *cnode, *gnode;
1810 PurpleContact *contact; 1810 PurpleContact *contact;
1811 PurpleGroup *group; 1811 PurpleGroup *group;
1812 struct _purple_hbuddy hb; 1812 struct _purple_hbuddy hb;
1813 PurplePlugin *prpl;
1814 PurplePluginProtocolInfo *prpl_info;
1813 1815
1814 g_return_if_fail(buddy != NULL); 1816 g_return_if_fail(buddy != NULL);
1815 1817
1816 node = (PurpleBlistNode *)buddy; 1818 node = (PurpleBlistNode *)buddy;
1817 cnode = node->parent; 1819 cnode = node->parent;
1862 if (ops && ops->remove) 1864 if (ops && ops->remove)
1863 ops->remove(purplebuddylist, node); 1865 ops->remove(purplebuddylist, node);
1864 1866
1865 /* Signal that the buddy has been removed before freeing the memory for it */ 1867 /* Signal that the buddy has been removed before freeing the memory for it */
1866 purple_signal_emit(purple_blist_get_handle(), "buddy-removed", buddy); 1868 purple_signal_emit(purple_blist_get_handle(), "buddy-removed", buddy);
1869
1870 /*
1871 * Tell the owner PRPL that we're about to free the buddy so it
1872 * can free proto_data
1873 */
1874 prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account));
1875 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
1876 if (prpl_info && prpl_info->buddy_free)
1877 prpl_info->buddy_free(buddy);
1867 1878
1868 /* Delete the node */ 1879 /* Delete the node */
1869 purple_buddy_icon_unref(buddy->icon); 1880 purple_buddy_icon_unref(buddy->icon);
1870 g_hash_table_destroy(buddy->node.settings); 1881 g_hash_table_destroy(buddy->node.settings);
1871 purple_presence_destroy(buddy->presence); 1882 purple_presence_destroy(buddy->presence);