summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/guilds.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-02-21 18:35:58 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-21 18:40:14 +0300
commitb8a1ac529c6615d5ba6aa3d7ea9e8b4fe9ad4b71 (patch)
tree05f3df6a2d296709f46f537eaeefea3c58b24f6c /protocols/Discord/src/guilds.cpp
parent058282527241fe458a1aae28d565a727dcc1a811 (diff)
Discord: C++'11 iterators
Diffstat (limited to 'protocols/Discord/src/guilds.cpp')
-rw-r--r--protocols/Discord/src/guilds.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index 70bfeeeab0..78eb0a1507 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -140,8 +140,8 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
if (oldMsgId != 0 && pUser->lastMsg.id > oldMsgId)
RetrieveHistory(pUser->hContact, MSG_AFTER, oldMsgId, 99);
- for (int i = 0; i < pGuild->arChatUsers.getCount(); i++)
- AddUserToChannel(*pUser, pGuild->arChatUsers[i]);
+ for (auto &it : pGuild->arChatUsers)
+ AddUserToChannel(*pUser, *it);
return pUser;
}
@@ -222,12 +222,10 @@ void CDiscordProto::ParseGuildContents(CDiscordGuild *pGuild, const JSONNode &pR
gm->iStatus = StrToStatus(s["status"].as_mstring());
}
- for (int k = 0; k < newMembers.getCount(); k++) {
- CDiscordGuildMember *pm = newMembers[k];
- for (int i = 0; i < arUsers.getCount(); i++) {
- CDiscordUser &pUser = arUsers[i];
- if (pUser.guildId == pGuild->id)
- AddUserToChannel(pUser, *pm);
+ for (auto &pm : newMembers) {
+ for (auto &pUser : arUsers) {
+ if (pUser->guildId == pGuild->id)
+ AddUserToChannel(*pUser, *pm);
}
}
}