From 85179f507a34f211dccfdf96913caaf8bd8f637a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 12 Mar 2014 15:17:01 +0000 Subject: clist_modern's cache is dark and full of terrors... git-svn-id: http://svn.miranda-ng.org/main/trunk@8580 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clc.cpp | 2 +- plugins/Clist_modern/src/modern_clcitems.cpp | 3 +-- plugins/Clist_modern/src/modern_clistsettings.cpp | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 6cd90055ba..9f4bf199dd 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -251,8 +251,8 @@ static int clcHookDbEventAdded(WPARAM hContact, LPARAM lParam) DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get((HANDLE)lParam, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); db_set_dw(hContact, "CList", "mf_lastmsg", dbei.timestamp); + ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); if (pdnce) pdnce->dwLastMsgTime = dbei.timestamp; } diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 201ca360c1..c07816b578 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -742,8 +742,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, Clc filterResult = (g_CluiData.filterFlags & CLVM_GROUPSTATUS_OP) ? ((filterResult | ((1 << (wStatus - ID_STATUS_OFFLINE)) & g_CluiData.statusMaskFilter ? 1 : 0))) : (filterResult & ((1 << (wStatus - ID_STATUS_OFFLINE)) & g_CluiData.statusMaskFilter ? 1 : 0)); } if (g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG) { - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); - if (pdnce) { + if (pdnce && pdnce->dwLastMsgTime != -1) { DWORD now = g_CluiData.t_now; now -= g_CluiData.lastMsgFilter; if (g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG_OLDERTHAN) diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 5960f1c12e..2fe657b50c 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -251,7 +251,7 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) if (pdnce->IsExpanded == -1) pdnce->IsExpanded = db_get_b(pdnce->hContact, "CList", "Expanded", 0); - if (pdnce->dwLastMsgTime == 0) { + if (pdnce->dwLastMsgTime == -1 && g_CluiData.bFilterEffective & (CLVM_FILTER_LASTMSG | CLVM_FILTER_LASTMSG_NEWERTHAN | CLVM_FILTER_LASTMSG_OLDERTHAN)) { pdnce->dwLastMsgTime = db_get_dw(pdnce->hContact, "CList", "mf_lastmsg", 0); if (pdnce->dwLastMsgTime == 0) pdnce->dwLastMsgTime = CompareContacts2_getLMTime(pdnce->hContact); @@ -280,7 +280,7 @@ void InvalidateDNCEbyPointer(MCONTACT hContact, ClcCacheEntry *pdnce, int Settin pdnce->ssSecondLine.iMaxSmileyHeight = 0; pdnce->ssThirdLine.iMaxSmileyHeight = 0; pdnce->hTimeZone = NULL; - pdnce->dwLastMsgTime = 0; + pdnce->dwLastMsgTime = -1; Cache_GetTimezone(NULL, pdnce->hContact); SettingType &= ~16; } @@ -298,7 +298,7 @@ void InvalidateDNCEbyPointer(MCONTACT hContact, ClcCacheEntry *pdnce, int Settin pdnce->m_cache_cszProto = NULL; } // in other cases clear all binary cache - else pdnce->dwLastMsgTime = 0; + else pdnce->dwLastMsgTime = -1; pdnce->bIsHidden = -1; pdnce->m_cache_nHiddenSubcontact = -1; -- cgit v1.2.3