From 35a2b1771115068077ce6db13860766e70405de1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 12 Apr 2018 18:34:27 +0300 Subject: MIDatabase became pure interface --- include/m_db_int.h | 5 +++-- plugins/Dbx_mdbx/src/init.cpp | 40 ++++++++++++++++++++------------------- plugins/Import/src/import.cpp | 21 ++++++++++---------- src/mir_app/src/meta_addto.cpp | 2 +- src/mir_app/src/meta_edit.cpp | 2 +- src/mir_app/src/meta_menu.cpp | 12 ++++++------ src/mir_app/src/meta_services.cpp | 10 +++++----- src/mir_app/src/meta_utils.cpp | 8 ++++---- src/mir_app/src/miranda.h | 4 ++-- src/mir_app/src/netliblog.cpp | 2 +- src/mir_app/src/proto_chains.cpp | 6 +++--- src/mir_core/src/db.cpp | 6 +++--- src/mir_core/src/mc.cpp | 10 +++++----- src/mir_core/src/miranda.h | 2 +- 14 files changed, 66 insertions(+), 64 deletions(-) diff --git a/include/m_db_int.h b/include/m_db_int.h index 4178434dc0..c3fc97eecd 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -82,8 +82,6 @@ interface MIDatabaseCache : public MZeroedObject interface MIR_APP_EXPORT MIDatabase { - MIDatabaseCache* m_cache; - STDMETHOD_(BOOL, IsRelational)(void) PURE; STDMETHOD_(void, SetCacheSafetyMode)(BOOL) PURE; @@ -137,6 +135,7 @@ protected: mir_cs m_csDbAccess; LIST m_lResidentSettings; + MIDatabaseCache* m_cache; protected: int CheckProto(DBCachedContact *cc, const char *proto); @@ -147,6 +146,8 @@ public: MDatabaseCommon(); virtual ~MDatabaseCommon(); + __forceinline MIDatabaseCache* getCache() const { return m_cache; } + STDMETHODIMP_(BOOL) DeleteModule(MCONTACT contactID, LPCSTR szModule); STDMETHODIMP_(MCONTACT) FindFirstContact(const char *szProto = nullptr); diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp index f90995b02c..6efe170cb5 100644 --- a/plugins/Dbx_mdbx/src/init.cpp +++ b/plugins/Dbx_mdbx/src/init.cpp @@ -25,8 +25,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. EXTERN_C void NTAPI tls_callback(PVOID module, DWORD reason, PVOID reserved); +HINSTANCE g_hInst = nullptr; int hLangpack; +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved) +{ + g_hInst = hInstDLL; + tls_callback(hInstDLL, reason, reserved); + return TRUE; +} + +///////////////////////////////////////////////////////////////////////////////////////// + static PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), @@ -41,7 +51,13 @@ static PLUGININFOEX pluginInfo = { 0x7c3d0a33, 0x2646, 0x4001, { 0x91, 0x7, 0xf3, 0x5e, 0xa2, 0x99, 0xd2, 0x92 } } }; -HINSTANCE g_hInst = nullptr; + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) +{ + return &pluginInfo; +} + +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_DATABASE, MIID_LAST }; ///////////////////////////////////////////////////////////////////////////////////////// @@ -60,7 +76,7 @@ static int grokHeader(const TCHAR *profile) } // returns 0 if all the APIs are injected otherwise, 1 -static MDatabaseCommon* LoadDatabase(const TCHAR *profile, BOOL bReadOnly) +static MDatabaseCommon* loadDatabase(const TCHAR *profile, BOOL bReadOnly) { // set the memory, lists & UTF8 manager mir_getLP(&pluginInfo); @@ -82,32 +98,18 @@ static DATABASELINK dblink = L"MDBX database driver", makeDatabase, grokHeader, - LoadDatabase + loadDatabase }; -///////////////////////////////////////////////////////////////////////////////////////// - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) -{ - return &pluginInfo; -} - -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_DATABASE, MIID_LAST }; - extern "C" __declspec(dllexport) int Load(void) { RegisterDatabasePlugin(&dblink); return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" __declspec(dllexport) int Unload(void) { return 0; } - -BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved) -{ - g_hInst = hInstDLL; - tls_callback(hInstDLL, reason, reserved); - return TRUE; -} diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 453108ef26..c5b1389ae3 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -73,8 +73,7 @@ static LIST arMetas(10); static HWND hdlgProgress; static DWORD nDupes, nContactsCount, nMessagesCount, nGroupsCount, nSkippedEvents, nSkippedContacts; -static MDatabaseCommon *srcDb; -static MIDatabase *dstDb; +static MDatabaseCommon *srcDb, *dstDb; ///////////////////////////////////////////////////////////////////////////////////////// @@ -632,7 +631,7 @@ static int ImportGroups() DBCachedContact* FindDestMeta(DBCachedContact *ccSrc) { for (MCONTACT hMeta = dstDb->FindFirstContact(META_PROTO); hMeta != 0; hMeta = dstDb->FindNextContact(hMeta, META_PROTO)) { - DBCachedContact *cc = dstDb->m_cache->GetCachedContact(hMeta); + DBCachedContact *cc = dstDb->getCache()->GetCachedContact(hMeta); if (cc->nSubs != ccSrc->nSubs) continue; @@ -660,7 +659,7 @@ MCONTACT FindExistingMeta(DBCachedContact *ccSrc) if (hDestSub == INVALID_CONTACT_ID) continue; - DBCachedContact *cc = dstDb->m_cache->GetCachedContact(hDestSub); + DBCachedContact *cc = dstDb->getCache()->GetCachedContact(hDestSub); if (cc == nullptr || !cc->IsSub()) // check if it's a sub continue; @@ -697,7 +696,7 @@ void ImportMeta(DBCachedContact *ccSrc) db_set_s(hDest, "Protocol", "p", META_PROTO); CopySettings(ccSrc->contactID, META_PROTO, hDest, META_PROTO); - ccDst = dstDb->m_cache->GetCachedContact(hDest); + ccDst = dstDb->getCache()->GetCachedContact(hDest); if (ccDst == nullptr) // normally it shouldn't happen return; @@ -710,7 +709,7 @@ void ImportMeta(DBCachedContact *ccSrc) if (hSub == INVALID_CONTACT_ID) { hSub = db_add_contact(); - DBCachedContact *ccSub = srcDb->m_cache->GetCachedContact(ccSrc->pSubs[i]); + DBCachedContact *ccSub = srcDb->getCache()->GetCachedContact(ccSrc->pSubs[i]); if (ccSub && ccSub->szProto) { Proto_AddToContact(hDest, ccSub->szProto); CopySettings(ccSrc->contactID, ccSub->szProto, hSub, ccSub->szProto); @@ -726,14 +725,14 @@ void ImportMeta(DBCachedContact *ccSrc) db_set_b(hSub, META_PROTO, "IsSubcontact", 1); db_set_dw(hSub, META_PROTO, "ParentMeta", hDest); - DBCachedContact *ccSub = dstDb->m_cache->GetCachedContact(hSub); + DBCachedContact *ccSub = dstDb->getCache()->GetCachedContact(hSub); if (ccSub) ccSub->parentID = hDest; } } } else { // add missing subs - ccDst = dstDb->m_cache->GetCachedContact(hDest); + ccDst = dstDb->getCache()->GetCachedContact(hDest); if (ccDst == nullptr) // normally it shouldn't happen return; @@ -765,7 +764,7 @@ void ImportMeta(DBCachedContact *ccSrc) static MCONTACT ImportContact(MCONTACT hSrc) { // Check what protocol this contact belongs to - DBCachedContact *cc = srcDb->m_cache->GetCachedContact(hSrc); + DBCachedContact *cc = srcDb->getCache()->GetCachedContact(hSrc); if (cc == nullptr || cc->szProto == nullptr) { AddMessage(LPGENW("Skipping contact with no protocol")); return NULL; @@ -879,7 +878,7 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC if (hContact) { // we ignore history import for metacontacts // the metahistory will be generated automatically by gathering subs' histories - DBCachedContact *cc = srcDb->m_cache->GetCachedContact(hContact); + DBCachedContact *cc = srcDb->getCache()->GetCachedContact(hContact); if (cc == nullptr) return; @@ -1020,7 +1019,7 @@ void MirandaImport(HWND hdlg) { hdlgProgress = hdlg; - if ((dstDb = db_get_current()) == nullptr) { + if ((dstDb = (MDatabaseCommon*)db_get_current()) == nullptr) { AddMessage(LPGENW("Error retrieving current profile, exiting.")); return; } 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 -- cgit v1.2.3