summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb/src/dbsettings.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-13 20:45:27 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-13 20:45:27 +0000
commit5952466c42cf02a659f5b110c77eca76a5476391 (patch)
treedde1a0bde94eb391224591bd34df51c5d83936b9 /plugins/Dbx_mdb/src/dbsettings.cpp
parent3ed0cd54cf2db670166af44296694a1c9679ec03 (diff)
first working variant of settings' enumerators
git-svn-id: http://svn.miranda-ng.org/main/trunk@11849 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/dbsettings.cpp')
-rw-r--r--plugins/Dbx_mdb/src/dbsettings.cpp21
1 files changed, 13 insertions, 8 deletions
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<char> 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;
}