summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-12-29 15:33:47 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-12-29 15:33:47 +0300
commite952f242f6314048ec98b60c4d53b0b9c00ab4c0 (patch)
tree2d8cbd4deeebe447371a1f9a1db064919f6f32cd /plugins
parenta7e949ad518d36d9edc52496d9a303854cae37ed (diff)
ancient perversion with DBCONTACTWRITESETTING removed
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Db3x_mmap/src/dbcontacts.cpp14
-rw-r--r--plugins/Db3x_mmap/src/dbcrypt.cpp48
-rw-r--r--plugins/Dbx_sqlite/src/dbsettings.cpp15
3 files changed, 36 insertions, 41 deletions
diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp
index 2408d9dc33..a42b010187 100644
--- a/plugins/Db3x_mmap/src/dbcontacts.cpp
+++ b/plugins/Db3x_mmap/src/dbcontacts.cpp
@@ -396,8 +396,8 @@ void CDb3Mmap::FillContacts()
if (GetContactSetting(hh, META_PROTO, "ContactNumber", &dbv))
continue;
- DBCONTACTWRITESETTING dbws = { META_PROTO };
- dbws.value.type = DBVT_DWORD;
+ DBVARIANT dbw;
+ dbw.type = DBVT_DWORD;
DBCachedContact *ccMeta = p->cc;
if (int(dbv.dVal) < ccMeta->nSubs) {
@@ -405,15 +405,13 @@ void CDb3Mmap::FillContacts()
char setting[100];
mir_snprintf(setting, "Handle%d", dbv.dVal);
- dbws.szSetting = setting;
- dbws.value.dVal = hh;
- WriteContactSetting(ccMeta->contactID, &dbws);
+ dbw.dVal = hh;
+ WriteContactSetting(ccMeta->contactID, META_PROTO, setting, &dbw);
}
// store contact id instead of the old mc number
- dbws.szSetting = "ParentMeta";
- dbws.value.dVal = ccMeta->contactID;
- WriteContactSetting(hh, &dbws);
+ dbw.dVal = ccMeta->contactID;
+ WriteContactSetting(hh, META_PROTO, "ParentMeta", &dbw);
// wipe out old data from subcontacts
DeleteContactSetting(hh, META_PROTO, "ContactNumber");
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp
index 6ef68aa852..ee90c2fdf8 100644
--- a/plugins/Db3x_mmap/src/dbcrypt.cpp
+++ b/plugins/Db3x_mmap/src/dbcrypt.cpp
@@ -77,11 +77,11 @@ STDMETHODIMP_(BOOL) CDb3Mmap::StoreCryptoKey()
uint8_t *pKey = (uint8_t*)_alloca(iKeyLength);
m_crypto->getKey(pKey, iKeyLength);
- DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "StoredKey" };
- dbcws.value.type = DBVT_BLOB;
- dbcws.value.cpbVal = (uint16_t)iKeyLength;
- dbcws.value.pbVal = pKey;
- WriteContactSetting(0, &dbcws);
+ DBVARIANT dbv;
+ dbv.type = DBVT_BLOB;
+ dbv.cpbVal = (uint16_t)iKeyLength;
+ dbv.pbVal = pKey;
+ WriteContactSetting(0, "CryptoEngine", "StoredKey", &dbv);
SecureZeroMemory(pKey, iKeyLength);
return TRUE;
@@ -117,11 +117,11 @@ STDMETHODIMP_(CRYPTO_PROVIDER *) CDb3Mmap::ReadProvider()
STDMETHODIMP_(BOOL) CDb3Mmap::StoreProvider(CRYPTO_PROVIDER *pProvider)
{
- DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "Provider" };
- dbcws.value.type = DBVT_BLOB;
- dbcws.value.pbVal = (uint8_t*)pProvider->pszName;
- dbcws.value.cpbVal = (uint16_t)mir_strlen(pProvider->pszName) + 1;
- WriteContactSetting(0, &dbcws);
+ DBVARIANT dbv = {};
+ dbv.type = DBVT_BLOB;
+ dbv.pbVal = (uint8_t*)pProvider->pszName;
+ dbv.cpbVal = (uint16_t)mir_strlen(pProvider->pszName) + 1;
+ WriteContactSetting(0, "CryptoEngine", "Provider", &dbv);
return TRUE;
}
@@ -148,10 +148,10 @@ STDMETHODIMP_(BOOL) CDb3Mmap::EnableEncryption(BOOL bEnable)
m_bEncrypted = !m_bEncrypted;
- DBCONTACTWRITESETTING dbcws = { "CryptoEngine", "DatabaseEncryption" };
- dbcws.value.type = DBVT_BYTE;
- dbcws.value.bVal = m_bEncrypted;
- WriteContactSetting(0, &dbcws);
+ DBVARIANT dbv = {};
+ dbv.type = DBVT_BYTE;
+ dbv.bVal = m_bEncrypted;
+ WriteContactSetting(0, "CryptoEngine", "DatabaseEncryption", &dbv);
g_hevSettingChanged = hSave1;
g_hevEventAdded = hSave2;
@@ -236,11 +236,11 @@ void CDb3Mmap::ToggleSettingsEncryption(MCONTACT contactID)
size_t encodedLen;
uint8_t *pResult = m_crypto->encodeString(p->szValue, &encodedLen);
if (pResult != nullptr) {
- DBCONTACTWRITESETTING dbcws = { szModule, p->szVar };
- dbcws.value.type = DBVT_ENCRYPTED;
- dbcws.value.pbVal = pResult;
- dbcws.value.cpbVal = (uint16_t)encodedLen;
- WriteContactSetting(contactID, &dbcws);
+ DBVARIANT dbv = {};
+ dbv.type = DBVT_ENCRYPTED;
+ dbv.pbVal = pResult;
+ dbv.cpbVal = (uint16_t)encodedLen;
+ WriteContactSetting(contactID, szModule, p->szVar, &dbv);
mir_free(pResult);
}
@@ -249,11 +249,11 @@ void CDb3Mmap::ToggleSettingsEncryption(MCONTACT contactID)
size_t realLen;
ptrA decoded(m_crypto->decodeString((uint8_t*)(char*)p->szValue, p->iLen, &realLen));
if (decoded != nullptr) {
- DBCONTACTWRITESETTING dbcws = { szModule, p->szVar };
- dbcws.value.type = DBVT_UNENCRYPTED;
- dbcws.value.pszVal = decoded;
- dbcws.value.cchVal = (uint16_t)realLen;
- WriteContactSetting(contactID, &dbcws);
+ DBVARIANT dbv = {};
+ dbv.type = DBVT_UNENCRYPTED;
+ dbv.pszVal = decoded;
+ dbv.cchVal = (uint16_t)realLen;
+ WriteContactSetting(contactID, szModule, p->szVar, &dbv);
}
}
}
diff --git a/plugins/Dbx_sqlite/src/dbsettings.cpp b/plugins/Dbx_sqlite/src/dbsettings.cpp
index 4b73fcb020..2fe4d3c18e 100644
--- a/plugins/Dbx_sqlite/src/dbsettings.cpp
+++ b/plugins/Dbx_sqlite/src/dbsettings.cpp
@@ -59,11 +59,11 @@ void CDbxSQLite::InitSettings()
FillContactSettings();
- DBVARIANT dbv; dbv.type = DBVT_DWORD;
+ DBVARIANT dbv; dbv.type = DBVT_BYTE;
if (GetContactSetting(0, "Compatibility", "Sqlite", &dbv))
- dbv.dVal = 0;
+ dbv.bVal = 0;
- if (dbv.dVal < 1) {
+ if (dbv.bVal < 1) {
int rc = sqlite3_exec(m_db, "ALTER TABLE events ADD COLUMN is_read INTEGER NOT NULL DEFAULT 0;", 0, 0, 0);
logError(rc, __FILE__, __LINE__);
@@ -73,12 +73,9 @@ void CDbxSQLite::InitSettings()
rc = sqlite3_exec(m_db, "UPDATE events SET is_read=1 WHERE (flags & 6) <> 0;", nullptr, nullptr, nullptr);
logError(rc, __FILE__, __LINE__);
- DBCONTACTWRITESETTING dbcws = {};
- dbcws.szModule = "Compatibility";
- dbcws.szSetting = "Sqlite";
- dbcws.value.type = DBVT_BYTE;
- dbcws.value.dVal = 1;
- WriteContactSetting(0, &dbcws);
+ dbv.type = DBVT_BYTE;
+ dbv.dVal = 1;
+ WriteContactSetting(0, "Compatibility", "Sqlite", &dbv);
}
}