diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-26 17:37:16 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-26 17:37:16 +0300 |
commit | 51cb1a0a2101fc6d7b8376f5d07adbede24f56a9 (patch) | |
tree | 26b2251fe405475cda53bf50b5f826652c4f3397 /protocols/Discord/src/server.cpp | |
parent | 3ac978c8338af177cde02e5c1c1d285170027d82 (diff) |
fix of marking unread events as read
Diffstat (limited to 'protocols/Discord/src/server.cpp')
-rw-r--r-- | protocols/Discord/src/server.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp index a818622d67..b87bc4eaf8 100644 --- a/protocols/Discord/src/server.cpp +++ b/protocols/Discord/src/server.cpp @@ -60,7 +60,7 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest DBEVENTINFO dbei = {}; dbei.szModule = m_szModuleName; - dbei.flags = DBEF_READ | DBEF_UTF; + dbei.flags = DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; SnowFlake lastId = getId(pUser->hContact, DB_KEY_LASTMSGID); // as stored in a database @@ -76,6 +76,10 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest dbei.flags &= ~DBEF_SENT; SnowFlake msgid = _wtoi64(p["id"].as_mstring()); + if (msgid <= pUser->lastReadId) + dbei.flags |= DBEF_READ; + else + dbei.flags &= ~DBEF_READ; CMStringA szBody(ptrA(mir_utf8encodeW(p["content"].as_mstring()))); szBody.AppendFormat("%c%lld", 0, msgid); |