From 3dc0d9b0b7c30ea2f77d74c4ce5b6ccd67bd525c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Apr 2013 21:40:22 +0000 Subject: - the kernel filters out contacts by proto names much faster than a plugin; - database cycles simplified git-svn-id: http://svn.miranda-ng.org/main/trunk@4404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SeenPlugin/src/utils.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'plugins/SeenPlugin') diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 41c4271955..22f41290f9 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -653,20 +653,14 @@ int UpdateValues(WPARAM wparam,LPARAM lparam) static void cleanThread(void *param) { logthread_info* infoParam = (logthread_info*)param; + char *szProto = infoParam->sProtoName; // I hope in 10 secons all logged-in contacts will be listed if ( WaitForSingleObject(g_hShutdownEvent, 10000) == WAIT_TIMEOUT) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - char *contactProto = GetContactProto(hContact); - if (!contactProto) - continue; - - if ( strncmp(infoParam->sProtoName, contactProto, MAXMODULELABELLENGTH)) - continue; - + for (HANDLE hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) { WORD oldStatus = db_get_w(hContact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE) | 0x8000; if (oldStatus > ID_STATUS_OFFLINE) { - if (db_get_w(hContact,contactProto,"Status",ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE){ + if (db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE){ db_set_w(hContact,S_MOD,"OldStatus",(WORD)(oldStatus|0x8000)); if (includeIdle)db_set_b(hContact,S_MOD,"OldIdle",(BYTE)((oldStatus&0x8000)?0:1)); db_set_w(hContact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE); -- cgit v1.2.3