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/UserInfoEx | |
parent | 16aea17483a38f0348d51862809ad4648168e4f8 (diff) |
we use contact iterators when possible
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r-- | plugins/UserInfoEx/src/dlg_propsheet.cpp | 5 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 4 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index e61f5e1e93..4267b8ab0e 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -494,11 +494,12 @@ void DlgContactInfoInitTreeIcons() // enumerate all protocols
for (auto &pa : Accounts()) {
// enumerate all contacts
- for (psh._hContact = db_find_first(); psh._hContact != NULL; psh._hContact = db_find_next(psh._hContact)) {
+ for (auto &cc: Contacts(pa->szModuleName)) {
// compare contact's protocol to the current one, to add
- LPCSTR pszContactProto = Proto_GetBaseAccountName(psh._hContact);
+ LPCSTR pszContactProto = Proto_GetBaseAccountName(cc);
if ((INT_PTR)pszContactProto != CALLSERVICE_NOTFOUND && !mir_strcmp(pa->szModuleName, pszContactProto)) {
// call a notification for the contact to retrieve all protocol specific tree items
+ psh._hContact = cc;
NotifyEventHooks(g_hDetailsInitEvent, (WPARAM)&psh, (LPARAM)psh._hContact);
if (psh._pPages) {
psh.Free_pPages();
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index 945d404c2b..ec1cb4b629 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -273,9 +273,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // module must exist in at least one contact
if (pDat->ExImContact->Typ != EXIM_CONTACT) // TRUE = All Contacts
{
- MCONTACT hContact;
-
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ for (auto &hContact: Contacts()) {
// ignore empty modules
if (!DB::Module::IsEmpty(hContact, p)) {
pszProto = Proto_GetBaseAccountName(hContact);
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp index dc826a7139..a83438b9ad 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp @@ -158,7 +158,7 @@ int SvcExImINI_Export(lpExImParam ExImContact, const wchar_t *pszFileName) ExportContact(NULL, &Modules, file); fprintf(file, "\n\n"); // Contacts - for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { + for (auto &hContact: Contacts()) { ExportContact(hContact, &Modules, file); fprintf(file, "\n\n"); } diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 3022575e8e..09e8040a50 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -137,7 +137,7 @@ int CFileXml::Export(lpExImParam ExImContact, const wchar_t *pszFileName) vContact.Export(xmlfile, &Modules);
// loop for all other contact
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ for (auto &hContact: Contacts()) {
switch (ExImContact->Typ) {
case EXIM_ALL:
case EXIM_GROUP:
|