diff options
author | aunsane <aunsane@gmail.com> | 2018-09-23 16:29:02 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-09-23 16:29:02 +0300 |
commit | 6e085b274205448082c43f1669d7dfed1ff75dfe (patch) | |
tree | dca2395ceffa428a5886a5251d9b36bfb5d8b18c /plugins/Dbx_sqlite/src/dbcontacts.cpp | |
parent | 89a3160416316af2ff0b8de9b247583a4ac103f8 (diff) |
dbx_sqlite: more fixes
- contacts: correct loading of mc's into cache
- events: fix queries
- codrrect deinit of sql statements
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbcontacts.cpp')
-rw-r--r-- | plugins/Dbx_sqlite/src/dbcontacts.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
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); } |