diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-14 18:01:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-14 18:01:49 +0000 |
commit | 7bdb598e26e7e98788933af43090d34027166969 (patch) | |
tree | 65c215c0693c86134e471f0746e9726b645b51bb /plugins/Db3x_mmap | |
parent | 9f285a935709f4dda1065d6450739476168c43af (diff) |
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
Diffstat (limited to 'plugins/Db3x_mmap')
-rw-r--r-- | plugins/Db3x_mmap/src/dbcontacts.cpp | 2 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbcrypt.cpp | 7 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbintf.cpp | 20 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbintf.h | 6 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbmodulechain.cpp | 2 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbsettings.cpp | 16 |
6 files changed, 23 insertions, 30 deletions
diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp index 710b5324c1..e672a7ce7b 100644 --- a/plugins/Db3x_mmap/src/dbcontacts.cpp +++ b/plugins/Db3x_mmap/src/dbcontacts.cpp @@ -207,7 +207,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::IsDbContact(MCONTACT contactID) BOOL CDb3Mmap::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/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index 006821fc9a..755dcbf717 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -89,12 +89,7 @@ void sttContactEnum(MCONTACT contactID, const char *szModule, CDb3Mmap *db) {
OBJLIST<VarDescr> arSettings(1);
SettingUgraderParam param = { db, szModule, contactID, &arSettings };
-
- DBCONTACTENUMSETTINGS dbces = { 0 };
- dbces.pfnEnumProc = sttSettingUgrader;
- dbces.szModule = szModule;
- dbces.lParam = (LPARAM)¶m;
- db->EnumContactSettings(NULL, &dbces);
+ db->EnumContactSettings(NULL, sttSettingUgrader, szModule, ¶m);
for (int i = 0; i < arSettings.getCount(); i++) {
VarDescr &p = arSettings[i];
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp index 5a11c25259..e31d023454 100644 --- a/plugins/Db3x_mmap/src/dbintf.cpp +++ b/plugins/Db3x_mmap/src/dbintf.cpp @@ -141,17 +141,15 @@ int CDb3Mmap::Load(bool bSkipInit) if (m_dbHeader.version < DB_095_1_VERSION)
return EGROKPRF_CANTREAD;
- // 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/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index dc21944426..6f9a173b39 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -232,7 +232,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);
@@ -240,9 +240,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/Db3x_mmap/src/dbmodulechain.cpp b/plugins/Db3x_mmap/src/dbmodulechain.cpp index 995d681a69..034a7a6a12 100644 --- a/plugins/Db3x_mmap/src/dbmodulechain.cpp +++ b/plugins/Db3x_mmap/src/dbmodulechain.cpp @@ -127,7 +127,7 @@ char* CDb3Mmap::GetModuleNameByOfs(DWORD ofs) return NULL;
}
-STDMETHODIMP_(BOOL) CDb3Mmap::EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam)
+STDMETHODIMP_(BOOL) CDb3Mmap::EnumModuleNames(DBMODULEENUMPROC pFunc, const void *pParam)
{
for (int i = 0; i < m_lMods.getCount(); i++) {
ModuleName *pmn = m_lMods[i];
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index c12a0e0d3e..a99d5b64ef 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -811,9 +811,9 @@ STDMETHODIMP_(BOOL) CDb3Mmap::DeleteContactSetting(MCONTACT contactID, LPCSTR sz return 0;
}
-STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS* dbces)
+STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBSETTINGENUMPROC pfnEnumProc, const char *szModule, const void *param)
{
- if (!dbces->szModule)
+ if (!szModule)
return -1;
mir_cslock lck(m_csDbAccess);
@@ -826,12 +826,12 @@ STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBCONTACTE if (dbc->signature != DBCONTACT_SIGNATURE)
return -1;
- DWORD ofsModuleName = GetModuleNameOfs(dbces->szModule);
- dbces->ofsSettings = GetSettingsGroupOfsByModuleNameOfs(dbc, ofsModuleName);
- if (!dbces->ofsSettings)
+ DWORD ofsModuleName = GetModuleNameOfs(szModule);
+ DWORD ofsSettings = GetSettingsGroupOfsByModuleNameOfs(dbc, ofsModuleName);
+ if (!ofsSettings)
return -1;
- DWORD ofsBlobPtr = dbces->ofsSettings + offsetof(DBContactSettings, blob);
+ DWORD ofsBlobPtr = ofsSettings + offsetof(DBContactSettings, blob);
int bytesRemaining;
PBYTE pBlob = (PBYTE)DBRead(ofsBlobPtr, &bytesRemaining);
if (pBlob[0] == 0)
@@ -843,7 +843,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBCONTACTE NeedBytes(1 + pBlob[0]);
char szSetting[256];
memcpy(szSetting, pBlob + 1, pBlob[0]); szSetting[pBlob[0]] = 0;
- result = (dbces->pfnEnumProc)(szSetting, dbces->lParam);
+ result = pfnEnumProc(szSetting, LPARAM(param));
MoveAlong(1 + pBlob[0]);
NeedBytes(3);
MoveAlong(1 + GetSettingValueLength(pBlob));
@@ -852,7 +852,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBCONTACTE return result;
}
-STDMETHODIMP_(BOOL) CDb3Mmap::EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam)
+STDMETHODIMP_(BOOL) CDb3Mmap::EnumResidentSettings(DBMODULEENUMPROC pFunc, const void *pParam)
{
for (int i = 0; i < m_lResidentSettings.getCount(); i++) {
int ret = pFunc(m_lResidentSettings[i], 0, (LPARAM)pParam);
|