summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-27 18:39:07 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-27 18:39:07 +0300
commit7eaccc7d1af879e2a8c58364ca0c11816225dfe0 (patch)
treebdef114c786c6f372da0b76317d58c5373534e8d /plugins/Clist_modern
parent7352a4a4329f0d91f6b69da785891f917d261827 (diff)
there's no need to load contacts from unloaded protocols
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/modern_awaymsg.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_cachefuncs.cpp34
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp14
-rw-r--r--plugins/Clist_modern/src/modern_clist.h1
-rw-r--r--plugins/Clist_modern/src/modern_clistmod.cpp6
-rw-r--r--plugins/Clist_modern/src/modern_clistsettings.cpp22
7 files changed, 40 insertions, 41 deletions
diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp
index 9b999c37b0..811e95a5de 100644
--- a/plugins/Clist_modern/src/modern_awaymsg.cpp
+++ b/plugins/Clist_modern/src/modern_awaymsg.cpp
@@ -98,7 +98,7 @@ static void amThreadProc(void *)
ack.hContact = hContact;
ack.type = ACKTYPE_AWAYMSG;
ack.result = ACKRESULT_FAILED;
- ack.szModule = pdnce->m_pszProto;
+ ack.szModule = pdnce->szProto;
ClcDoProtoAck(&ack);
}
amRequestTick = time;
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp
index 50056ee3df..97dc946890 100644
--- a/plugins/Clist_modern/src/modern_cachefuncs.cpp
+++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp
@@ -187,9 +187,9 @@ void CSmileyString::ReplaceSmileys(ClcData *dat, ClcCacheEntry *pdnce, wchar_t *
sp.cbSize = sizeof(sp);
if (dat->text_use_protocol_smileys) {
- sp.Protocolname = pdnce->m_pszProto;
+ sp.Protocolname = pdnce->szProto;
- if (db_get_b(0, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_pszProto != nullptr && mir_strcmp(pdnce->m_pszProto, META_PROTO) == 0) {
+ if (db_get_b(0, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->szProto != nullptr && mir_strcmp(pdnce->szProto, META_PROTO) == 0) {
MCONTACT hContact = db_mc_getMostOnline(pdnce->hContact);
if (hContact != 0)
sp.Protocolname = GetContactProto(hContact);
@@ -280,9 +280,9 @@ int GetStatusName(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xstat
if (nStatus == ID_STATUS_OFFLINE || nStatus == 0) noXstatus = TRUE;
text[0] = '\0';
// Get XStatusName
- if (!noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto) {
+ if (!noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->szProto) {
DBVARIANT dbv = { 0 };
- if (!db_get_ws(pdnce->hContact, pdnce->m_pszProto, "XStatusName", &dbv)) {
+ if (!db_get_ws(pdnce->hContact, pdnce->szProto, "XStatusName", &dbv)) {
//mir_wstrncpy(text, dbv.pszVal, text_size);
CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1);
db_free(&dbv);
@@ -300,9 +300,9 @@ int GetStatusName(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xstat
}
// Get XStatusName
- if (!noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto) {
+ if (!noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->hContact && pdnce->szProto) {
DBVARIANT dbv = { 0 };
- if (!db_get_ws(pdnce->hContact, pdnce->m_pszProto, "XStatusName", &dbv)) {
+ if (!db_get_ws(pdnce->hContact, pdnce->szProto, "XStatusName", &dbv)) {
CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1);
db_free(&dbv);
@@ -324,7 +324,7 @@ void GetListeningTo(wchar_t *text, int text_size, ClcCacheEntry *pdnce)
if (pdnce->m_iStatus == ID_STATUS_OFFLINE || pdnce->m_iStatus == 0)
return;
- ptrW tszValue(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "ListeningTo"));
+ ptrW tszValue(db_get_wsa(pdnce->hContact, pdnce->szProto, "ListeningTo"));
if (tszValue != nullptr)
CopySkipUnprintableChars(text, tszValue, text_size - 1);
}
@@ -344,8 +344,8 @@ int GetStatusMessage(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xs
noAwayMsg = TRUE;
// Get XStatusMsg
- if (!noAwayMsg && xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto) {
- ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg"));
+ if (!noAwayMsg && xstatus_has_priority && pdnce->hContact && pdnce->szProto) {
+ ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->szProto, "XStatusMsg"));
if (tszXStatusMsg != nullptr) {
CopySkipUnprintableChars(text, tszXStatusMsg, text_size - 1);
if (text[0] != '\0')
@@ -364,9 +364,9 @@ int GetStatusMessage(wchar_t *text, int text_size, ClcCacheEntry *pdnce, BOOL xs
}
// Get XStatusMsg
- if (!noAwayMsg && !xstatus_has_priority && pdnce->hContact && pdnce->m_pszProto && text[0] == '\0') {
+ if (!noAwayMsg && !xstatus_has_priority && pdnce->hContact && pdnce->szProto && text[0] == '\0') {
// Try to get XStatusMsg
- ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg"));
+ ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->szProto, "XStatusMsg"));
if (tszXStatusMsg != nullptr) {
CopySkipUnprintableChars(text, tszXStatusMsg, text_size - 1);
if (text[0] != '\0')
@@ -391,7 +391,7 @@ int Cache_GetLineText(ClcCacheEntry *pdnce, int type, LPTSTR text, int text_size
LBL_Status:
if (GetStatusName(text, text_size, pdnce, line.xstatus_has_priority) == -1 && line.use_name_and_message_for_xstatus) {
// Try to get XStatusMsg
- ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "XStatusMsg"));
+ ptrW tszXStatusMsg(db_get_wsa(pdnce->hContact, pdnce->szProto, "XStatusMsg"));
if (tszXStatusMsg != nullptr && tszXStatusMsg[0] != 0) {
wchar_t *tmp = NEWWSTR_ALLOCA(text);
mir_snwprintf(text, text_size, L"%s: %s", tmp, tszXStatusMsg);
@@ -401,8 +401,8 @@ LBL_Status:
return TEXT_STATUS;
case TEXT_NICKNAME:
- if (pdnce->hContact && pdnce->m_pszProto) {
- ptrW tszNick(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "Nick"));
+ if (pdnce->hContact && pdnce->szProto) {
+ ptrW tszNick(db_get_wsa(pdnce->hContact, pdnce->szProto, "Nick"));
if (tszNick != nullptr) {
mir_wstrncpy(text, tszNick, text_size);
CopySkipUnprintableChars(text, text, text_size - 1);
@@ -413,7 +413,7 @@ LBL_Status:
case TEXT_STATUS_MESSAGE:
if (GetStatusMessage(text, text_size, pdnce, line.xstatus_has_priority) == -1 && line.use_name_and_message_for_xstatus) {
// Try to get XStatusName
- ptrW tszXStatusName(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "XStatusName"));
+ ptrW tszXStatusName(db_get_wsa(pdnce->hContact, pdnce->szProto, "XStatusName"));
if (tszXStatusName != nullptr && tszXStatusName[0] != 0) {
wchar_t *tmp = NEWWSTR_ALLOCA(text);
mir_snwprintf(text, text_size, L"%s: %s", tszXStatusName, tmp);
@@ -422,7 +422,7 @@ LBL_Status:
}
else if (line.use_name_and_message_for_xstatus && line.xstatus_has_priority) {
// Try to get XStatusName
- ptrW tszXStatusName(db_get_wsa(pdnce->hContact, pdnce->m_pszProto, "XStatusName"));
+ ptrW tszXStatusName(db_get_wsa(pdnce->hContact, pdnce->szProto, "XStatusName"));
if (tszXStatusName != nullptr && tszXStatusName[0] != 0) {
mir_wstrncpy(text, tszXStatusName, text_size);
CopySkipUnprintableChars(text, text, text_size - 1);
@@ -477,7 +477,7 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact)
wchar_t *name = pcli->pfnGetContactDisplayName(contact->hContact, 0);
if (dat->first_line_append_nick && !dat->bForceInDialog) {
DBVARIANT dbv = { 0 };
- if (!db_get_ws(pdnce->hContact, pdnce->m_pszProto, "Nick", &dbv)) {
+ if (!db_get_ws(pdnce->hContact, pdnce->szProto, "Nick", &dbv)) {
wchar_t nick[_countof(contact->szText)];
mir_wstrncpy(nick, dbv.ptszVal, _countof(contact->szText));
db_free(&dbv);
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index fddd7390cc..a5853658ac 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -1507,7 +1507,7 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM
ClcContact *contact;
if (Clist_FindItem(hwnd, dat, wParam, &contact, nullptr, nullptr)) { /////////////////// ??
ClcCacheEntry *pdnce = contact->pce;
- if (pdnce && pdnce->m_pszProto) {
+ if (pdnce && pdnce->szProto) {
if (!dat->bForceInDialog) {
Cache_GetNthLineText(dat, pdnce, 2);
Cache_GetNthLineText(dat, pdnce, 3);
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index c60058c1bc..7e8cccfdd3 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -61,7 +61,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup)
p.iImage = corecli.pfnGetContactIcon(pdnce->hContact);
memset(p.iExtraImage, 0xFF, sizeof(p.iExtraImage));
- p.proto = pdnce->m_pszProto;
+ p.proto = pdnce->szProto;
p.type = CLCIT_CONTACT;
p.flags = 0;
p.iSubNumber = i + 1;
@@ -71,7 +71,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup)
Cache_GetTimezone(dat, (&p)->hContact);
Cache_GetText(dat, &p);
- char *szProto = pdnce->m_pszProto;
+ char *szProto = pdnce->szProto;
if (szProto != nullptr && !pcli->pfnIsHiddenMode(dat, wStatus))
p.flags |= CONTACTF_ONLINE;
int apparentMode = szProto != nullptr ? pdnce->ApparentMode : 0;
@@ -116,7 +116,7 @@ static void _LoadDataToContact(ClcContact *cont, ClcCacheEntry *pdnce, ClcGroup
if (!cont)
return;
- char *szProto = pdnce->m_pszProto;
+ char *szProto = pdnce->szProto;
cont->type = CLCIT_CONTACT;
cont->pce = pdnce;
@@ -182,7 +182,7 @@ void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int update
if (dat->IsMetaContactsEnabled && pdnce->m_bIsSub)
return; //contact should not be added
- if (!dat->IsMetaContactsEnabled && !mir_strcmp(pdnce->m_pszProto, META_PROTO))
+ if (!dat->IsMetaContactsEnabled && !mir_strcmp(pdnce->szProto, META_PROTO))
return;
corecli.pfnAddContactToTree(hwnd, dat, hContact, updateTotalCount, checkHideOffline);
@@ -325,12 +325,12 @@ ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact)
return nullptr;
pdnce->hContact = hContact;
- pdnce->m_pszProto = GetContactProto(hContact);
+ pdnce->szProto = GetContactProto(hContact);
pdnce->bIsHidden = db_get_b(hContact, "CList", "Hidden", 0);
pdnce->m_bIsSub = db_mc_isSub(hContact) != 0;
pdnce->m_bNoHiddenOffline = db_get_b(hContact, "CList", "noOffline", 0);
- pdnce->IdleTS = db_get_dw(hContact, pdnce->m_pszProto, "IdleTS", 0);
- pdnce->ApparentMode = db_get_w(hContact, pdnce->m_pszProto, "ApparentMode", 0);
+ pdnce->IdleTS = db_get_dw(hContact, pdnce->szProto, "IdleTS", 0);
+ pdnce->ApparentMode = db_get_w(hContact, pdnce->szProto, "ApparentMode", 0);
pdnce->NotOnList = db_get_b(hContact, "CList", "NotOnList", 0);
pdnce->IsExpanded = db_get_b(hContact, "CList", "Expanded", 0);
pdnce->dwLastMsgTime = -1;
diff --git a/plugins/Clist_modern/src/modern_clist.h b/plugins/Clist_modern/src/modern_clist.h
index 18c4748486..0c87e3a518 100644
--- a/plugins/Clist_modern/src/modern_clist.h
+++ b/plugins/Clist_modern/src/modern_clist.h
@@ -76,7 +76,6 @@ struct ClcCacheEntry : public ClcCacheEntryBase
int m_bNoHiddenOffline;
int m_iStatus;
- char* m_pszProto;
bool m_bIsSub;
bool m_bIsUnknown;
diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp
index c977d85886..650bd4181a 100644
--- a/plugins/Clist_modern/src/modern_clistmod.cpp
+++ b/plugins/Clist_modern/src/modern_clistmod.cpp
@@ -79,8 +79,8 @@ int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact)
MCONTACT hMostOnlineContact = db_mc_getMostOnline(hActContact);
if (hMostOnlineContact) {
ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hMostOnlineContact);
- if (cacheEntry && cacheEntry->m_pszProto) {
- szActProto = cacheEntry->m_pszProto;
+ if (cacheEntry && cacheEntry->szProto) {
+ szActProto = cacheEntry->szProto;
nActStatus = cacheEntry->m_iStatus;
hActContact = hMostOnlineContact;
}
@@ -115,7 +115,7 @@ int cli_GetContactIcon(MCONTACT hContact)
int GetContactIconC(ClcCacheEntry *p)
{
- return pcli->pfnIconFromStatusMode(p->m_pszProto, p->m_pszProto == nullptr ? ID_STATUS_OFFLINE : p->m_iStatus, p->hContact);
+ return pcli->pfnIconFromStatusMode(p->szProto, p->szProto == nullptr ? ID_STATUS_OFFLINE : p->m_iStatus, p->hContact);
}
//lParam
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp
index 4a692a154d..f2d6136c4d 100644
--- a/plugins/Clist_modern/src/modern_clistsettings.cpp
+++ b/plugins/Clist_modern/src/modern_clistsettings.cpp
@@ -47,9 +47,9 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce)
return;
}
- if (pdnce->m_pszProto == nullptr) {
- pdnce->m_pszProto = GetContactProto(pdnce->hContact);
- if (pdnce->m_pszProto && pdnce->tszName)
+ if (pdnce->szProto == nullptr) {
+ pdnce->szProto = GetContactProto(pdnce->hContact);
+ if (pdnce->szProto && pdnce->tszName)
mir_free_and_nil(pdnce->tszName);
}
@@ -59,7 +59,7 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce)
}
if (pdnce->m_iStatus == 0) //very strange look status sort is broken let always reread status
- pdnce->m_iStatus = GetStatusForContact(pdnce->hContact, pdnce->m_pszProto);
+ pdnce->m_iStatus = GetStatusForContact(pdnce->hContact, pdnce->szProto);
// this variable isn't filled inside cliCreateCacheItem() because the filter could be changed dynamically
if (pdnce->dwLastMsgTime == -1 && g_CluiData.bFilterEffective & (CLVM_FILTER_LASTMSG | CLVM_FILTER_LASTMSG_NEWERTHAN | CLVM_FILTER_LASTMSG_OLDERTHAN)) {
@@ -80,7 +80,7 @@ int GetContactInfosForSort(MCONTACT hContact, char **Proto, wchar_t **Name, int
{
ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact);
if (cacheEntry != nullptr) {
- if (Proto != nullptr) *Proto = cacheEntry->m_pszProto;
+ if (Proto != nullptr) *Proto = cacheEntry->szProto;
if (Name != nullptr) *Name = cacheEntry->tszName;
if (Status != nullptr) *Status = cacheEntry->m_iStatus;
}
@@ -120,11 +120,11 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
}
- if (pdnce->m_pszProto == nullptr)
+ if (pdnce->szProto == nullptr)
return 0;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
- if (!strcmp(cws->szModule, pdnce->m_pszProto)) {
+ if (!strcmp(cws->szModule, pdnce->szProto)) {
if (!strcmp(cws->szSetting, "Status")) {
pdnce->m_iStatus = cws->value.wVal;
if (pdnce->bIsHidden)
@@ -134,7 +134,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
if (g_CluiData.bRemoveAwayMessageForOffline)
db_set_s(hContact, "CList", "StatusMsg", "");
- if ((db_get_w(0, "CList", "SecondLineType", 0) == TEXT_STATUS_MESSAGE || db_get_w(0, "CList", "ThirdLineType", 0) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_pszProto)
+ if ((db_get_w(0, "CList", "SecondLineType", 0) == TEXT_STATUS_MESSAGE || db_get_w(0, "CList", "ThirdLineType", 0) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->szProto)
amRequestAwayMsg(hContact);
Clist_Broadcast(INTM_STATUSCHANGED, hContact, 0);
@@ -143,7 +143,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
if (pcli->hwndContactTree && g_flag_bOnModulesLoadedCalled)
pcli->pfnInitAutoRebuild(pcli->hwndContactTree);
- if ((db_get_w(0, "CList", "SecondLineType", SETTING_SECONDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE || db_get_w(0, "CList", "ThirdLineType", SETTING_THIRDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_pszProto)
+ if ((db_get_w(0, "CList", "SecondLineType", SETTING_SECONDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE || db_get_w(0, "CList", "ThirdLineType", SETTING_THIRDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->szProto)
amRequestAwayMsg(hContact);
}
else if (!strcmp(cws->szSetting, "ApparentMode"))
@@ -170,7 +170,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
else if (!strcmp(cws->szSetting, "Hidden")) {
pdnce->bIsHidden = cws->value.bVal;
if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0)
- pcli->pfnChangeContactIcon(hContact, pcli->pfnIconFromStatusMode(pdnce->m_pszProto, pdnce->getStatus(), hContact));
+ pcli->pfnChangeContactIcon(hContact, pcli->pfnIconFromStatusMode(pdnce->szProto, pdnce->getStatus(), hContact));
Clist_Broadcast(CLM_AUTOREBUILD, 0, 0);
}
@@ -181,7 +181,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
}
else if (!strcmp(cws->szModule, "Protocol")) {
if (!strcmp(cws->szSetting, "p")) {
- pdnce->m_pszProto = GetContactProto(hContact);
+ pdnce->szProto = GetContactProto(hContact);
char *szProto = (cws->value.type == DBVT_DELETED) ? nullptr : cws->value.pszVal;
pcli->pfnChangeContactIcon(hContact, pcli->pfnIconFromStatusMode(szProto, pdnce->getStatus(), hContact));
}