From 7bdb598e26e7e98788933af43090d34027166969 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 14 Sep 2016 18:01:49 +0000 Subject: second major wipeout of database services & structures: - DBCONTACTENUMSETTINGS removed; - all helpers moved to mir_core.dll git-svn-id: http://svn.miranda-ng.org/main/trunk@17296 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbx_mdb/src/dbcontacts.cpp | 2 +- plugins/Dbx_mdb/src/dbintf.cpp | 20 +++++++++----------- plugins/Dbx_mdb/src/dbintf.h | 6 +++--- plugins/Dbx_mdb/src/dbmodulechain.cpp | 2 +- plugins/Dbx_mdb/src/dbsettings.cpp | 10 +++++----- 5 files changed, 19 insertions(+), 21 deletions(-) (limited to 'plugins/Dbx_mdb') diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index 921d116c24..7014dfd6c7 100644 --- a/plugins/Dbx_mdb/src/dbcontacts.cpp +++ b/plugins/Dbx_mdb/src/dbcontacts.cpp @@ -165,7 +165,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::IsDbContact(MCONTACT contactID) BOOL CDbxMdb::MetaDetouchSub(DBCachedContact *cc, int nSub) { - DbModule_Delete(cc->pSubs[nSub], META_PROTO); + db_delete_module(cc->pSubs[nSub], META_PROTO); return 0; } diff --git a/plugins/Dbx_mdb/src/dbintf.cpp b/plugins/Dbx_mdb/src/dbintf.cpp index c1f7500ccf..13a3b78e62 100644 --- a/plugins/Dbx_mdb/src/dbintf.cpp +++ b/plugins/Dbx_mdb/src/dbintf.cpp @@ -142,17 +142,15 @@ int CDbxMdb::Load(bool bSkipInit) // everything is ok, go on if (!m_bReadOnly) { - // we don't need events in the service mode - if (ServiceExists(MS_DB_SETSAFETYMODE)) { - hContactDeletedEvent = CreateHookableEvent(ME_DB_CONTACT_DELETED); - hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED); - hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED); - hEventMarkedRead = CreateHookableEvent(ME_DB_EVENT_MARKED_READ); - - hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED); - hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED); - hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD); - } + // retrieve the event handles + hContactDeletedEvent = CreateHookableEvent(ME_DB_CONTACT_DELETED); + hContactAddedEvent = CreateHookableEvent(ME_DB_CONTACT_ADDED); + hSettingChangeEvent = CreateHookableEvent(ME_DB_CONTACT_SETTINGCHANGED); + hEventMarkedRead = CreateHookableEvent(ME_DB_EVENT_MARKED_READ); + + hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED); + hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED); + hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD); } FillContacts(); diff --git a/plugins/Dbx_mdb/src/dbintf.h b/plugins/Dbx_mdb/src/dbintf.h index 496a315589..05d80d71cb 100644 --- a/plugins/Dbx_mdb/src/dbintf.h +++ b/plugins/Dbx_mdb/src/dbintf.h @@ -174,7 +174,7 @@ public: STDMETHODIMP_(MEVENT) FindNextEvent(MCONTACT contactID, MEVENT hDbEvent); STDMETHODIMP_(MEVENT) FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent); - STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam); + STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, const void *pParam); STDMETHODIMP_(BOOL) GetContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); STDMETHODIMP_(BOOL) GetContactSettingStr(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); @@ -182,9 +182,9 @@ public: STDMETHODIMP_(BOOL) FreeVariant(DBVARIANT *dbv); STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws); STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting); - STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS *dbces); + STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT hContact, DBSETTINGENUMPROC pfnEnumProc, const char *szModule, const void *param); STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName); - STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam); + STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, const void *pParam); STDMETHODIMP_(BOOL) IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting); STDMETHODIMP_(BOOL) MetaDetouchSub(DBCachedContact *cc, int nSub); diff --git a/plugins/Dbx_mdb/src/dbmodulechain.cpp b/plugins/Dbx_mdb/src/dbmodulechain.cpp index 2b821023d6..e45c2e2f69 100644 --- a/plugins/Dbx_mdb/src/dbmodulechain.cpp +++ b/plugins/Dbx_mdb/src/dbmodulechain.cpp @@ -64,7 +64,7 @@ char* CDbxMdb::GetModuleName(uint32_t dwId) return it != m_Modules.end() ? const_cast(it->second.c_str()) : nullptr; } -STDMETHODIMP_(BOOL) CDbxMdb::EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam) +STDMETHODIMP_(BOOL) CDbxMdb::EnumModuleNames(DBMODULEENUMPROC pFunc, const void *pParam) { for (auto it = m_Modules.begin(); it != m_Modules.end(); ++it) if (int ret = pFunc(it->second.c_str(), it->first, (LPARAM)pParam)) diff --git a/plugins/Dbx_mdb/src/dbsettings.cpp b/plugins/Dbx_mdb/src/dbsettings.cpp index 9c48880618..2887675cec 100644 --- a/plugins/Dbx_mdb/src/dbsettings.cpp +++ b/plugins/Dbx_mdb/src/dbsettings.cpp @@ -549,11 +549,11 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteContactSetting(MCONTACT contactID, LPCSTR szM return 0; } -STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS* dbces) +STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT hContact, DBSETTINGENUMPROC pfnEnumProc, const char *szModule, const void *param) { int result = -1; - DBSettingKey keyVal = { contactID, GetModuleID(dbces->szModule) }; + DBSettingKey keyVal = { hContact, GetModuleID(szModule) }; txn_ptr_ro txn(m_txn); cursor_ptr_ro cursor(m_curSettings); @@ -562,15 +562,15 @@ STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT contactID, DBCONTACTEN for (int res = mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE); res == MDB_SUCCESS; res = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) { const DBSettingKey *pKey = (const DBSettingKey*)key.mv_data; - if (pKey->hContact != contactID || pKey->dwModuleId != keyVal.dwModuleId) + if (pKey->hContact != hContact || pKey->dwModuleId != keyVal.dwModuleId) break; - result = (dbces->pfnEnumProc)(pKey->szSettingName, dbces->lParam); + result = pfnEnumProc(pKey->szSettingName, LPARAM(param)); } return result; } -STDMETHODIMP_(BOOL) CDbxMdb::EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam) +STDMETHODIMP_(BOOL) CDbxMdb::EnumResidentSettings(DBMODULEENUMPROC pFunc, const void *pParam) { for (int i = 0; i < m_lResidentSettings.getCount(); i++) if (int ret = pFunc(m_lResidentSettings[i], 0, (LPARAM)pParam)) -- cgit v1.2.3