From 6e085b274205448082c43f1669d7dfed1ff75dfe Mon Sep 17 00:00:00 2001 From: aunsane Date: Sun, 23 Sep 2018 16:29:02 +0300 Subject: dbx_sqlite: more fixes - contacts: correct loading of mc's into cache - events: fix queries - codrrect deinit of sql statements --- plugins/Dbx_sqlite/src/dbcontacts.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'plugins/Dbx_sqlite/src/dbcontacts.cpp') diff --git a/plugins/Dbx_sqlite/src/dbcontacts.cpp b/plugins/Dbx_sqlite/src/dbcontacts.cpp index ce9af1ddc4..648de7f1a7 100644 --- a/plugins/Dbx_sqlite/src/dbcontacts.cpp +++ b/plugins/Dbx_sqlite/src/dbcontacts.cpp @@ -28,6 +28,19 @@ void CDbxSQLite::InitContacts() while (sqlite3_step(stmt) == SQLITE_ROW) { MCONTACT hContact = sqlite3_column_int64(stmt, 0); DBCachedContact *cc = m_cache->AddContactToCache(hContact); + + 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; } sqlite3_finalize(stmt); } -- cgit v1.2.3