diff options
author | George Hazan <ghazan@miranda.im> | 2018-10-14 15:22:52 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-10-14 15:22:52 +0300 |
commit | 59a422087b5c4effb87a1e3ae4340e5ce3e63719 (patch) | |
tree | db134eae61a5aeaa22fb55829c0acc43f81305aa | |
parent | b71995291b73563e2525f93b3a7b0f4cbaebd288 (diff) |
fixes #1157 ([Discord] In some cases, group history is missing usernames when retrieved on login)
-rw-r--r-- | protocols/Discord/src/guilds.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp index c353533caf..5434ce4592 100644 --- a/protocols/Discord/src/guilds.cpp +++ b/protocols/Discord/src/guilds.cpp @@ -140,10 +140,6 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS setId(pUser->hContact, DB_KEY_ID, channelId); setId(pUser->hContact, DB_KEY_CHANNELID, channelId); - - SnowFlake oldMsgId = getId(pUser->hContact, DB_KEY_LASTMSGID); - if (oldMsgId != 0 && pUser->lastMsg.id > oldMsgId) - RetrieveHistory(pUser->hContact, MSG_AFTER, oldMsgId, 99); return pUser; } @@ -227,4 +223,14 @@ void CDiscordProto::ParseGuildContents(CDiscordGuild *pGuild, const JSONNode &pR for (auto &pm : newMembers) AddGuildUser(pGuild, *pm); + + // retrieve missing histories + for (auto &it : arUsers) { + if (it->bIsPrivate || it->guildId != pGuild->id) + continue; + + SnowFlake oldMsgId = getId(it->hContact, DB_KEY_LASTMSGID); + if (oldMsgId != 0 && it->lastMsg.id > oldMsgId) + RetrieveHistory(it->hContact, MSG_AFTER, oldMsgId, 99); + } } |