diff options
-rw-r--r-- | plugins/Clist_modern/src/modern_awaymsg.cpp | 5 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 14 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clist.h | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistsettings.cpp | 40 |
4 files changed, 19 insertions, 42 deletions
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index b6a4b81260..f154958a56 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -102,10 +102,7 @@ static void amThreadProc(void *) ack.hContact = hContact;
ack.type = ACKTYPE_AWAYMSG;
ack.result = ACKRESULT_FAILED;
- if (dnce.m_cache_cszProto)
- ack.szModule = dnce.m_cache_cszProto;
- else
- ack.szModule = NULL;
+ ack.szModule = dnce.m_cache_cszProto;
ClcDoProtoAck(hContact, &ack);
}
CListSettings_FreeCacheItemData(&dnce);
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index f080b24bc5..679c5deb81 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -616,18 +616,18 @@ ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact) return NULL; p->hContact = hContact; - InvalidateDNCEbyPointer(hContact, p, 0); -
+ p->m_cache_cszProto = GetContactProto(hContact); + if (p->m_cache_cszProto == NULL) { + mir_free(p); + return NULL; + } + + p->dwLastMsgTime = -1;
p->bIsHidden = -1;
p->m_cache_nNoHiddenOffline = -1;
p->IdleTS = -1;
p->NotOnList = -1;
p->IsExpanded = -1;
-
- p->szSecondLineText = NULL; - p->szThirdLineText = NULL; - p->ssSecondLine.plText = NULL; - p->ssThirdLine.plText = NULL; return p; } diff --git a/plugins/Clist_modern/src/modern_clist.h b/plugins/Clist_modern/src/modern_clist.h index 222fb7753d..54360157f7 100644 --- a/plugins/Clist_modern/src/modern_clist.h +++ b/plugins/Clist_modern/src/modern_clist.h @@ -78,7 +78,7 @@ struct ClcCacheEntry : public ClcCacheEntryBase int m_cache_nStatus;
char* m_cache_cszProto;
- bool m_bProtoNotExists, m_bIsSub;
+ bool m_bIsSub;
bool isUnknown;
int ApparentMode;
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 0934d0af3e..723237e800 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -38,8 +38,6 @@ LIST<ClcCacheEntry> clistCache(50, NumericKeySortT); int GetStatusForContact(MCONTACT hContact, char *szProto);
TCHAR* UnknownConctactTranslatedName = NULL;
-void InvalidateDNCEbyPointer(MCONTACT hContact, ClcCacheEntry *pdnce, int SettingType);
-
void InitDisplayNameCache(void)
{
InitCacheAsync();
@@ -133,7 +131,6 @@ void CListSettings_CopyCacheItems(ClcCacheEntry *pDst, ClcCacheEntry *pSrc, DWOR if (flag & CCI_OTHER) {
pDst->bIsHidden = pSrc->bIsHidden;
pDst->m_cache_nNoHiddenOffline = pSrc->m_cache_nNoHiddenOffline;
- pDst->m_bProtoNotExists = pSrc->m_bProtoNotExists;
pDst->m_bIsSub = pSrc->m_bIsSub;
pDst->ApparentMode = pSrc->ApparentMode;
@@ -191,34 +188,22 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) return;
}
- if (pdnce->m_cache_cszProto == NULL && pdnce->m_bProtoNotExists == FALSE) {
+ if (pdnce->m_cache_cszProto == NULL) {
pdnce->m_cache_cszProto = GetContactProto(pdnce->hContact);
- if (pdnce->m_cache_cszProto == NULL)
- pdnce->m_bProtoNotExists = FALSE;
- else if (pdnce->m_cache_cszProto && pdnce->tszName)
+ if (pdnce->m_cache_cszProto && pdnce->tszName)
pdnce->freeName();
}
if (pdnce->tszName == NULL)
pdnce->getName();
- else if (pdnce->isUnknown && pdnce->m_cache_cszProto && pdnce->m_bProtoNotExists == TRUE && g_flag_bOnModulesLoadedCalled) {
- if (Proto_GetAccount(pdnce->m_cache_cszProto) == NULL) {
- pdnce->m_bProtoNotExists = FALSE;
- pdnce->getName();
- }
- }
-
if (pdnce->m_cache_nStatus == 0) //very strange look status sort is broken let always reread status
pdnce->m_cache_nStatus = GetStatusForContact(pdnce->hContact, pdnce->m_cache_cszProto);
if (pdnce->tszGroup == NULL) {
- DBVARIANT dbv = { 0 };
- if (!db_get_ts(pdnce->hContact, "CList", "Group", &dbv)) {
- pdnce->tszGroup = mir_tstrdup(dbv.ptszVal);
- db_free(&dbv);
- }
- else pdnce->tszGroup = mir_tstrdup(_T(""));
+ pdnce->tszGroup = db_get_tsa(pdnce->hContact, "CList", "Group");
+ if (pdnce->tszGroup == NULL)
+ pdnce->tszGroup = mir_tstrdup(_T(""));
}
if (pdnce->bIsHidden == -1)
@@ -278,26 +263,21 @@ void InvalidateDNCEbyPointer(MCONTACT hContact, ClcCacheEntry *pdnce, int Settin if (SettingType >= DBVT_WCHAR) {
pdnce->freeName();
mir_free_and_nil(pdnce->tszGroup);
- pdnce->m_cache_cszProto = NULL;
return;
}
if (SettingType == -1 || SettingType == DBVT_DELETED) {
pdnce->freeName();
mir_free_and_nil(pdnce->tszGroup);
- pdnce->m_cache_cszProto = NULL;
}
- // in other cases clear all binary cache
- else pdnce->dwLastMsgTime = -1;
- pdnce->m_bIsSub = pdnce->m_bProtoNotExists = false;
+ pdnce->m_bIsSub = false;
pdnce->m_cache_nStatus = 0;
}
-char *GetContactCachedProtocol(MCONTACT hContact)
+char* GetContactCachedProtocol(MCONTACT hContact)
{
- ClcCacheEntry *cacheEntry = NULL;
- cacheEntry = pcli->pfnGetCacheEntry(hContact);
+ ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact);
if (cacheEntry && cacheEntry->m_cache_cszProto)
return cacheEntry->m_cache_cszProto;
@@ -322,7 +302,7 @@ void ClcCacheEntry::getName() {
freeName();
- if (m_bProtoNotExists || !m_cache_cszProto) {
+ if (m_cache_cszProto == NULL) {
LBL_Unknown:
tszName = UnknownConctactTranslatedName;
isUnknown = true;
@@ -385,7 +365,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
}
- if (pdnce->m_bProtoNotExists || !pdnce->m_cache_cszProto)
+ if (pdnce->m_cache_cszProto == NULL)
return 0;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
|