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/UserInfoEx | |
parent | 5046973a41e412afd06d6a78a3b9bce226e3cf50 (diff) |
always hated these long expressions: contact_iter makes them much shorter
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r-- | plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/dlg_propsheet.cpp | 3 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/psp_options.cpp | 4 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_avatar.cpp | 4 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_refreshci.cpp | 2 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/svc_reminder.cpp | 6 |
7 files changed, 11 insertions, 12 deletions
diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index 237f94c7fd..9ef92feeab 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -741,7 +741,7 @@ class CAnnivList mtNow.GetLocalTime();
// insert the items into the list
- for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
// ignore meta subcontacts here, as they are not interesting.
if (!db_mc_isSub(hContact)) {
// filter protocol
diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 618cf63c4f..b5142bdcd4 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -543,7 +543,6 @@ void DlgContactInfoInitTreeIcons() if (!(bInitIcons & INIT_ICONS_ALL)) {
CPsHdr psh;
POINT metrics = {0};
- int i = 0;
psh._dwFlags = PSTVF_INITICONS;
@@ -566,7 +565,7 @@ void DlgContactInfoInitTreeIcons() PROTOACCOUNT **pd;
int ProtoCount = 0;
Proto_EnumAccounts(&ProtoCount, &pd);
- for (i = 0; i < ProtoCount; i++) {
+ for (int i = 0; i < ProtoCount; i++) {
// enumerate all contacts
for (psh._hContact = db_find_first(); psh._hContact != NULL; psh._hContact = db_find_next(psh._hContact)) {
// compare contact's protocol to the current one, to add
diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index b7311f6874..77fdb16776 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -499,7 +499,7 @@ BYTE CExImContactBase::isHandle(MCONTACT hContact) **/ MCONTACT CExImContactBase::findHandle() { - for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { + for (auto &hContact : contact_iter()) { if (isHandle(hContact)) { _hContact = hContact; _isNewContact = FALSE; diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index e4481391ad..cd8d14ec6e 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -466,7 +466,7 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam DB::Module::Delete(NULL, USERINFO"ExW");
// delete old contactsettings
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
db_unset(hContact, USERINFO, "PListColWidth0");
db_unset(hContact, USERINFO, "PListColWidth1");
db_unset(hContact, USERINFO, "PListColWidth2");
@@ -669,7 +669,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam // walk through all the contacts stored in the DB
MAnnivDate mdb;
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (auto &hContact : contact_iter())
mdb.DBMoveBirthDate(hContact, bOld, bNew);
}
diff --git a/plugins/UserInfoEx/src/svc_avatar.cpp b/plugins/UserInfoEx/src/svc_avatar.cpp index cd553e6e1d..0ed9bd5b12 100644 --- a/plugins/UserInfoEx/src/svc_avatar.cpp +++ b/plugins/UserInfoEx/src/svc_avatar.cpp @@ -102,7 +102,7 @@ namespace NServices if (bEnable && !ghChangedHook) {
// walk through all the contacts stored in the DB
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
// don't set if avatar is locked!
if (!db_get_b(hContact, "ContactPhoto", "Locked", 0)) {
BYTE bInvalidAvatar = TRUE;
@@ -144,7 +144,7 @@ namespace NServices ghChangedHook = nullptr;
// walk through all the contacts stored in the DB
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (auto &hContact : contact_iter())
DeleteAvatar(hContact);
}
}
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index 5b6b65987f..ac280af39a 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -692,7 +692,7 @@ public: {
int iWait = 100;
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (auto &hContact : contact_iter())
if (QueueAddRefreshContact(hContact, iWait))
iWait += 5000;
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 0b50dfd8ed..4c85441be5 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -564,7 +564,7 @@ void SvcReminderCheckAll(const ENotify notify) // walk through all the contacts stored in the DB
CEvent evt;
WORD a1 = 0;
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (auto &hContact : contact_iter())
CheckContact(hContact, now, evt, notify != NOTIFY_CLIST, &a1);
if (notify != NOTIFY_CLIST) {
@@ -727,7 +727,7 @@ static INT_PTR BackupBirthdayService(WPARAM hContact, LPARAM lParam) WORD a1 = 0;
//walk through all the contacts stored in the DB
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (auto &hContact : contact_iter())
if (!db_mc_isSub(hContact) && !mdb.DBGetBirthDate(hContact))
mdb.BackupBirthday(hContact, nullptr, TRUE, &a1);
}
@@ -858,7 +858,7 @@ void SvcReminderEnable(BYTE bEnable) UpdateTimer(TRUE);
}
else { // Reminder is off
- for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (auto &hContact : contact_iter())
NotifyWithExtraIcon(hContact, CEvent());
gRemindOpts.RemindState = REMIND_OFF;
|