Changeset - eb6eed3b79be
[Not reviewed]
0 1 0
HanzZ - 14 years ago 2011-09-26 21:48:19
hanzz.k@gmail.com
we can use purple_accounts_delete with spectrum2. it does not have so bad performance with < 100 accounts
1 file changed with 44 insertions and 38 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/main.cpp
Show inline comments
 
@@ -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;
0 comments (0 inline, 0 general)