summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-27 19:17:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-27 19:17:59 +0000
commitec35bbd307636ded865626eb13584e4ab0b9a4af (patch)
tree24b68bfb7574a763ed5ebcfb56e5c6b86d047324 /plugins
parent0800db775a4da41507478a02fa8cb9e58f35b0c9 (diff)
direct access to MetaContacts/IsSubcontact removed everywhere
git-svn-id: http://svn.miranda-ng.org/main/trunk@8312 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/AVS/src/cache.cpp4
-rw-r--r--plugins/BasicHistory/src/HistoryWindow.cpp17
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clistsettings.cpp7
-rw-r--r--plugins/Clist_nicer/src/clc.cpp7
-rw-r--r--plugins/Clist_nicer/src/clcitems.cpp2
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp39
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp2
-rw-r--r--plugins/UserInfoEx/src/mir_db.cpp4
9 files changed, 31 insertions, 53 deletions
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp
index 472c03e1a2..37c42cb00d 100644
--- a/plugins/AVS/src/cache.cpp
+++ b/plugins/AVS/src/cache.cpp
@@ -127,7 +127,7 @@ CacheNode *FindAvatarInCache(MCONTACT hContact, BOOL add, BOOL findAny)
foundNode->ace.hContact = hContact;
if (g_MetaAvail)
- foundNode->dwFlags |= (db_get_b(hContact, g_szMetaName, "IsSubcontact", 0) ? MC_ISSUBCONTACT : 0);
+ foundNode->dwFlags |= (db_mc_isSub(hContact) ? MC_ISSUBCONTACT : 0);
foundNode->loaded = FALSE;
foundNode->mustLoad = 1; // pic loader will watch this and load images
SetEvent(hLoaderEvent); // wake him up
@@ -210,7 +210,7 @@ void DeleteAvatarFromCache(MCONTACT hContact, BOOL forever)
if (node == NULL) {
struct CacheNode temp_node = {0};
if (g_MetaAvail)
- temp_node.dwFlags |= (db_get_b(hContact, g_szMetaName, "IsSubcontact", 0) ? MC_ISSUBCONTACT : 0);
+ temp_node.dwFlags |= (db_mc_isSub(hContact) ? MC_ISSUBCONTACT : 0);
NotifyMetaAware(hContact, &temp_node, (AVATARCACHEENTRY *)GetProtoDefaultAvatar(hContact));
return;
}
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp
index 19b39af3bf..4236372df8 100644
--- a/plugins/BasicHistory/src/HistoryWindow.cpp
+++ b/plugins/BasicHistory/src/HistoryWindow.cpp
@@ -1634,28 +1634,23 @@ void HistoryWindow::EnableWindows(BOOL enable)
void HistoryWindow::ReloadContacts()
{
HWND contactList = GetDlgItem(hWnd,IDC_LIST_CONTACTS);
- if (EventList::GetContactMessageNumber(NULL))
- {
- if (hSystem == NULL)
- {
- CLCINFOITEM cii = { 0 };
- cii.cbSize = sizeof(cii);
+ if (EventList::GetContactMessageNumber(NULL)) {
+ if (hSystem == NULL) {
+ CLCINFOITEM cii = { sizeof(cii) };
cii.flags = CLCIIF_GROUPFONT | CLCIIF_BELOWCONTACTS;
cii.pszText = TranslateT("System");
hSystem = (MCONTACT)SendMessage(contactList, CLM_ADDINFOITEM, 0, (LPARAM) & cii);
}
}
- else
- {
- if (hSystem != NULL)
- {
+ else {
+ if (hSystem != NULL) {
SendMessage(contactList, CLM_DELETEITEM, (WPARAM)hSystem, 0);
hSystem = NULL;
}
}
for (MCONTACT _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) {
- if (EventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || db_get_b(_hContact, metaContactProto, "IsSubcontact", 0) == 0)) {
+ if (EventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || !db_mc_isSub(_hContact))) {
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
if (hItem == NULL)
SendMessage(contactList, CLM_ADDCONTACT, (WPARAM)_hContact, 0);
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index 66c970a140..8c3e0e8845 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -698,7 +698,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, Clc
BOOL fEmbedded = dat->force_in_dialog;
// always hide subcontacts (but show them on embedded contact lists)
- if (g_CluiData.bMetaAvail && dat != NULL && dat->IsMetaContactsEnabled && g_szMetaModuleName && db_get_b(hContact, g_szMetaModuleName, "IsSubcontact", 0))
+ if (g_CluiData.bMetaAvail && dat != NULL && dat->IsMetaContactsEnabled && db_mc_isSub(hContact))
return -1; //subcontact
if (pdnce && pdnce->isUnknown && !fEmbedded)
return 1; //'Unknown Contact'
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp
index bf06c8efda..46cde88cca 100644
--- a/plugins/Clist_modern/src/modern_clistsettings.cpp
+++ b/plugins/Clist_modern/src/modern_clistsettings.cpp
@@ -259,7 +259,7 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce)
if (pdnce->bIsHidden == -1)
pdnce->bIsHidden = db_get_b(pdnce->hContact,"CList","Hidden",0);
- pdnce->m_cache_nHiddenSubcontact = g_szMetaModuleName && db_get_b(pdnce->hContact,g_szMetaModuleName,"IsSubcontact",0);
+ pdnce->m_cache_nHiddenSubcontact = g_szMetaModuleName && db_mc_isSub(pdnce->hContact);
if (pdnce->m_cache_nNoHiddenOffline == -1)
pdnce->m_cache_nNoHiddenOffline = db_get_b(pdnce->hContact,"CList","noOffline",0);
@@ -441,8 +441,9 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
if (!strcmp(cws->szModule, pdnce->m_cache_cszProto)) {
InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type);
- if (!strcmp(cws->szSetting,"IsSubcontact"))
- PostMessage(pcli->hwndContactTree,CLM_AUTOREBUILD, 0, 0);
+ // !!!!!!!!!!!!!!!!!!!!!!!
+ // if (!strcmp(cws->szSetting,"IsSubcontact"))
+ // PostMessage(pcli->hwndContactTree,CLM_AUTOREBUILD, 0, 0);
if (!mir_strcmp(cws->szSetting, "Status") || wildcmp(cws->szSetting, "Status?")) {
if (g_szMetaModuleName && !mir_strcmp(cws->szModule,g_szMetaModuleName) && mir_strcmp(cws->szSetting, "Status")) {
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp
index 9a21399db8..72a9b69df4 100644
--- a/plugins/Clist_nicer/src/clc.cpp
+++ b/plugins/Clist_nicer/src/clc.cpp
@@ -156,8 +156,9 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, hContact, lParam);
}
}
- if (cfg::dat.bMetaAvail && cfg::dat.bMetaEnabled && !__strcmp(cws->szModule, cfg::dat.szMetaName) && !__strcmp(cws->szSetting, "IsSubcontact"))
- pcli->pfnClcBroadcast(INTM_HIDDENCHANGED, hContact, lParam);
+ // !!!!!!!!!!!!!!!!!!
+ // if (cfg::dat.bMetaAvail && cfg::dat.bMetaEnabled && !__strcmp(cws->szModule, cfg::dat.szMetaName) && !__strcmp(cws->szSetting, "IsSubcontact"))
+ // pcli->pfnClcBroadcast(INTM_HIDDENCHANGED, hContact, lParam);
}
}
else if (!__strcmp(cws->szModule, cfg::dat.szMetaName)) {
@@ -563,7 +564,7 @@ LBL_Def:
if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL)) {
p = cfg::getCache(hContact, szProto);
if (!dat->bisEmbedded && cfg::dat.bMetaAvail && szProto) { // may be a subcontact, forward the xstatus
- if (cfg::getByte(hContact, cfg::dat.szMetaName, "IsSubcontact", 0)) {
+ if (db_mc_isSub(hContact)) {
MCONTACT hMasterContact = (MCONTACT)cfg::getDword(hContact, cfg::dat.szMetaName, "Handle", 0);
if (hMasterContact && hMasterContact != hContact) // avoid recursive call of settings handler
cfg::writeByte(hMasterContact, cfg::dat.szMetaName, "XStatusId",
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp
index f6f42bbb47..15564ba4ac 100644
--- a/plugins/Clist_nicer/src/clcitems.cpp
+++ b/plugins/Clist_nicer/src/clcitems.cpp
@@ -473,7 +473,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, str
// always hide subcontacts (but show them on embedded contact lists)
- if (cfg::dat.bMetaAvail && dat != NULL && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && cfg::getByte(hContact, cfg::dat.szMetaName, "IsSubcontact", 0))
+ if (cfg::dat.bMetaAvail && dat != NULL && dat->bHideSubcontacts && cfg::dat.bMetaEnabled && db_mc_isSub(hContact))
return 1;
if ( !cfg::dat.bFilterEffective)
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index 0f86c1779a..4cdd3c4296 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -210,7 +210,7 @@ tstring CAppletManager::TranslateString(TCHAR *szString,...)
va_list body;
va_start(body, szString);
- _vstprintf(out, szTranslatedString, body);
+ _vstprintf_s(out, SIZEOF(out), szTranslatedString, body);
va_end(body);
return out;
}
@@ -251,14 +251,13 @@ bool CAppletManager::Update()
// Screensaver detection
BOOL bActive = false;
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &bActive, 0);
- if(bActive != m_bScreensaver)
+ if(bActive != (BOOL)m_bScreensaver)
{
if(CConfig::GetBoolSetting(SCREENSAVER_LOCK)) {
- if(!m_bScreensaver) {
+ if(!m_bScreensaver)
ActivateScreensaverScreen();
- } else {
+ else
ActivateEventScreen();
- }
}
if(CConfig::GetBoolSetting(CONTROL_BACKLIGHTS)) {
if(GetLCDConnection() &&
@@ -289,7 +288,7 @@ bool CAppletManager::Update()
}
}
}
- m_bScreensaver = bActive;
+ m_bScreensaver = bActive != 0;
}
return true;
@@ -763,10 +762,7 @@ bool CAppletManager::IsSubContact(MCONTACT hContact)
{
if(!db_get_b(0, "MetaContacts", "Enabled", 1))
return false;
- bool bIsSubcontact = db_get_b(hContact,"MetaContacts","IsSubcontact",0) != 0;
- return bIsSubcontact;
- // HANDLE hMetaContact = (HANDLE)CallService(MS_MC_GETMETACONTACT, hContact, NULL);
- // return hMetaContact != NULL;
+ return db_mc_isSub(hContact) != 0;
}
//************************************************************************
@@ -856,7 +852,7 @@ HANDLE CAppletManager::SendMessageToContact(MCONTACT hContact,tstring strMessage
char* szMsgUtf = NULL;
szMsgUtf = mir_utf8encodeW( strMessage.c_str());
- pJob->iBufferSize = strlen(szMsgUtf)+1;
+ pJob->iBufferSize = (int)strlen(szMsgUtf)+1;
pJob->pcBuffer = (char *)malloc(pJob->iBufferSize);
pJob->dwFlags = PREF_UTF;
@@ -969,10 +965,9 @@ bool CAppletManager::TranslateDBEvent(CEvent *pEvent,WPARAM wParam, LPARAM lPara
tstring strName = CAppletManager::GetContactDisplayname(hContact,true);
- switch(dbevent.eventType)
- {
+ switch(dbevent.eventType) {
case EVENTTYPE_MESSAGE:
- msglen = strlen((char *) dbevent.pBlob) + 1;
+ msglen = (int)strlen((char *) dbevent.pBlob) + 1;
if (dbevent.flags & DBEF_UTF) {
pEvent->strValue = Utf8_Decode((char*)dbevent.pBlob);
} else if ((int) dbevent.cbBlob == msglen*3){
@@ -1660,8 +1655,7 @@ int CAppletManager::HookStatusChanged(WPARAM wParam, LPARAM lParam)
Event.strSummary = TranslateString(_T("Contactlist event"));
// Block notifications after connecting/disconnecting
- if(pProtocolData->iStatus == ID_STATUS_OFFLINE ||
- pProtocolData->lTimeStamp + PROTOCOL_NOTIFY_DELAY > GetTickCount())
+ if(pProtocolData->iStatus == ID_STATUS_OFFLINE || (DWORD)pProtocolData->lTimeStamp + PROTOCOL_NOTIFY_DELAY > GetTickCount())
Event.bNotification = false;
//CAppletManager::GetInstance()->ActivateNotificationScreen(&Event);
@@ -1816,18 +1810,7 @@ int CAppletManager::HookSettingChanged(WPARAM hContact,LPARAM lParam)
CEvent Event;
Event.hContact = hContact;
- if(!lstrcmpA(dbcws->szModule,"MetaContacts")) {
- if(!lstrcmpA(dbcws->szSetting,"IsSubcontact")) {
- Event.eType = EVENT_CONTACT_GROUP;
- DBVARIANT dbv;
- int res = db_get_ts(hContact, "CList", "Group", &dbv);
- if(!res)
- Event.strValue = dbv.ptszVal;
- db_free(&dbv);
- }
- else return 0;
- }
- else if(!lstrcmpA(dbcws->szSetting,"Nick") || !lstrcmpA(dbcws->szSetting,"MyHandle")) {
+ if(!lstrcmpA(dbcws->szSetting,"Nick") || !lstrcmpA(dbcws->szSetting,"MyHandle")) {
DBVARIANT dbv={0};
// if the protocol nick has changed, check if a custom handle is set
if(!lstrcmpA(dbcws->szSetting,"Nick")) {
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index 94597d25d5..9076fe0499 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -73,7 +73,7 @@ void CContactCache::initPhaseTwo()
m_Valid = (m_szProto != 0 && m_szAccount != 0) ? true : false;
if (m_Valid) {
m_isMeta = PluginConfig.bMetaEnabled && !strcmp(m_szProto, PluginConfig.szMetaName);
- m_isSubcontact = db_get_b(m_hContact, PluginConfig.szMetaName, "IsSubcontact", 0) != 0;
+ m_isSubcontact = db_mc_isSub(m_hContact) != 0;
if (m_isMeta)
updateMeta(true);
updateState();
diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp
index bdbb776594..48cc65751d 100644
--- a/plugins/UserInfoEx/src/mir_db.cpp
+++ b/plugins/UserInfoEx/src/mir_db.cpp
@@ -48,9 +48,7 @@ MCONTACT Sub(MCONTACT hMetaContact, int idx)
bool IsSub(MCONTACT hContact)
{
- return myGlobals.szMetaProto &&
- db_get_b(NULL, myGlobals.szMetaProto, "Enabled", TRUE) &&
- db_get_b(hContact, myGlobals.szMetaProto, "IsSubcontact", FALSE);
+ return db_mc_isSub(hContact);
}
MCONTACT GetMeta(MCONTACT hContact)