summaryrefslogtreecommitdiff
path: root/plugins/Dbx_sqlite/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-01-07 18:09:54 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-01-07 18:09:54 +0300
commit5508a77c6103f979697dd72d5a72347a354d020d (patch)
treef2f5aeed9794a8e9dd57f4caae65e2a20d429ee3 /plugins/Dbx_sqlite/src
parente26d06563851e85fa26c606a2577f81b4d7bef7c (diff)
common code moved to the core
Diffstat (limited to 'plugins/Dbx_sqlite/src')
-rwxr-xr-xplugins/Dbx_sqlite/src/dbcontacts.cpp17
-rwxr-xr-xplugins/Dbx_sqlite/src/dbintf.cpp2
-rwxr-xr-xplugins/Dbx_sqlite/src/dbsettings.cpp2
3 files changed, 4 insertions, 17 deletions
diff --git a/plugins/Dbx_sqlite/src/dbcontacts.cpp b/plugins/Dbx_sqlite/src/dbcontacts.cpp
index 87ebd448d3..23d243f145 100755
--- a/plugins/Dbx_sqlite/src/dbcontacts.cpp
+++ b/plugins/Dbx_sqlite/src/dbcontacts.cpp
@@ -29,23 +29,8 @@ void CDbxSQLite::InitContacts()
int rc = 0;
while ((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
MCONTACT hContact = sqlite3_column_int64(stmt, 0);
- DBCachedContact *cc = (hContact)
- ? m_cache->AddContactToCache(hContact)
- : &m_system;
+ DBCachedContact *cc = (hContact) ? m_cache->AddContactToCache(hContact) : &m_system;
cc->m_count = sqlite3_column_int64(stmt, 1);
-
- DBVARIANT dbv = { DBVT_DWORD };
- cc->nSubs = (0 != GetContactSetting(cc->contactID, META_PROTO, "NumContacts", &dbv)) ? -1 : dbv.dVal;
- if (cc->nSubs != -1) {
- cc->pSubs = (MCONTACT*)mir_alloc(cc->nSubs * sizeof(MCONTACT));
- for (int k = 0; k < cc->nSubs; k++) {
- char setting[100];
- mir_snprintf(setting, _countof(setting), "Handle%d", k);
- cc->pSubs[k] = (0 != GetContactSetting(cc->contactID, META_PROTO, setting, &dbv)) ? 0 : dbv.dVal;
- }
- }
- cc->nDefault = (0 != GetContactSetting(cc->contactID, META_PROTO, "Default", &dbv)) ? -1 : dbv.dVal;
- cc->parentID = (0 != GetContactSetting(cc->contactID, META_PROTO, "ParentMeta", &dbv)) ? 0 : dbv.dVal;
}
assert(rc == SQLITE_ROW || rc == SQLITE_DONE);
sqlite3_finalize(stmt);
diff --git a/plugins/Dbx_sqlite/src/dbintf.cpp b/plugins/Dbx_sqlite/src/dbintf.cpp
index b517eae4b4..862ecdae75 100755
--- a/plugins/Dbx_sqlite/src/dbintf.cpp
+++ b/plugins/Dbx_sqlite/src/dbintf.cpp
@@ -142,8 +142,8 @@ MDatabaseCommon* CDbxSQLite::Load(const wchar_t *profile, int readonly)
CDbxSQLite *db = new CDbxSQLite(database);
- db->InitSettings();
db->InitContacts();
+ db->InitSettings();
db->InitEvents();
return db;
}
diff --git a/plugins/Dbx_sqlite/src/dbsettings.cpp b/plugins/Dbx_sqlite/src/dbsettings.cpp
index 690bd7cb44..b4531c46e0 100755
--- a/plugins/Dbx_sqlite/src/dbsettings.cpp
+++ b/plugins/Dbx_sqlite/src/dbsettings.cpp
@@ -23,6 +23,8 @@ void CDbxSQLite::InitSettings()
{
for (auto &it : settings_stmts)
sqlite3_prepare_v3(m_db, it.szQuery, -1, SQLITE_PREPARE_PERSISTENT, &it.pQuery, nullptr);
+
+ FillContactSettings();
}
void CDbxSQLite::UninitSettings()