summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_chats.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-15 21:05:06 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-15 21:05:06 +0300
commit59e6b15f513cc998ce13e9e49e2a6a3ace445ebb (patch)
treeaf52b73a17039ed1fbe398ba9f488c26a7071257 /protocols/VKontakte/src/vk_chats.cpp
parentbdaa5cf8b48515af2ac39f3f3245dd1183cbad52 (diff)
LIST<> iterators:
- new method LIST::removeItem added to save a pointer to removed record; - code cleaning related to the fact that LIST::remove() shall be the last operation inside an iterator, because otherwise the reference to it will point to a record next to deleted one; - a few remaining cycles converted to iterators
Diffstat (limited to 'protocols/VKontakte/src/vk_chats.cpp')
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 4e82018e1a..55460df3d5 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -174,22 +174,22 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
}
}
- for (int i = cc->m_users.getCount() - 1; i >= 0; i--) {
- CVkChatUser &cu = cc->m_users[i];
- if (!cu.m_bDel)
+ auto T = cc->m_users.rev_iter();
+ for (auto &cu : T) {
+ if (!cu->m_bDel)
continue;
wchar_t wszId[20];
- _itow(cu.m_uid, wszId, 10);
+ _itow(cu->m_uid, wszId, 10);
GCEVENT gce = { m_szModuleName, cc->m_wszId, GC_EVENT_PART };
gce.ptszUID = wszId;
gce.dwFlags = GCEF_NOTNOTIFY;
gce.time = time(nullptr);
- gce.ptszNick = mir_wstrdup(CMStringW(FORMAT, L"%s (https://vk.com/id%s)", cu.m_wszNick, wszId));
+ gce.ptszNick = mir_wstrdup(CMStringW(FORMAT, L"%s (https://vk.com/id%s)", cu->m_wszNick, wszId));
Chat_Event(&gce);
- cc->m_users.remove(i);
+ cc->m_users.remove(T.indexOf(&cu));
}
}