From 39390b02dbd5aa7eb21a83773fa561b39f8828bc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 16 Mar 2018 20:01:14 +0300 Subject: always hated these long expressions: contact_iter makes them much shorter --- src/core/stdfile/src/file.cpp | 2 +- src/core/stdmsg/src/msgoptions.cpp | 4 ++-- src/core/stdmsg/src/msgs.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index ab5b5fa68f..4f9b2dcc13 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -271,7 +271,7 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS static void RemoveUnreadFileEvents(void) { - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (auto &hContact : contact_iter()) { MEVENT hDbEvent = db_event_firstUnread(hContact); while (hDbEvent) { DBEVENTINFO dbei = {}; diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 34bb77028c..dbd9095c82 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -461,7 +461,7 @@ public: if (hItemUnknown && g_dat.bTypingUnknown) clist.SetCheck(hItemUnknown, 1); - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (auto &hContact : contact_iter()) { HANDLE hItem = clist.FindContact(hContact); if (hItem && db_get_b(hContact, SRMMMOD, SRMSGSET_TYPING, defType)) clist.SetCheck(hItem, 1); @@ -476,7 +476,7 @@ public: if (hItemUnknown) g_dat.bTypingUnknown = clist.GetCheck(hItemUnknown); - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (auto &hContact : contact_iter()) { HANDLE hItem = clist.FindContact(hContact); if (hItem) db_set_b(hContact, SRMMMOD, SRMSGSET_TYPING, clist.GetCheck(hItem)); diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 0b99c01edc..30a4565263 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -240,7 +240,7 @@ static void RestoreUnreadMessageAlerts(void) { OBJLIST arEvents(10, NumericKeySortT); - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (auto &hContact : contact_iter()) { for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) { bool autoPopup = false; -- cgit v1.2.3