summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-12 18:34:27 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-12 18:34:27 +0300
commit35a2b1771115068077ce6db13860766e70405de1 (patch)
tree3c58de2e19d5b3be66eb7b74cd631ca4fcc1bba3 /src
parentfc1b90ac5521548d3062062faf72e7fc2196122e (diff)
MIDatabase became pure interface
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/meta_addto.cpp2
-rw-r--r--src/mir_app/src/meta_edit.cpp2
-rw-r--r--src/mir_app/src/meta_menu.cpp12
-rw-r--r--src/mir_app/src/meta_services.cpp10
-rw-r--r--src/mir_app/src/meta_utils.cpp8
-rw-r--r--src/mir_app/src/miranda.h4
-rw-r--r--src/mir_app/src/netliblog.cpp2
-rw-r--r--src/mir_app/src/proto_chains.cpp6
-rw-r--r--src/mir_core/src/db.cpp6
-rw-r--r--src/mir_core/src/mc.cpp10
-rw-r--r--src/mir_core/src/miranda.h2
11 files changed, 32 insertions, 32 deletions
diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp
index d44043b808..ff7a9b2dbe 100644
--- a/src/mir_app/src/meta_addto.cpp
+++ b/src/mir_app/src/meta_addto.cpp
@@ -133,7 +133,7 @@ CMetaSelectDlg::CMetaSelectDlg(MCONTACT hContact)
void CMetaSelectDlg::OnInitDialog()
{
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(m_hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(m_hContact);
if (cc == nullptr)
{
Close();
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp
index 9ebf4e1843..dfad6cdc13 100644
--- a/src/mir_app/src/meta_edit.cpp
+++ b/src/mir_app/src/meta_edit.cpp
@@ -215,7 +215,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara
TranslateDialogDefault(hwndDlg);
Window_SetIcon_IcoLib(hwndDlg, Meta_GetIconHandle(I_EDIT));
{
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(lParam);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(lParam);
if (cc == nullptr) {
DestroyWindow(hwndDlg);
return FALSE;
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp
index c12622aa60..33a0b4d7ec 100644
--- a/src/mir_app/src/meta_menu.cpp
+++ b/src/mir_app/src/meta_menu.cpp
@@ -56,7 +56,7 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM)
if (hMetaContact == 0)
return 0;
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMetaContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hMetaContact);
if (cc == nullptr)
return 0;
@@ -93,7 +93,7 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI
return;
// make sure this contact thinks it's part of this metacontact
- DBCachedContact *ccSub = currDb->m_cache->GetCachedContact(Meta_GetContactHandle(ccMeta, number));
+ DBCachedContact *ccSub = currDb->getCache()->GetCachedContact(Meta_GetContactHandle(ccMeta, number));
if (ccSub != nullptr) {
if (ccSub->parentID == ccMeta->contactID) {
db_unset(ccSub->contactID, "CList", "Hidden");
@@ -183,7 +183,7 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI
INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion)
{
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hContact);
if (cc == nullptr)
return 1;
@@ -203,7 +203,7 @@ INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion)
db_delete_contact(hContact);
}
else if (cc->IsSub()) {
- if ((cc = currDb->m_cache->GetCachedContact(cc->parentID)) == nullptr)
+ if ((cc = currDb->getCache()->GetCachedContact(cc->parentID)) == nullptr)
return 2;
if (cc->nSubs == 1) {
@@ -229,7 +229,7 @@ INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion)
INT_PTR Meta_Default(WPARAM hSub, LPARAM)
{
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(db_mc_getMeta(hSub));
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(db_mc_getMeta(hSub));
if (cc && cc->IsMeta())
db_mc_setDefault(cc->contactID, hSub, true);
return 0;
@@ -246,7 +246,7 @@ INT_PTR Meta_Default(WPARAM hSub, LPARAM)
int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
{
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMeta);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hMeta);
if (cc == nullptr)
return 0;
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index e95bb68385..86649645e4 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -128,7 +128,7 @@ static void Meta_SetSrmmSub(MCONTACT hMeta, MCONTACT hSub)
static INT_PTR MetaFilter_RecvMessage(WPARAM wParam, LPARAM lParam)
{
CCSDATA *ccs = (CCSDATA*)lParam;
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(ccs->hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(ccs->hContact);
if (cc && cc->IsSub())
Meta_SetSrmmSub(cc->parentID, cc->contactID);
@@ -329,11 +329,11 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam)
if (hContact == 0)
return 0;
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hContact);
if (cc == nullptr || !cc->IsSub())
return 0;
- DBCachedContact *ccMeta = currDb->m_cache->GetCachedContact(cc->parentID);
+ DBCachedContact *ccMeta = currDb->getCache()->GetCachedContact(cc->parentID);
if (ccMeta == nullptr || !ccMeta->IsMeta())
return 0;
@@ -455,7 +455,7 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam)
int Meta_ContactDeleted(WPARAM hContact, LPARAM)
{
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hContact);
if (cc == nullptr)
return 0;
@@ -540,7 +540,7 @@ static int Meta_MessageWindowEvent(WPARAM, LPARAM lParam)
{
MessageWindowEventData *mwed = (MessageWindowEventData*)lParam;
if (mwed->uType == MSG_WINDOW_EVT_OPEN) {
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(mwed->hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(mwed->hContact);
if (cc != nullptr) {
Meta_UpdateSrmmIcon(cc, db_get_w(cc->contactID, META_PROTO, "Status", ID_STATUS_OFFLINE));
if (cc->IsMeta()) {
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp
index 0a5058ba81..30a78d49bb 100644
--- a/src/mir_app/src/meta_utils.cpp
+++ b/src/mir_app/src/meta_utils.cpp
@@ -60,7 +60,7 @@ int Meta_SetNick(char *szProto)
BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)
{
- DBCachedContact *ccDest = CheckMeta(hMeta), *ccSub = currDb->m_cache->GetCachedContact(hSub);
+ DBCachedContact *ccDest = CheckMeta(hMeta), *ccSub = currDb->getCache()->GetCachedContact(hSub);
if (ccDest == nullptr || ccSub == nullptr)
return FALSE;
@@ -290,7 +290,7 @@ MCONTACT Meta_GetMostOnlineSupporting(DBCachedContact *cc, int pflagnum, unsigne
DBCachedContact* CheckMeta(MCONTACT hMeta)
{
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMeta);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hMeta);
return (cc == nullptr || cc->nSubs == -1) ? nullptr : cc;
}
@@ -323,7 +323,7 @@ int Meta_HideLinkedContacts(void)
char buffer[512];
for (auto &hContact : Contacts()) {
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hContact);
if (cc == nullptr || cc->parentID == 0)
continue;
@@ -388,7 +388,7 @@ int Meta_HideMetaContacts(bool bHide)
for (auto &hContact : Contacts()) {
bool bSet;
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hContact);
if (cc->IsSub()) { // show on hide, reverse flag
bSet = !bHide;
CallService(bSuppress ? MS_IGNORE_IGNORE : MS_IGNORE_UNIGNORE, hContact, IGNOREEVENT_USERONLINE);
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index e3ba1942ef..6eeeaffa46 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -183,6 +183,6 @@ HBITMAP ConvertIconToBitmap(HIMAGELIST hIml, int iconId);
extern "C"
{
MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(PLUGININFOEX* pInfo);
- MIR_CORE_DLL(int) GetSubscribersCount(HANDLE hHook);
- MIR_CORE_DLL(void) db_setCurrent(MIDatabase* _db);
+ MIR_CORE_DLL(int) GetSubscribersCount(struct THook *hHook);
+ MIR_CORE_DLL(void) db_setCurrent(MDatabaseCommon *_db);
};
diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp
index 391fb5e38f..c0d17d7b3c 100644
--- a/src/mir_app/src/netliblog.cpp
+++ b/src/mir_app/src/netliblog.cpp
@@ -422,7 +422,7 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla
return;
// Check user's log settings
- if (!(logOptions.toOutputDebugString || GetSubscribersCount(hLogEvent) != 0 || (logOptions.toFile && !logOptions.tszFile.IsEmpty())))
+ if (!(logOptions.toOutputDebugString || GetSubscribersCount((THook*)hLogEvent) != 0 || (logOptions.toFile && !logOptions.tszFile.IsEmpty())))
return;
if ((sent && !logOptions.dumpSent) || (!sent && !logOptions.dumpRecv))
return;
diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp
index 65a1e462ae..adefcd9fd4 100644
--- a/src/mir_app/src/proto_chains.cpp
+++ b/src/mir_app/src/proto_chains.cpp
@@ -29,7 +29,7 @@ static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen)
if (currDb == nullptr)
return 1;
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hContact);
if (cc && cc->szProto != nullptr) {
strncpy(szBuf, cc->szProto, cbLen);
szBuf[cbLen - 1] = 0;
@@ -44,9 +44,9 @@ static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen)
int res = currDb->GetContactSettingStatic(hContact, "Protocol", "p", &dbv);
if (res == 0) {
if (cc == nullptr)
- cc = currDb->m_cache->AddContactToCache(hContact);
+ cc = currDb->getCache()->AddContactToCache(hContact);
- cc->szProto = currDb->m_cache->GetCachedSetting(nullptr, szBuf, 0, mir_strlen(szBuf));
+ cc->szProto = currDb->getCache()->GetCachedSetting(nullptr, szBuf, 0, mir_strlen(szBuf));
}
return res;
}
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp
index fc5d570423..c4da5668d1 100644
--- a/src/mir_core/src/db.cpp
+++ b/src/mir_core/src/db.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-MIDatabase *currDb = nullptr;
+MDatabaseCommon *currDb = nullptr;
/////////////////////////////////////////////////////////////////////////////////////////
// database functions
@@ -400,7 +400,7 @@ MIR_CORE_DLL(INT_PTR) db_unset(MCONTACT hContact, const char *szModule, const ch
MIR_CORE_DLL(DBCachedContact*) db_get_contact(MCONTACT hContact)
{
- return (currDb == nullptr) ? nullptr : currDb->m_cache->GetCachedContact(hContact);
+ return (currDb == nullptr) ? nullptr : currDb->getCache()->GetCachedContact(hContact);
}
MIR_CORE_DLL(MCONTACT) db_find_first(const char *szProto)
@@ -413,7 +413,7 @@ MIR_CORE_DLL(MCONTACT) db_find_next(MCONTACT hContact, const char *szProto)
return (currDb == nullptr) ? NULL : currDb->FindNextContact(hContact, szProto);
}
-extern "C" MIR_CORE_DLL(void) db_setCurrent(MIDatabase *_db)
+extern "C" MIR_CORE_DLL(void) db_setCurrent(MDatabaseCommon *_db)
{
currDb = _db;
diff --git a/src/mir_core/src/mc.cpp b/src/mir_core/src/mc.cpp
index ee87cbbb55..aa55f22331 100644
--- a/src/mir_core/src/mc.cpp
+++ b/src/mir_core/src/mc.cpp
@@ -38,7 +38,7 @@ DBCachedContact* CheckMeta(MCONTACT hMeta)
if (!g_bEnabled)
return nullptr;
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMeta);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hMeta);
return (cc == nullptr || cc->nSubs == -1) ? nullptr : cc;
}
@@ -79,7 +79,7 @@ MIR_CORE_DLL(BOOL) db_mc_isMeta(MCONTACT hContact)
{
if (currDb == nullptr || !g_bEnabled) return FALSE;
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hContact);
return (cc == nullptr) ? FALSE : cc->nSubs != -1;
}
@@ -87,7 +87,7 @@ MIR_CORE_DLL(BOOL) db_mc_isSub(MCONTACT hContact)
{
if (currDb == nullptr || !g_bEnabled) return FALSE;
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hContact);
return (cc == nullptr) ? FALSE : cc->parentID != 0;
}
@@ -120,7 +120,7 @@ MIR_CORE_DLL(MCONTACT) db_mc_getMeta(MCONTACT hSubContact)
{
if (currDb == nullptr) return NULL;
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hSubContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hSubContact);
return (cc == nullptr) ? NULL : cc->parentID;
}
@@ -129,7 +129,7 @@ MIR_CORE_DLL(MCONTACT) db_mc_tryMeta(MCONTACT hContact)
{
if (currDb == nullptr) return hContact;
- DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
+ DBCachedContact *cc = currDb->getCache()->GetCachedContact(hContact);
if (cc == nullptr) return hContact;
return (cc->IsSub()) ? cc->parentID : hContact;
diff --git a/src/mir_core/src/miranda.h b/src/mir_core/src/miranda.h
index adfd3ee846..cca2148589 100644
--- a/src/mir_core/src/miranda.h
+++ b/src/mir_core/src/miranda.h
@@ -43,7 +43,7 @@ extern HINSTANCE g_hInst;
extern HWND hAPCWindow;
extern HANDLE hThreadQueueEmpty;
extern HCURSOR g_hCursorNS, g_hCursorWE;
-extern MIDatabase *currDb;
+extern MDatabaseCommon *currDb;
/////////////////////////////////////////////////////////////////////////////////////////
// modules.cpp