diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-16 20:01:14 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-16 20:01:14 +0300 |
commit | 39390b02dbd5aa7eb21a83773fa561b39f8828bc (patch) | |
tree | 7982eda1257f7466b5663c2865fdb7804c397257 /plugins/Weather | |
parent | 5046973a41e412afd06d6a78a3b9bce226e3cf50 (diff) |
always hated these long expressions: contact_iter makes them much shorter
Diffstat (limited to 'plugins/Weather')
-rw-r--r-- | plugins/Weather/src/weather_addstn.cpp | 2 | ||||
-rw-r--r-- | plugins/Weather/src/weather_contacts.cpp | 2 | ||||
-rw-r--r-- | plugins/Weather/src/weather_data.cpp | 2 | ||||
-rw-r--r-- | plugins/Weather/src/weather_mwin.cpp | 4 | ||||
-rw-r--r-- | plugins/Weather/src/weather_update.cpp | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 0393364663..87825b72a5 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -39,7 +39,7 @@ INT_PTR WeatherAddToList(WPARAM, LPARAM lParam) return 0;
// search for existing contact
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
// check if it is a weather contact
if (IsMyContact(hContact)) {
DBVARIANT dbv;
diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 17a2708092..647e855e99 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -444,7 +444,7 @@ int ContactDeleted(WPARAM wParam, LPARAM) // now the default station is deleted, try to get a new one
// start looking for other weather stations
- for (MCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) {
+ for (auto &hContact : contact_iter(WEATHERPROTONAME)) {
tszID = db_get_wsa(hContact, WEATHERPROTONAME, "ID");
if (tszID == NULL)
continue;
diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index 28fa9a622d..90a8a05c0a 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -112,7 +112,7 @@ void EraseAllInfo() MCONTACT LastContact = NULL;
DBVARIANT dbv;
// loop through all contacts
- for (MCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) {
+ for (auto &hContact : contact_iter(WEATHERPROTONAME)) {
db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_OFFLINE);
db_set_w(hContact, WEATHERPROTONAME, "StatusIcon", ID_STATUS_OFFLINE);
db_unset(hContact, "CList", "MyHandle");
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index c7377821ef..c219c2a9ca 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -348,7 +348,7 @@ void InitMwin(void) mir_strcpy(fontid.prefix, "fnt1");
Font_RegisterW(&fontid);
- for (MCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME))
+ for (auto &hContact : contact_iter(WEATHERPROTONAME))
if (db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0))
addWindow(hContact);
@@ -357,7 +357,7 @@ void InitMwin(void) void DestroyMwin(void)
{
- for (MCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) {
+ for (auto &hContact : contact_iter(WEATHERPROTONAME)) {
DWORD frameId = db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0);
if (frameId)
CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0);
diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index 07e69e5b5b..66feef7258 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -307,7 +307,7 @@ static void UpdateThreadProc(void *) void UpdateAll(BOOL AutoUpdate, BOOL RemoveData)
{
// add all weather contact to the update queue list
- for (MCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME))
+ for (auto &hContact : contact_iter(WEATHERPROTONAME))
if (!db_get_b(hContact, WEATHERPROTONAME, "AutoUpdate", FALSE) || !AutoUpdate) {
if (RemoveData)
DBDataManage(hContact, WDBM_REMOVE, 0, 0);
|