diff options
-rw-r--r-- | include/m_db_int.h | 1 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 211072 -> 211418 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 206726 -> 207076 bytes | |||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbsettings.cpp | 17 | ||||
-rwxr-xr-x | plugins/Dbx_sqlite/src/dbcontacts.cpp | 17 | ||||
-rwxr-xr-x | plugins/Dbx_sqlite/src/dbintf.cpp | 2 | ||||
-rwxr-xr-x | plugins/Dbx_sqlite/src/dbsettings.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/MDatabaseCommon.cpp | 20 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 |
10 files changed, 28 insertions, 33 deletions
diff --git a/include/m_db_int.h b/include/m_db_int.h index 925fd3d49b..a2b53fb279 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -179,6 +179,7 @@ protected: MIDatabaseCache* m_cache;
protected:
+ void FillContactSettings();
bool LockName(const wchar_t *pwszProfileName);
int CheckProto(DBCachedContact *cc, const char *proto);
void UnlockName();
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 55f8896741..01437d5c1b 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 694e230fc4..a1c4cbffcb 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/plugins/Dbx_mdbx/src/dbsettings.cpp b/plugins/Dbx_mdbx/src/dbsettings.cpp index 6ca3049a72..429403a359 100644 --- a/plugins/Dbx_mdbx/src/dbsettings.cpp +++ b/plugins/Dbx_mdbx/src/dbsettings.cpp @@ -77,22 +77,7 @@ void CDbxMDBX::FillSettings() }
}
- for (DBCachedContact *cc = m_cache->GetFirstContact(); cc; cc = m_cache->GetNextContact(cc->contactID)) {
- CheckProto(cc, "");
-
- DBVARIANT dbv; dbv.type = 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;
- }
+ FillContactSettings();
}
/////////////////////////////////////////////////////////////////////////////////////////
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() diff --git a/src/mir_app/src/MDatabaseCommon.cpp b/src/mir_app/src/MDatabaseCommon.cpp index 5e5feacd56..20abf51d35 100644 --- a/src/mir_app/src/MDatabaseCommon.cpp +++ b/src/mir_app/src/MDatabaseCommon.cpp @@ -61,6 +61,26 @@ int MDatabaseCommon::CheckProto(DBCachedContact *cc, const char *proto) return !mir_strcmp(cc->szProto, proto); } +void MDatabaseCommon::FillContactSettings() +{ + for (DBCachedContact *cc = m_cache->GetFirstContact(); cc; cc = m_cache->GetNextContact(cc->contactID)) { + CheckProto(cc, ""); + + DBVARIANT dbv; dbv.type = 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; + } +} + bool MDatabaseCommon::LockName(const wchar_t *pwszProfileName) { if (m_hLock != nullptr) diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index fad6884348..d7ea30182d 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -751,3 +751,4 @@ _Netlib_GetTlsUnique@8 @831 NONAME ?SafeDeleteFile@PU@@YGHPB_W@Z @839 NONAME
?SafeMoveFile@PU@@YGHPB_W0@Z @840 NONAME
?FilterSearch@Clist@@3V?$CMOption@_N@@A @841 NONAME
+?FillContactSettings@MDatabaseCommon@@IAEXXZ @842 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 0378aaba7b..3ec5305738 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -751,3 +751,4 @@ Netlib_GetTlsUnique @831 NONAME ?SafeDeleteFile@PU@@YAHPEB_W@Z @839 NONAME
?SafeMoveFile@PU@@YAHPEB_W0@Z @840 NONAME
?FilterSearch@Clist@@3V?$CMOption@_N@@A @841 NONAME
+?FillContactSettings@MDatabaseCommon@@IEAAXXZ @842 NONAME
|