From 109877a3c75cb290c55755dcfc88794d2453669d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 30 Mar 2013 17:32:39 +0000 Subject: MS_DB_EVENT_* services remained, but their calls removed git-svn-id: http://svn.miranda-ng.org/main/trunk@4255 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/RecentContacts/src/RecentContacts.cpp | 46 ++++++++++----------------- 1 file changed, 16 insertions(+), 30 deletions(-) (limited to 'plugins/RecentContacts/src') diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index c68219706b..8099152f09 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -382,39 +382,25 @@ INT_PTR OnMenuCommandShowList(WPARAM wParam, LPARAM lParam) HANDLE curContact = db_find_first(); for (; curContact != NULL; curContact = db_find_next(curContact)) { -// if (IsMessageAPI) - { - curTime = ((__time64_t)db_get_dw(curContact, dbLastUC_ModuleName, dbLastUC_LastUsedTimeLo, -1)) | - (((__time64_t)db_get_dw(curContact, dbLastUC_ModuleName, dbLastUC_LastUsedTimeHi, -1)) << 32); - //use TabSRMM last used time. ! NOT used, because bug: TabSRMM reset last used time to time when miranda started at miranda start! - //t = ((DWORD)db_get_dw(curContact, "Tab_SRMsg", "isRecent", -1)); - //if (t != -1) - //{ - // if (curTime == -1 || (__time64_t)t > curTime) - // curTime = (__time64_t)t; - //} - } -// else - { - curEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)curContact, 0); - if (curEvent != NULL) - { - for ( ; curEvent != NULL; curEvent = (HANDLE)CallService(MS_DB_EVENT_FINDPREV, (WPARAM)curEvent, 0)) - { - dbe.cbBlob = 1; - if (CallService(MS_DB_EVENT_GET, (WPARAM)curEvent, (LPARAM)&dbe) != 0) - { - curEvent = NULL; - break; - } - if ((dbe.flags & (DBEF_READ | DBEF_SENT)) && dbe.eventType < 2000) - break; + curTime = ((__time64_t)db_get_dw(curContact, dbLastUC_ModuleName, dbLastUC_LastUsedTimeLo, -1)) | + (((__time64_t)db_get_dw(curContact, dbLastUC_ModuleName, dbLastUC_LastUsedTimeHi, -1)) << 32); + + curEvent = db_event_last(curContact); + if (curEvent != NULL) { + for ( ; curEvent != NULL; curEvent = db_event_prev(curEvent)) { + dbe.cbBlob = 1; + if (db_event_get(curEvent, &dbe) != 0) { + curEvent = NULL; + break; } - if (curEvent != NULL) - if (curTime == -1 || (__time64_t)dbe.timestamp > curTime) - curTime = (__time64_t)dbe.timestamp; + if ((dbe.flags & (DBEF_READ | DBEF_SENT)) && dbe.eventType < 2000) + break; } + if (curEvent != NULL) + if (curTime == -1 || (__time64_t)dbe.timestamp > curTime) + curTime = (__time64_t)dbe.timestamp; } + if (curTime != -1) contacts->insert(cpair(curTime, curContact)); } -- cgit v1.2.3