From 1d9fd398b75a5a6eca9d40db2e2abb60c96ebc7d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 17 May 2013 19:23:37 +0000 Subject: some more fixes for MS_DB_CONTACT_DELETE & loops git-svn-id: http://svn.miranda-ng.org/main/trunk@4710 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/StopSpamPlus/src/services.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'plugins/StopSpamPlus') diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index 43470f8de7..c6ea59fe31 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -22,19 +22,17 @@ INT_PTR IsContactPassed(WPARAM wParam, LPARAM /*lParam*/) INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - DBVARIANT dbv = { 0 }; - if ( db_get_ts( hContact, "CList", "Group", &dbv )) - dbv.ptszVal = NULL; + for (HANDLE hContact = db_find_first(); hContact; ) { + HANDLE hNext = db_find_next(hContact); + ptrT szGroup( db_get_tsa( hContact, "CList", "Group")); - if ( db_get_b(hContact, "CList", "NotOnList", 0) || db_get_b(hContact, "CList", "Hidden", 0 ) || (dbv.ptszVal != NULL && (_tcsstr(dbv.ptszVal, _T("Not In List")) || _tcsstr(dbv.ptszVal, TranslateT("Not In List"))))) { + if ( db_get_b(hContact, "CList", "NotOnList", 0) || db_get_b(hContact, "CList", "Hidden", 0 ) || (szGroup != NULL && (_tcsstr(szGroup, _T("Not In List")) || _tcsstr(szGroup, TranslateT("Not In List"))))) { char *szProto = GetContactProto(hContact); - if ( szProto != NULL ) { + if (szProto != NULL) { // Check if protocol uses server side lists DWORD caps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0); if ( caps & PF1_SERVERCLIST ) { - int status; - status = CallProtoService(szProto, PS_GETSTATUS, 0, 0); + int status = CallProtoService(szProto, PS_GETSTATUS, 0, 0); if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) // Set a flag so we remember to delete the contact when the protocol goes online the next time db_set_b( hContact, "CList", "Delete", 1 ); @@ -44,7 +42,7 @@ INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam) } } - db_free( &dbv ); + hContact = hNext; } int hGroup = 1; -- cgit v1.2.3