From 72b7008d4d971d220035532350c49cd8297f5b9b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 31 Mar 2014 18:52:40 +0000 Subject: new kosher version of the contacts' deleter (when account is being deleted) git-svn-id: http://svn.miranda-ng.org/main/trunk@8808 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/protocols/protoaccs.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 9fd416ad78..e5142abb10 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -260,11 +260,9 @@ static int UninitializeStaticAccounts(WPARAM, LPARAM) int LoadAccountsModule(void) { - int i; - bModuleInitialized = TRUE; - for (i=0; i < accounts.getCount(); i++) { + for (int i=0; i < accounts.getCount(); i++) { PROTOACCOUNT *pa = accounts[i]; pa->bDynDisabled = !Proto_IsProtocolLoaded(pa->szProtoName); if (pa->ppro) @@ -544,14 +542,10 @@ void DeactivateAccount(PROTOACCOUNT *pa, bool bIsDynamic, bool bErase) void EraseAccount(const char* pszModuleName) { // remove protocol contacts first - MCONTACT hContact = db_find_first(); - while (hContact != NULL) { - MCONTACT h1 = hContact; - hContact = db_find_next(h1); - - char *szProto = GetContactProto(hContact); - if (szProto != NULL && !lstrcmpA(szProto, pszModuleName)) - CallService(MS_DB_CONTACT_DELETE, (WPARAM)h1, 0); + for (MCONTACT hContact = db_find_first(pszModuleName); hContact != NULL;) { + MCONTACT hNext = db_find_next(hContact, pszModuleName); + CallService(MS_DB_CONTACT_DELETE, hContact, 0); + hContact = hNext; } // remove all protocol settings -- cgit v1.2.3