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 /protocols/Tox | |
parent | 5046973a41e412afd06d6a78a3b9bce226e3cf50 (diff) |
always hated these long expressions: contact_iter makes them much shorter
Diffstat (limited to 'protocols/Tox')
-rw-r--r-- | protocols/Tox/src/tox_avatars.cpp | 4 | ||||
-rw-r--r-- | protocols/Tox/src/tox_contacts.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index ad2ac177e8..2e39986fa8 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -64,7 +64,7 @@ void CToxProto::SetToxAvatar(const wchar_t* path) db_set_blob(NULL, m_szModuleName, TOX_SETTINGS_AVATAR_HASH, (void*)hash, TOX_HASH_LENGTH);
if (IsOnline()) {
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
if (GetContactStatus(hContact) == ID_STATUS_OFFLINE)
continue;
@@ -162,7 +162,7 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam) }
if (IsOnline()) {
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
if (GetContactStatus(hContact) == ID_STATUS_OFFLINE)
continue;
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 5533d78983..7f945bf1a4 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -49,7 +49,7 @@ MCONTACT CToxProto::GetContact(const Tox *tox, const int friendNumber) MCONTACT CToxProto::GetContact(const char *pubKey)
{
MCONTACT hContact = NULL;
- for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for (auto &hContact : acc_contact_iter()) {
ptrA contactPubKey(getStringA(hContact, TOX_SETTINGS_ID));
// check only public key part of address
if (mir_strncmpi(pubKey, contactPubKey, TOX_PUBLIC_KEY_SIZE) == 0)
|