summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-11-24 14:23:57 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-11-24 14:23:57 +0300
commit4854f0db22d0648823d30bc2f1f56b056d893b97 (patch)
tree9365b82bfd9240ea65d8166846df276bd997c091
parent12c7118ad289e7089c60f4cd30905e8eb3e98923 (diff)
EnumResidentSettings moved to MDatabaseCommon
-rw-r--r--include/m_db_int.h2
-rw-r--r--libs/win32/mir_app.libbin130060 -> 130476 bytes
-rw-r--r--libs/win64/mir_app.libbin125634 -> 126064 bytes
-rw-r--r--plugins/Db3x_mmap/src/dbintf.h1
-rw-r--r--plugins/Db3x_mmap/src/dbsettings.cpp10
-rw-r--r--plugins/Dbx_mdb/src/dbevents.cpp47
-rw-r--r--plugins/Dbx_mdb/src/dbintf.cpp10
-rw-r--r--plugins/Dbx_mdb/src/dbintf.h1
-rw-r--r--plugins/Dbx_mdb/src/dbmodulechain.cpp6
-rw-r--r--plugins/Dbx_mdb/src/dbsettings.cpp82
-rw-r--r--src/mir_app/src/MDatabaseCommon.cpp18
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
13 files changed, 72 insertions, 107 deletions
diff --git a/include/m_db_int.h b/include/m_db_int.h
index 883a109894..cbc2e850fa 100644
--- a/include/m_db_int.h
+++ b/include/m_db_int.h
@@ -159,6 +159,8 @@ public:
STDMETHODIMP_(BOOL) GetContactSettingStr(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
STDMETHODIMP_(BOOL) GetContactSettingStatic(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv);
STDMETHODIMP_(BOOL) FreeVariant(DBVARIANT *dbv);
+
+ STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam);
STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName);
};
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 0b18135672..aec20bcdc9 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 70b27a44f0..82df5e5b91 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h
index 4a194063a7..bbb7677825 100644
--- a/plugins/Db3x_mmap/src/dbintf.h
+++ b/plugins/Db3x_mmap/src/dbintf.h
@@ -236,7 +236,6 @@ public:
STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws);
STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting);
STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT hContact, DBSETTINGENUMPROC pfnEnumProc, const char *szModule, void *param);
- STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam);
STDMETHODIMP_(BOOL) MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub);
STDMETHODIMP_(BOOL) MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub);
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp
index 758f80c769..9423e369e4 100644
--- a/plugins/Db3x_mmap/src/dbsettings.cpp
+++ b/plugins/Db3x_mmap/src/dbsettings.cpp
@@ -671,13 +671,3 @@ STDMETHODIMP_(BOOL) CDb3Mmap::EnumContactSettings(MCONTACT contactID, DBSETTINGE
}
return result;
}
-
-STDMETHODIMP_(BOOL) CDb3Mmap::EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam)
-{
- for (int i = 0; i < m_lResidentSettings.getCount(); i++) {
- int ret = pFunc(m_lResidentSettings[i], pParam);
- if (ret)
- return ret;
- }
- return 0;
-}
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp
index a29f8330a1..ec5a291fc1 100644
--- a/plugins/Dbx_mdb/src/dbevents.cpp
+++ b/plugins/Dbx_mdb/src/dbevents.cpp
@@ -86,7 +86,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
for (Snapshot();; Revert(), Remap()) {
txn_ptr txn(m_pMdbEnv);
- MDBX_val key = { &dwEventId, sizeof(MEVENT) }, data = { NULL, sizeof(DBEvent)+dbe.cbBlob };
+ MDBX_val key = { &dwEventId, sizeof(MEVENT) }, data = { NULL, sizeof(DBEvent) + dbe.cbBlob };
MDBX_CHECK(mdbx_put(txn, m_dbEvents, &key, &data, MDBX_RESERVE), 0);
DBEvent *pNewEvent = (DBEvent*)data.iov_base;
@@ -130,7 +130,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
DBCachedContact *cc = m_cache->GetCachedContact(contactID), *cc2 = nullptr;
if (cc == NULL || cc->dbc.dwEventCount == 0)
return 1;
-
+
DBEvent dbe;
{
txn_ptr_ro txn(m_txn);
@@ -140,16 +140,14 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
dbe = *(DBEvent*)data.iov_base;
}
- if (contactID != dbe.contactID)
- {
+ if (contactID != dbe.contactID) {
cc2 = m_cache->GetCachedContact(dbe.contactID);
}
const auto Snapshot = [&]() { cc->Snapshot(); if (cc2) cc2->Snapshot(); };
const auto Revert = [&]() { cc->Revert(); if (cc2) cc2->Revert(); };
-
- for (Snapshot();; Revert(), Remap())
- {
+
+ for (Snapshot();; Revert(), Remap()) {
DBEventSortingKey key2 = { contactID, hDbEvent, dbe.timestamp };
txn_ptr txn(m_pMdbEnv);
@@ -167,8 +165,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
MDBX_CHECK(mdbx_put(txn, m_dbContacts, &key, &data, 0), 1);
}
- if (cc2)
- {
+ if (cc2) {
key2.hContact = dbe.contactID;
MDBX_CHECK(mdbx_del(txn, m_dbEventsSort, &key, &data), 1);
@@ -227,11 +224,9 @@ STDMETHODIMP_(BOOL) CDbxMdb::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei)
dbei->eventType = dbe->wEventType;
size_t bytesToCopy = min(dbei->cbBlob, dbe->cbBlob);
dbei->cbBlob = dbe->cbBlob;
- if (bytesToCopy && dbei->pBlob)
- {
+ if (bytesToCopy && dbei->pBlob) {
BYTE *pSrc = (BYTE*)data.iov_base + sizeof(DBEvent);
- if (dbe->flags & DBEF_ENCRYPTED)
- {
+ if (dbe->flags & DBEF_ENCRYPTED) {
dbei->flags &= ~DBEF_ENCRYPTED;
size_t len;
BYTE* pBlob = (BYTE*)m_crypto->decodeBuffer(pSrc, dbe->cbBlob, &len);
@@ -254,8 +249,7 @@ void CDbxMdb::FindNextUnread(const txn_ptr &txn, DBCachedContact *cc, DBEventSor
MDBX_val key = { &key2, sizeof(key2) }, data;
- for (int res = mdbx_cursor_get(cursor, &key, &data, MDBX_SET); res == MDBX_SUCCESS; res = mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT))
- {
+ for (int res = mdbx_cursor_get(cursor, &key, &data, MDBX_SET); res == MDBX_SUCCESS; res = mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT)) {
const DBEvent *dbe = (const DBEvent*)data.iov_base;
if (dbe->contactID != cc->contactID)
break;
@@ -278,9 +272,8 @@ STDMETHODIMP_(BOOL) CDbxMdb::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
return -1;
uint32_t wRetVal = -1;
-
- for (cc->Snapshot();; cc->Revert(), Remap())
- {
+
+ for (cc->Snapshot();; cc->Revert(), Remap()) {
txn_ptr txn(m_pMdbEnv);
MDBX_val key = { &hDbEvent, sizeof(MEVENT) }, data;
@@ -315,7 +308,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
STDMETHODIMP_(MCONTACT) CDbxMdb::GetEventContact(MEVENT hDbEvent)
{
- if (hDbEvent == 0)
+ if (hDbEvent == 0)
return INVALID_CONTACT_ID;
txn_ptr_ro txn(m_txn);
@@ -360,13 +353,11 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindLastEvent(MCONTACT contactID)
txn_ptr_ro txn(m_txn);
cursor_ptr_ro cursor(m_curEventsSort);
- if (mdbx_cursor_get(cursor, &key, &data, MDBX_SET_RANGE) != MDBX_SUCCESS)
- {
+ if (mdbx_cursor_get(cursor, &key, &data, MDBX_SET_RANGE) != MDBX_SUCCESS) {
if (mdbx_cursor_get(cursor, &key, &data, MDBX_LAST) != MDBX_SUCCESS)
return t_evLast = 0;
}
- else
- {
+ else {
if (mdbx_cursor_get(cursor, &key, &data, MDBX_PREV) != MDBX_SUCCESS)
return t_evLast = 0;
}
@@ -378,13 +369,12 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindLastEvent(MCONTACT contactID)
STDMETHODIMP_(MEVENT) CDbxMdb::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent)
{
- if (hDbEvent == 0)
+ if (hDbEvent == 0)
return t_evLast = 0;
txn_ptr_ro txn(m_txn);
- if (t_evLast != hDbEvent)
- {
+ if (t_evLast != hDbEvent) {
MDBX_val key = { &hDbEvent, sizeof(MEVENT) }, data;
if (mdbx_get(txn, m_dbEvents, &key, &data) != MDBX_SUCCESS)
return 0;
@@ -408,15 +398,14 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent
STDMETHODIMP_(MEVENT) CDbxMdb::FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent)
{
- if (hDbEvent == 0)
+ if (hDbEvent == 0)
return t_evLast = 0;
MDBX_val data;
txn_ptr_ro txn(m_txn);
- if (t_evLast != hDbEvent)
- {
+ if (t_evLast != hDbEvent) {
MDBX_val key = { &hDbEvent, sizeof(MEVENT) };
if (mdbx_get(txn, m_dbEvents, &key, &data) != MDBX_SUCCESS)
return 0;
diff --git a/plugins/Dbx_mdb/src/dbintf.cpp b/plugins/Dbx_mdb/src/dbintf.cpp
index 4b5ea4045c..8a85123eeb 100644
--- a/plugins/Dbx_mdb/src/dbintf.cpp
+++ b/plugins/Dbx_mdb/src/dbintf.cpp
@@ -35,7 +35,7 @@ CDbxMdb::CDbxMdb(const TCHAR *tszFileName, int iMode) :
mdbx_env_create(&m_pMdbEnv);
mdbx_env_set_maxdbs(m_pMdbEnv, 10);
mdbx_env_set_userctx(m_pMdbEnv, this);
-// mdbx_env_set_assert(m_pMdbEnv, LMDBX_FailAssert);
+ // mdbx_env_set_assert(m_pMdbEnv, LMDBX_FailAssert);
}
CDbxMdb::~CDbxMdb()
@@ -82,8 +82,7 @@ int CDbxMdb::Load(bool bSkipInit)
uint32_t keyVal = 1;
MDBX_val key = { &keyVal, sizeof(keyVal) }, data;
- if (mdbx_get(trnlck, m_dbGlobal, &key, &data) == MDBX_SUCCESS)
- {
+ if (mdbx_get(trnlck, m_dbGlobal, &key, &data) == MDBX_SUCCESS) {
const DBHeader *hdr = (const DBHeader*)data.iov_base;
if (hdr->dwSignature != DBHEADER_SIGNATURE)
return EGROKPRF_DAMAGED;
@@ -92,8 +91,7 @@ int CDbxMdb::Load(bool bSkipInit)
m_header = *hdr;
}
- else
- {
+ else {
m_header.dwSignature = DBHEADER_SIGNATURE;
m_header.dwVersion = DBHEADER_VERSION;
data.iov_base = &m_header; data.iov_len = sizeof(m_header);
@@ -143,7 +141,7 @@ int CDbxMdb::Load(bool bSkipInit)
hEventMarkedRead = CreateHookableEvent(ME_DB_EVENT_MARKED_READ);
hEventAddedEvent = CreateHookableEvent(ME_DB_EVENT_ADDED);
- hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED);
+ hEventDeletedEvent = CreateHookableEvent(ME_DB_EVENT_DELETED);
hEventFilterAddedEvent = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD);
}
diff --git a/plugins/Dbx_mdb/src/dbintf.h b/plugins/Dbx_mdb/src/dbintf.h
index c3cf04c1cf..d35fafba77 100644
--- a/plugins/Dbx_mdb/src/dbintf.h
+++ b/plugins/Dbx_mdb/src/dbintf.h
@@ -178,7 +178,6 @@ public:
STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws);
STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting);
STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT hContact, DBSETTINGENUMPROC pfnEnumProc, const char *szModule, void *param);
- STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam);
STDMETHODIMP_(BOOL) MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub);
STDMETHODIMP_(BOOL) MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub);
diff --git a/plugins/Dbx_mdb/src/dbmodulechain.cpp b/plugins/Dbx_mdb/src/dbmodulechain.cpp
index 3e8590f2de..6a27cbc238 100644
--- a/plugins/Dbx_mdb/src/dbmodulechain.cpp
+++ b/plugins/Dbx_mdb/src/dbmodulechain.cpp
@@ -29,8 +29,7 @@ int CDbxMdb::InitModules()
cursor_ptr_ro cursor(m_curModules);
MDBX_val key, data;
- while (mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT) == MDBX_SUCCESS)
- {
+ while (mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT) == MDBX_SUCCESS) {
uint32_t iMod = *(uint32_t*)key.iov_base;
const char *szMod = (const char*)data.iov_base;
m_Modules[iMod] = szMod;
@@ -42,8 +41,7 @@ int CDbxMdb::InitModules()
uint32_t CDbxMdb::GetModuleID(const char *szName)
{
uint32_t iHash = mir_hashstr(szName);
- if (m_Modules.find(iHash) == m_Modules.end())
- {
+ if (m_Modules.find(iHash) == m_Modules.end()) {
MDBX_val key = { &iHash, sizeof(iHash) }, data = { (void*)szName, strlen(szName) + 1 };
for (;; Remap()) {
diff --git a/plugins/Dbx_mdb/src/dbsettings.cpp b/plugins/Dbx_mdb/src/dbsettings.cpp
index 5c1750b23c..741fc9b307 100644
--- a/plugins/Dbx_mdb/src/dbsettings.cpp
+++ b/plugins/Dbx_mdb/src/dbsettings.cpp
@@ -48,15 +48,12 @@ LBL_Seek:
char *szCachedSettingName = m_cache->GetCachedSetting(szModule, szSetting, moduleNameLen, settingNameLen);
DBVARIANT *pCachedValue = m_cache->GetCachedValuePtr(contactID, szCachedSettingName, 0);
- if (pCachedValue != NULL)
- {
- if (pCachedValue->type == DBVT_ASCIIZ || pCachedValue->type == DBVT_UTF8)
- {
+ if (pCachedValue != NULL) {
+ if (pCachedValue->type == DBVT_ASCIIZ || pCachedValue->type == DBVT_UTF8) {
int cbOrigLen = dbv->cchVal;
char *cbOrigPtr = dbv->pszVal;
memcpy(dbv, pCachedValue, sizeof(DBVARIANT));
- if (isStatic)
- {
+ if (isStatic) {
int cbLen = 0;
if (pCachedValue->pszVal != NULL)
cbLen = (int)strlen(pCachedValue->pszVal);
@@ -69,8 +66,7 @@ LBL_Seek:
dbv->pszVal[cbOrigLen] = 0;
dbv->cchVal = cbLen;
}
- else
- {
+ else {
dbv->pszVal = (char*)mir_alloc(strlen(pCachedValue->pszVal) + 1);
strcpy(dbv->pszVal, pCachedValue->pszVal);
}
@@ -95,15 +91,11 @@ LBL_Seek:
MDBX_val key = { keyVal, sizeof(DBSettingKey) + settingNameLen + 1 }, data;
- if (mdbx_get(trnlck, m_dbSettings, &key, &data) != MDBX_SUCCESS)
- {
+ if (mdbx_get(trnlck, m_dbSettings, &key, &data) != MDBX_SUCCESS) {
// try to get the missing mc setting from the active sub
- if (cc && cc->IsMeta() && ValidLookupName(szModule, szSetting))
- {
- if (contactID = db_mc_getDefault(contactID))
- {
- if (szModule = GetContactProto(contactID))
- {
+ if (cc && cc->IsMeta() && ValidLookupName(szModule, szSetting)) {
+ if (contactID = db_mc_getDefault(contactID)) {
+ if (szModule = GetContactProto(contactID)) {
moduleNameLen = strlen(szModule);
goto LBL_Seek;
}
@@ -131,8 +123,7 @@ LBL_Seek:
case DBVT_ASCIIZ:
varLen = *(WORD*)pBlob;
pBlob += 2;
- if (isStatic)
- {
+ if (isStatic) {
dbv->cchVal--;
if (varLen < dbv->cchVal)
dbv->cchVal = varLen;
@@ -150,8 +141,7 @@ LBL_Seek:
case DBVT_BLOB:
varLen = *(WORD*)pBlob;
pBlob += 2;
- if (isStatic)
- {
+ if (isStatic) {
if (varLen < dbv->cpbVal)
dbv->cpbVal = varLen;
memcpy(dbv->pbVal, pBlob, dbv->cpbVal);
@@ -169,7 +159,7 @@ LBL_Seek:
varLen = *(WORD*)pBlob;
pBlob += 2;
-
+
size_t realLen;
ptrA decoded(m_crypto->decodeString(pBlob, varLen, &realLen));
if (decoded == NULL)
@@ -177,8 +167,7 @@ LBL_Seek:
varLen = (WORD)realLen;
dbv->type = DBVT_UTF8;
- if (isStatic)
- {
+ if (isStatic) {
dbv->cchVal--;
if (varLen < dbv->cchVal)
dbv->cchVal = varLen;
@@ -186,8 +175,7 @@ LBL_Seek:
dbv->pszVal[dbv->cchVal] = 0;
dbv->cchVal = varLen;
}
- else
- {
+ else {
dbv->pszVal = (char*)mir_alloc(1 + varLen);
memcpy(dbv->pszVal, decoded, varLen);
dbv->pszVal[varLen] = 0;
@@ -216,10 +204,8 @@ STDMETHODIMP_(BOOL) CDbxMdb::WriteContactSetting(MCONTACT contactID, DBCONTACTWR
// used for notifications
DBCONTACTWRITESETTING dbcwNotif = *dbcws;
- if (dbcwNotif.value.type == DBVT_WCHAR)
- {
- if (dbcwNotif.value.pszVal != NULL)
- {
+ if (dbcwNotif.value.type == DBVT_WCHAR) {
+ if (dbcwNotif.value.pszVal != NULL) {
T2Utf val(dbcwNotif.value.pwszVal);
if (val == NULL)
return 1;
@@ -243,16 +229,14 @@ STDMETHODIMP_(BOOL) CDbxMdb::WriteContactSetting(MCONTACT contactID, DBCONTACTWR
case DBVT_ASCIIZ: case DBVT_UTF8:
bIsEncrypted = m_bEncrypted || IsSettingEncrypted(dbcws->szModule, dbcws->szSetting);
- LBL_WriteString:
+LBL_WriteString:
if (dbcwWork.value.pszVal == NULL)
return 1;
dbcwWork.value.cchVal = (WORD)strlen(dbcwWork.value.pszVal);
- if (bIsEncrypted)
- {
+ if (bIsEncrypted) {
size_t len;
BYTE *pResult = m_crypto->encodeString(dbcwWork.value.pszVal, &len);
- if (pResult != NULL)
- {
+ if (pResult != NULL) {
pEncoded = dbcwWork.value.pbVal = pResult;
dbcwWork.value.cpbVal = (WORD)len;
dbcwWork.value.type = DBVT_ENCRYPTED;
@@ -275,14 +259,11 @@ STDMETHODIMP_(BOOL) CDbxMdb::WriteContactSetting(MCONTACT contactID, DBCONTACTWR
char *szCachedSettingName = m_cache->GetCachedSetting(dbcwWork.szModule, dbcwWork.szSetting, moduleNameLen, settingNameLen);
// we don't cache blobs and passwords
- if (dbcwWork.value.type != DBVT_BLOB && dbcwWork.value.type != DBVT_ENCRYPTED && !bIsEncrypted)
- {
+ if (dbcwWork.value.type != DBVT_BLOB && dbcwWork.value.type != DBVT_ENCRYPTED && !bIsEncrypted) {
DBVARIANT *pCachedValue = m_cache->GetCachedValuePtr(contactID, szCachedSettingName, 1);
- if (pCachedValue != NULL)
- {
+ if (pCachedValue != NULL) {
bool bIsIdentical = false;
- if (pCachedValue->type == dbcwWork.value.type)
- {
+ if (pCachedValue->type == dbcwWork.value.type) {
switch (dbcwWork.value.type) {
case DBVT_BYTE: bIsIdentical = pCachedValue->bVal == dbcwWork.value.bVal; break;
case DBVT_WORD: bIsIdentical = pCachedValue->wVal == dbcwWork.value.wVal; break;
@@ -295,8 +276,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::WriteContactSetting(MCONTACT contactID, DBCONTACTWR
}
m_cache->SetCachedVariant(&dbcwWork.value, pCachedValue);
}
- if (szCachedSettingName[-1] != 0)
- {
+ if (szCachedSettingName[-1] != 0) {
NotifyEventHooks(hSettingChangeEvent, contactID, (LPARAM)&dbcwWork);
return 0;
}
@@ -315,8 +295,8 @@ STDMETHODIMP_(BOOL) CDbxMdb::WriteContactSetting(MCONTACT contactID, DBCONTACTWR
case DBVT_BYTE: data.iov_len = 2; break;
case DBVT_WORD: data.iov_len = 3; break;
case DBVT_DWORD: data.iov_len = 5; break;
-
- case DBVT_ASCIIZ:
+
+ case DBVT_ASCIIZ:
case DBVT_UTF8:
data.iov_len = 3 + dbcwWork.value.cchVal; break;
@@ -378,8 +358,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteContactSetting(MCONTACT contactID, LPCSTR szM
MDBX_val key = { keyVal, sizeof(DBSettingKey) + settingNameLen + 1 };
- for (;; Remap())
- {
+ for (;; Remap()) {
txn_ptr trnlck(m_pMdbEnv);
MDBX_CHECK(mdbx_del(trnlck, m_dbSettings, &key, nullptr), 1);
if (trnlck.commit() == MDBX_SUCCESS)
@@ -408,8 +387,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT hContact, DBSETTINGENU
MDBX_val key = { &keyVal, sizeof(keyVal) }, data;
- for (int res = mdbx_cursor_get(cursor, &key, &data, MDBX_SET_RANGE); res == MDBX_SUCCESS; res = mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT))
- {
+ for (int res = mdbx_cursor_get(cursor, &key, &data, MDBX_SET_RANGE); res == MDBX_SUCCESS; res = mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT)) {
const DBSettingKey *pKey = (const DBSettingKey*)key.iov_base;
if (pKey->hContact != hContact || pKey->dwModuleId != keyVal.dwModuleId)
break;
@@ -418,11 +396,3 @@ STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT hContact, DBSETTINGENU
return result;
}
-
-STDMETHODIMP_(BOOL) CDbxMdb::EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam)
-{
- for (int i = 0; i < m_lResidentSettings.getCount(); i++)
- if (int ret = pFunc(m_lResidentSettings[i], pParam))
- return ret;
- return 0;
-}
diff --git a/src/mir_app/src/MDatabaseCommon.cpp b/src/mir_app/src/MDatabaseCommon.cpp
index 67e13b8614..34f1d68caf 100644
--- a/src/mir_app/src/MDatabaseCommon.cpp
+++ b/src/mir_app/src/MDatabaseCommon.cpp
@@ -55,6 +55,7 @@ int MDatabaseCommon::CheckProto(DBCachedContact *cc, const char *proto)
}
/////////////////////////////////////////////////////////////////////////////////////////
+// Modules
static int sttEnumVars(const char *szVarName, void *param)
{
@@ -76,6 +77,7 @@ BOOL MDatabaseCommon::DeleteModule(MCONTACT hContact, LPCSTR szModule)
}
/////////////////////////////////////////////////////////////////////////////////////////
+// Contacts
STDMETHODIMP_(MCONTACT) MDatabaseCommon::FindFirstContact(const char *szProto)
{
@@ -108,6 +110,7 @@ STDMETHODIMP_(MCONTACT) MDatabaseCommon::FindNextContact(MCONTACT contactID, con
}
/////////////////////////////////////////////////////////////////////////////////////////
+// Encryption support
BOOL MDatabaseCommon::IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting)
{
@@ -125,6 +128,7 @@ BOOL MDatabaseCommon::IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting)
}
/////////////////////////////////////////////////////////////////////////////////////////
+// Meta-contacts support
BOOL MDatabaseCommon::MetaDetouchSub(DBCachedContact *cc, int nSub)
{
@@ -142,6 +146,7 @@ BOOL MDatabaseCommon::MetaSetDefault(DBCachedContact *cc)
}
/////////////////////////////////////////////////////////////////////////////////////////
+// Getting settings
STDMETHODIMP_(BOOL) MDatabaseCommon::GetContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv)
{
@@ -277,6 +282,19 @@ STDMETHODIMP_(BOOL) MDatabaseCommon::FreeVariant(DBVARIANT *dbv)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Resident settings
+
+STDMETHODIMP_(BOOL) MDatabaseCommon::EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam)
+{
+ for (int i = 0; i < m_lResidentSettings.getCount(); i++) {
+ int ret = pFunc(m_lResidentSettings[i], pParam);
+ if (ret)
+ return ret;
+ }
+ return 0;
+}
+
STDMETHODIMP_(BOOL) MDatabaseCommon::SetSettingResident(BOOL bIsResident, const char *pszSettingName)
{
char *szSetting = m_cache->GetCachedSetting(nullptr, pszSettingName, 0, (int)mir_strlen(pszSettingName));
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index cff4a26030..089e2f3ae4 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -486,3 +486,4 @@ Clist_SetStatusMode @464
?FindNextContact@MDatabaseCommon@@UAGIIPBD@Z @491 NONAME
?MetaDetouchSub@MDatabaseCommon@@UAGHPAUDBCachedContact@@H@Z @492 NONAME
?MetaSetDefault@MDatabaseCommon@@UAGHPAUDBCachedContact@@@Z @493 NONAME
+?EnumResidentSettings@MDatabaseCommon@@UAGHP6AHPBDPAX@Z1@Z @494 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 4bb67009d7..6970a920e7 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -486,3 +486,4 @@ Clist_SetStatusMode @464
?FindNextContact@MDatabaseCommon@@UEAAIIPEBD@Z @491 NONAME
?MetaDetouchSub@MDatabaseCommon@@UEAAHPEAUDBCachedContact@@H@Z @492 NONAME
?MetaSetDefault@MDatabaseCommon@@UEAAHPEAUDBCachedContact@@@Z @493 NONAME
+?EnumResidentSettings@MDatabaseCommon@@UEAAHP6AHPEBDPEAX@Z1@Z @494 NONAME