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 --- plugins/HistorySweeperLight/src/historysweeperlight.cpp | 2 +- plugins/HistorySweeperLight/src/options.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins/HistorySweeperLight/src') diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 62a6f3b102..c54268c5cc 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -201,7 +201,7 @@ void ShutdownAction(void) SweepHistoryFromContact(NULL, Criteria, FALSE); // sweep system history, keepunread==0 - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (auto &hContact : contact_iter()) SweepHistoryFromContact(hContact, Criteria, TRUE); // sweep contact history, keepunread==1 } diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index 60da041125..3100ea18ce 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -91,7 +91,7 @@ static void ShowAllContactIcons(HWND hwndList) SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hSystemHistory, MAKELPARAM(0, db_get_b(NULL, ModuleName, "SweepSHistory", 0))); - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (auto &hContact : contact_iter()) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0); SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, db_get_b(hContact, ModuleName, "SweepHistory", 0))); @@ -150,7 +150,7 @@ void SaveSettings(HWND hwndDlg) db_set_b(NULL, ModuleName, "SweepSHistory", (BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hSystemHistory, 0)); - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (auto &hContact : contact_iter()) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0); int st = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, 0); -- cgit v1.2.3