diff options
-rw-r--r-- | include/delphi/m_metacontacts.inc | 4 | ||||
-rw-r--r-- | plugins/AVS/src/cache.cpp | 4 | ||||
-rw-r--r-- | plugins/BasicHistory/src/HistoryWindow.cpp | 17 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistsettings.cpp | 7 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clc.cpp | 7 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clcitems.cpp | 2 | ||||
-rw-r--r-- | plugins/MirandaG15/src/CAppletManager.cpp | 39 | ||||
-rw-r--r-- | plugins/TabSRMM/src/contactcache.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/mir_db.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skype.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skype.h | 1 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_menu.cpp | 2 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_services.cpp | 2 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_utils.cpp | 7 |
15 files changed, 36 insertions, 70 deletions
diff --git a/include/delphi/m_metacontacts.inc b/include/delphi/m_metacontacts.inc index 53afbd5850..7ad2bf77d4 100644 --- a/include/delphi/m_metacontacts.inc +++ b/include/delphi/m_metacontacts.inc @@ -163,12 +163,12 @@ const { returns true if a contact is a metacontact or false otherwise
}
-function db_mc_isMeta(hContact:MCONTACT):Boolean; stdcall;
+function db_mc_isMeta(hContact:MCONTACT):Integer; stdcall;
external CoreDLL name 'db_mc_isMeta';
{ returns true if a contact is a subcontact or false otherwise
}
-function db_mc_isSub(hContact:MCONTACT):Boolean; stdcall;
+function db_mc_isSub(hContact:MCONTACT):Integer; stdcall;
external CoreDLL name 'db_mc_isSub';
{$ENDIF}
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)
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 2f464287cd..2880f4102a 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -1306,13 +1306,11 @@ void FetchMessageThread(fetchmsg_arg *pargs) { // really bad on importing history for example, as all messages would be added with current
// timestamp. This would cause unreliable jumbled timestamps in metacontact, so we better do this
// ourself.
- if (db_get_b(hContact, "MetaContacts", "IsSubcontact", 0))
- {
+ if (db_mc_isSub(hContact)) {
DWORD dwMetaLink = db_get_dw(hContact, "MetaContacts", "MetaLink", MAXDWORD);
MCONTACT hMetaContact;
- if (dwMetaLink != MAXDWORD && (hMetaContact = GetMetaHandle(dwMetaLink)))
- {
+ if (dwMetaLink != MAXDWORD && (hMetaContact = GetMetaHandle(dwMetaLink))) {
dbei.szModule=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hMetaContact, 0);
pme->hMetaEvent = db_event_add(hMetaContact, &dbei);
}
diff --git a/protocols/SkypeClassic/src/skype.h b/protocols/SkypeClassic/src/skype.h index 5cd87986dd..a07ce410f1 100644 --- a/protocols/SkypeClassic/src/skype.h +++ b/protocols/SkypeClassic/src/skype.h @@ -42,6 +42,7 @@ #include <m_userinfo.h>
#include <m_avatars.h>
#include <m_contacts.h>
+#include <m_metacontacts.h>
#include <m_popup.h>
#pragma warning (pop)
diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp index 545042a443..7fbcf128a7 100644 --- a/src/modules/metacontacts/meta_menu.cpp +++ b/src/modules/metacontacts/meta_menu.cpp @@ -129,7 +129,6 @@ void Meta_RemoveContactNumber(MCONTACT hMeta, int number) // make sure this contact thinks it's part of this metacontact
if ((MCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0) == hMeta) {
// remove link to meta contact
- db_unset(hContact, META_PROTO, "IsSubcontact");
db_unset(hContact, META_PROTO, META_LINK);
db_unset(hContact, META_PROTO, "Handle");
db_unset(hContact, META_PROTO, "ContactNumber");
@@ -228,7 +227,6 @@ INT_PTR Meta_Delete(WPARAM wParam, LPARAM lParam) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
// This contact is assigned to the MetaContact that will be deleted, clear the "MetaContacts" information
if (db_get_dw(hContact, META_PROTO, META_LINK, (DWORD)-1) == metaID) {
- db_unset(hContact, META_PROTO, "IsSubcontact");
db_unset(hContact, META_PROTO, META_LINK);
db_unset(hContact, META_PROTO, "Handle");
db_unset(hContact, META_PROTO, "ContactNumber");
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index f718756750..7d6bd1228e 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -768,8 +768,6 @@ int Meta_ContactDeleted(WPARAM wParam, LPARAM lParam) for (int i = 0; i < num_contacts; i++) {
MCONTACT hContact = Meta_GetContactHandle(wParam, i);
if (hContact && (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0) == (HANDLE)wParam) {
- if (db_get_b(hContact, META_PROTO, "IsSubcontact", 0) == 1)
- db_unset(hContact, META_PROTO, "IsSubcontact");
db_unset(hContact, META_PROTO, META_LINK);
db_unset(hContact, META_PROTO, "Handle");
db_unset(hContact, META_PROTO, "ContactNumber");
diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp index 8a307bbb6c..1f5530fc19 100644 --- a/src/modules/metacontacts/meta_utils.cpp +++ b/src/modules/metacontacts/meta_utils.cpp @@ -331,7 +331,6 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default) NotifyEventHooks(hEventDefaultChanged, (WPARAM)dest, (LPARAM)src);
}
- db_set_b(src, META_PROTO, "IsSubcontact", 1);
// set nick to most online contact that can message
most_online = Meta_GetMostOnline(dest);
Meta_CopyContactNick(dest, most_online);
@@ -766,7 +765,6 @@ int Meta_SetHandles(void) MessageBox(0, TranslateT("Subcontact's MetaContact not found - deleting MetaContact data"), nick_buffer, MB_OK | MB_ICONERROR);
// delete meta data
- db_unset(hContact, META_PROTO, "IsSubcontact");
db_unset(hContact, META_PROTO, META_LINK);
db_unset(hContact, META_PROTO, "Handle");
db_unset(hContact, META_PROTO, "ContactNumber");
@@ -776,11 +774,6 @@ int Meta_SetHandles(void) // stop ignoring, if we were
if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, hContact, (WPARAM)IGNOREEVENT_USERONLINE);
-
- }
- else {
- if (!db_get_b(hContact, META_PROTO, "IsSubcontact", 0))
- db_set_b(hContact, META_PROTO, "IsSubcontact", 1);
}
}
else db_unset(hContact, META_PROTO, "Handle");
|