we can use purple_accounts_delete with spectrum2. it does not have so bad performance with < 100 accounts
This commit is contained in:
parent
19786b3bb7
commit
eb6eed3b79
1 changed files with 44 additions and 38 deletions
|
@ -298,48 +298,54 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
|
|||
purple_account_disconnect(account);
|
||||
purple_account_set_enabled(account, "spectrum", FALSE);
|
||||
|
||||
// Remove conversations.
|
||||
// This has to be called before m_account->ui_data = NULL;, because it uses
|
||||
// ui_data to call SpectrumMessageHandler::purpleConversationDestroyed() callback.
|
||||
GList *iter;
|
||||
for (iter = purple_get_conversations(); iter; ) {
|
||||
PurpleConversation *conv = (PurpleConversation*) iter->data;
|
||||
iter = iter->next;
|
||||
if (purple_conversation_get_account(conv) == account)
|
||||
purple_conversation_destroy(conv);
|
||||
}
|
||||
|
||||
g_free(account->ui_data);
|
||||
account->ui_data = NULL;
|
||||
m_accounts.erase(account);
|
||||
|
||||
purple_notify_close_with_handle(account);
|
||||
purple_request_close_with_handle(account);
|
||||
|
||||
purple_accounts_remove(account);
|
||||
|
||||
GSList *buddies = purple_find_buddies(account, NULL);
|
||||
while(buddies) {
|
||||
PurpleBuddy *b = (PurpleBuddy *) buddies->data;
|
||||
purple_blist_remove_buddy(b);
|
||||
buddies = g_slist_delete_link(buddies, buddies);
|
||||
}
|
||||
|
||||
/* Remove any open conversation for this account */
|
||||
for (GList *it = purple_get_conversations(); it; ) {
|
||||
PurpleConversation *conv = (PurpleConversation *) it->data;
|
||||
it = it->next;
|
||||
if (purple_conversation_get_account(conv) == account)
|
||||
purple_conversation_destroy(conv);
|
||||
}
|
||||
|
||||
/* Remove this account's pounces */
|
||||
// purple_pounce_destroy_all_by_account(account);
|
||||
|
||||
/* This will cause the deletion of an old buddy icon. */
|
||||
purple_buddy_icons_set_account_icon(account, NULL, 0);
|
||||
|
||||
purple_account_destroy(account);
|
||||
purple_accounts_delete(account);
|
||||
//
|
||||
// // Remove conversations.
|
||||
// // This has to be called before m_account->ui_data = NULL;, because it uses
|
||||
// // ui_data to call SpectrumMessageHandler::purpleConversationDestroyed() callback.
|
||||
// GList *iter;
|
||||
// for (iter = purple_get_conversations(); iter; ) {
|
||||
// PurpleConversation *conv = (PurpleConversation*) iter->data;
|
||||
// iter = iter->next;
|
||||
// if (purple_conversation_get_account(conv) == account)
|
||||
// purple_conversation_destroy(conv);
|
||||
// }
|
||||
//
|
||||
// g_free(account->ui_data);
|
||||
// account->ui_data = NULL;
|
||||
// m_accounts.erase(account);
|
||||
//
|
||||
// purple_notify_close_with_handle(account);
|
||||
// purple_request_close_with_handle(account);
|
||||
//
|
||||
// purple_accounts_remove(account);
|
||||
//
|
||||
// GSList *buddies = purple_find_buddies(account, NULL);
|
||||
// while(buddies) {
|
||||
// PurpleBuddy *b = (PurpleBuddy *) buddies->data;
|
||||
// purple_blist_remove_buddy(b);
|
||||
// buddies = g_slist_delete_link(buddies, buddies);
|
||||
// }
|
||||
//
|
||||
// /* Remove any open conversation for this account */
|
||||
// for (GList *it = purple_get_conversations(); it; ) {
|
||||
// PurpleConversation *conv = (PurpleConversation *) it->data;
|
||||
// it = it->next;
|
||||
// if (purple_conversation_get_account(conv) == account)
|
||||
// purple_conversation_destroy(conv);
|
||||
// }
|
||||
//
|
||||
// /* Remove this account's pounces */
|
||||
// // purple_pounce_destroy_all_by_account(account);
|
||||
//
|
||||
// /* This will cause the deletion of an old buddy icon. */
|
||||
// purple_buddy_icons_set_account_icon(account, NULL, 0);
|
||||
//
|
||||
// purple_account_destroy(account);
|
||||
// force returning of memory chunks allocated by libxml2 to kernel
|
||||
malloc_trim(0);
|
||||
// VALGRIND_DO_LEAK_CHECK;
|
||||
|
|
Loading…
Add table
Reference in a new issue