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/MirandaG15 | |
parent | 16aea17483a38f0348d51862809ad4648168e4f8 (diff) |
we use contact iterators when possible
Diffstat (limited to 'plugins/MirandaG15')
-rw-r--r-- | plugins/MirandaG15/src/CContactList.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
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<CContactListEntry*, CContactListGroup*> *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)) {
|