summaryrefslogtreecommitdiff
path: root/plugins/Variables
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-16 20:01:14 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-16 20:01:14 +0300
commit39390b02dbd5aa7eb21a83773fa561b39f8828bc (patch)
tree7982eda1257f7466b5663c2865fdb7804c397257 /plugins/Variables
parent5046973a41e412afd06d6a78a3b9bce226e3cf50 (diff)
always hated these long expressions: contact_iter makes them much shorter
Diffstat (limited to 'plugins/Variables')
-rw-r--r--plugins/Variables/src/contact.cpp2
-rw-r--r--plugins/Variables/src/parse_miranda.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index 8574cea41f..9c8e51ecaa 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -197,7 +197,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat
MCONTACT hContact;
LIST<void> arResults(1);
- for (hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (auto &hContact : contact_iter()) {
// <_HANDLE_:hContact>
tmp.Format(L"<%s:%d>", _A2W(PROTOID_HANDLE), hContact);
bool bMatch = (tmp == tszContact);
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index e6280737d5..8eb429ba81 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -439,7 +439,7 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags)
DBEVENTINFO dbe = {};
if (flags & DBE_FIRST) {
- for (MCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
+ for (auto &hSearchContact : contact_iter()) {
hSearchEvent = findDbEvent(hSearchContact, NULL, flags);
dbe.cbBlob = 0;
if (!db_event_get(hSearchEvent, &dbe)) {
@@ -452,7 +452,7 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags)
hDbEvent = hMatchEvent;
}
else if (flags & DBE_LAST) {
- for (MCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
+ for (auto &hSearchContact : contact_iter()) {
hSearchEvent = findDbEvent(hSearchContact, NULL, flags);
dbe.cbBlob = 0;
if (!db_event_get(hSearchEvent, &dbe)) {
@@ -468,7 +468,7 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags)
dbe.cbBlob = 0;
if (!db_event_get(hDbEvent, &dbe)) {
priorTimestamp = dbe.timestamp;
- for (MCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
+ for (auto &hSearchContact : contact_iter()) {
hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags);
dbe.cbBlob = 0;
if (!db_event_get(hSearchEvent, &dbe)) {
@@ -484,7 +484,7 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags)
else if (flags & DBE_PREV) {
if (!db_event_get(hDbEvent, &dbe)) {
priorTimestamp = dbe.timestamp;
- for (MCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) {
+ for (auto &hSearchContact : contact_iter()) {
hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags);
dbe.cbBlob = 0;
if (!db_event_get(hSearchEvent, &dbe)) {