diff options
author | George Hazan <ghazan@miranda.im> | 2021-04-30 11:37:17 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-04-30 11:37:17 +0300 |
commit | 4262e8021c8ffdc0401d9ebe09899f90c654aa18 (patch) | |
tree | 49c99a90989cdc67ed3330711692ef936f42e419 /plugins/DbEditorPP | |
parent | 16aea17483a38f0348d51862809ad4648168e4f8 (diff) |
we use contact iterators when possible
Diffstat (limited to 'plugins/DbEditorPP')
-rw-r--r-- | plugins/DbEditorPP/src/exportimport.cpp | 25 | ||||
-rw-r--r-- | plugins/DbEditorPP/src/main_window.cpp | 3 |
2 files changed, 10 insertions, 18 deletions
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index a182418881..4ae33f26d1 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -161,17 +161,15 @@ void exportDB(MCONTACT hContact, const char *module) // exporting entire db
if (hContact == INVALID_CONTACT_ID) {
- hContact = NULL;
-
if (module == nullptr) {
fprintf(file, "SETTINGS:\n");
mod = modlist.first;
while (mod) {
- if (IsModuleEmpty(hContact, mod->name)) {
+ if (IsModuleEmpty(NULL, mod->name)) {
mod = (ModSetLinkLinkItem *)mod->next;
continue;
}
- exportModule(hContact, mod->name, file);
+ exportModule(NULL, mod->name, file);
mod = (ModSetLinkLinkItem *)mod->next;
if (mod)
fprintf(file, "\n");
@@ -182,27 +180,23 @@ void exportDB(MCONTACT hContact, const char *module) module = nullptr; // reset module for all contacts export
}
- hContact = db_find_first();
- if (hContact)
- fprintf(file, "\n\n");
+ fprintf(file, "\n\n");
- while (hContact) {
- if (ApplyProtoFilter(hContact)) {
- hContact = db_find_next(hContact);
+ for (auto &cc : Contacts()) {
+ if (ApplyProtoFilter(cc))
continue;
- }
- fprintf(file, "CONTACT: %s\n", NickFromHContact(hContact));
+ fprintf(file, "CONTACT: %s\n", NickFromHContact(cc));
if (module == nullptr) // export all modules
{
mod = modlist.first;
while (mod) {
- if (IsModuleEmpty(hContact, mod->name)) {
+ if (IsModuleEmpty(cc, mod->name)) {
mod = (ModSetLinkLinkItem *)mod->next;
continue;
}
- exportModule(hContact, mod->name, file);
+ exportModule(cc, mod->name, file);
mod = (ModSetLinkLinkItem *)mod->next;
if (mod)
fprintf(file, "\n");
@@ -210,9 +204,8 @@ void exportDB(MCONTACT hContact, const char *module) }
else // export module
{
- exportModule(hContact, module, file);
+ exportModule(cc, module, file);
}
- hContact = db_find_next(hContact);
}
}
// exporting a contact
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index a281640f1f..4eb8e0e128 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -555,8 +555,7 @@ void CMainDlg::onSelChanged_Modules(CCtrlTreeView::TEventInfo *ev) Select = 0;
if (mtis->type == MODULE) {
- _T2A module(text);
- PopulateSettings(hContact, module);
+ PopulateSettings(hContact, _T2A(text));
}
else if (((mtis->type & CONTACT) == CONTACT && hContact) || (mtis->type == CONTACT_ROOT_ITEM && !hContact)) {
int multi = 0;
|