From 4262e8021c8ffdc0401d9ebe09899f90c654aa18 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 30 Apr 2021 11:37:17 +0300 Subject: we use contact iterators when possible --- plugins/MirandaG15/src/CContactList.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'plugins/MirandaG15/src') diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index 06592a2ce5..872c3570a2 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -506,15 +506,12 @@ void CContactList::RefreshList() m_bUseGroups = CConfig::GetBoolSetting(CLIST_USEGROUPS); m_bUseMetaContacts = db_get_b(0, "MetaContacts", "Enabled", 1) != 0; - CListEntry *pContactEntry = nullptr; - MCONTACT hContact = db_find_first(); - while (hContact != NULL) { - pContactEntry = FindContact(hContact); + for (auto &hContact: Contacts()) { + auto *pContactEntry = FindContact(hContact); if (!pContactEntry) AddContact(hContact); else if (pContactEntry && !IsVisible(GetContactData(pContactEntry))) RemoveContact(hContact); - hContact = db_find_next(hContact); } } @@ -935,7 +932,7 @@ void CContactList::InitializeGroupObjects() { UninitializeGroupObjects(); - for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { + for (auto &hContact: Contacts()) { tstring strGroup = GetContactGroupPath(hContact); char *szProto = Proto_GetBaseAccountName(hContact); if (szProto && db_get_b(0, META_PROTO, "Enabled", 1) && !mir_strcmpi(szProto, META_PROTO)) { -- cgit v1.2.3