From 5952466c42cf02a659f5b110c77eca76a5476391 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 13 Jan 2015 20:45:27 +0000 Subject: first working variant of settings' enumerators git-svn-id: http://svn.miranda-ng.org/main/trunk@11849 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbx_mdb/src/dbsettings.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/Dbx_mdb/src/dbsettings.cpp b/plugins/Dbx_mdb/src/dbsettings.cpp index 1269c25c76..c4eaaad098 100644 --- a/plugins/Dbx_mdb/src/dbsettings.cpp +++ b/plugins/Dbx_mdb/src/dbsettings.cpp @@ -590,17 +590,17 @@ STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT contactID, DBCONTACTEN int result = 0; mir_cslock lck(m_csDbAccess); - txn_lock trnlck(m_pMdbEnv); - //mdb_open(trnlck, "settings", 0, &m_dbSettings); - - MDB_cursor *cursor; - mdb_cursor_open(trnlck, m_dbSettings, &cursor); - DBSettingKey keySearch; keySearch.dwContactID = contactID; keySearch.dwOfsModule = GetModuleNameOfs(dbces->szModule); keySearch.szSettingName[0] = 0; + LIST arSettings(50); + + txn_lock trnlck(m_pMdbEnv); + MDB_cursor *cursor; + mdb_cursor_open(trnlck, m_dbSettings, &cursor); + MDB_val key = { 2 * sizeof(DWORD), &keySearch }, data; mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY); while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) { @@ -610,10 +610,15 @@ STDMETHODIMP_(BOOL) CDbxMdb::EnumContactSettings(MCONTACT contactID, DBCONTACTEN char szSetting[256]; strncpy_s(szSetting, pKey->szSettingName, key.mv_size - sizeof(DWORD)*2); - result = (dbces->pfnEnumProc)(szSetting, dbces->lParam); + arSettings.insert(mir_strdup(szSetting)); } - mdb_cursor_close(cursor); + + for (int i = 0; i < arSettings.getCount(); i++) { + result = (dbces->pfnEnumProc)(arSettings[i], dbces->lParam); + mir_free(arSettings[i]); + } + return result; } -- cgit v1.2.3