From 5508a77c6103f979697dd72d5a72347a354d020d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 7 Jan 2021 18:09:54 +0300 Subject: common code moved to the core --- plugins/Dbx_sqlite/src/dbcontacts.cpp | 17 +---------------- plugins/Dbx_sqlite/src/dbintf.cpp | 2 +- plugins/Dbx_sqlite/src/dbsettings.cpp | 2 ++ 3 files changed, 4 insertions(+), 17 deletions(-) (limited to 'plugins/Dbx_sqlite/src') 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() -- cgit v1.2.3