summaryrefslogtreecommitdiff
path: root/plugins/RecentContacts/src/RecentContacts.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-06-04 21:59:58 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-06-04 21:59:58 +0300
commit0407b43e6cab29046775ecaf73b31f2a7ee3b95b (patch)
treebb0d1fb085700db001de1f497821abe46872e86f /plugins/RecentContacts/src/RecentContacts.cpp
parent767337d1f7c5f53762cb2278dc47cb3729a586c3 (diff)
RecentContacts: we better skip old events
Diffstat (limited to 'plugins/RecentContacts/src/RecentContacts.cpp')
-rw-r--r--plugins/RecentContacts/src/RecentContacts.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp
index ea91373e63..c707f81ed1 100644
--- a/plugins/RecentContacts/src/RecentContacts.cpp
+++ b/plugins/RecentContacts/src/RecentContacts.cpp
@@ -378,6 +378,13 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
return FALSE;
}
+static __time64_t GetLastUsedTimeStamp(MCONTACT hContact)
+{
+ return
+ ((__time64_t)db_get_dw(hContact, MODULENAME, dbLastUC_LastUsedTimeLo, -1)) |
+ (((__time64_t)db_get_dw(hContact, MODULENAME, dbLastUC_LastUsedTimeHi, -1)) << 32);
+}
+
INT_PTR OnMenuCommandShowList(WPARAM, LPARAM)
{
cmultimap *contacts = new cmultimap;
@@ -387,8 +394,7 @@ INT_PTR OnMenuCommandShowList(WPARAM, LPARAM)
dbe.pBlob = buf;
for (MCONTACT curContact = db_find_first(); curContact != NULL; curContact = db_find_next(curContact)) {
- __time64_t curTime = ((__time64_t)db_get_dw(curContact, MODULENAME, dbLastUC_LastUsedTimeLo, -1)) |
- (((__time64_t)db_get_dw(curContact, MODULENAME, dbLastUC_LastUsedTimeHi, -1)) << 32);
+ __time64_t curTime = GetLastUsedTimeStamp(curContact);
MEVENT curEvent = db_event_last(curContact);
if (curEvent != NULL) {
@@ -472,8 +478,12 @@ static int OnGCInEvent(WPARAM, LPARAM lParam)
GCEVENT *gce = (GCEVENT*)lParam;
if (gce->pDest->iType == GC_EVENT_MESSAGE) {
SESSION_INFO *si = pci->SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si && si->hContact)
+ if (si && si->hContact) {
+ // skip old events
+ if (gce->time && gce->time <= GetLastUsedTimeStamp(si->hContact))
+ return 0;
SaveLastUsedTimeStamp(si->hContact);
+ }
}
return 0;
}