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/CountryFlags/src/extraimg.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'plugins/CountryFlags') diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index cd2d31a485..d12ebf746b 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -63,14 +63,14 @@ static void CALLBACK SetExtraImage(MCONTACT hContact) // always call in context of main thread static void RemoveExtraImages(void) { - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (auto &hContact : contact_iter()) ExtraIcon_Clear(hExtraIcon, hContact); } // always call in context of main thread static void EnsureExtraImages(void) { - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (auto &hContact : contact_iter()) SetExtraImage(hContact); } @@ -135,8 +135,7 @@ static int MsgWndEvent(WPARAM, LPARAM lParam) void CALLBACK UpdateStatusIcons(LPARAM) { - MCONTACT hContact = db_find_first(); - while (hContact != NULL) { + for (auto &hContact : contact_iter()) { /* is a message window opened for this contact? */ MessageWindowData msgw; /* output */ if (!Srmm_GetWindowData(hContact, msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) { @@ -146,7 +145,6 @@ void CALLBACK UpdateStatusIcons(LPARAM) } else UnsetStatusIcon(hContact); } - hContact = db_find_next(hContact); } } -- cgit v1.2.3