From a9047d304ccd9c25fa254417f39911c6e079339c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 1 Mar 2019 17:15:11 +0300 Subject: fixes #1872 (we shall not rely on unreadCnt field, because while we're offline, another client can mark these messages as read) --- protocols/ICQ-WIM/src/poll.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp index 8c0147bca8..6cd4575e13 100644 --- a/protocols/ICQ-WIM/src/poll.cpp +++ b/protocols/ICQ-WIM/src/poll.cpp @@ -154,18 +154,9 @@ void CIcqProto::ProcessHistData(const JSONNode &ev) } // or load missing messages if any - switch (ev["unreadCnt"].as_int()) { - case 0: break; - case 1: - if (!IsChat(wszId)) - for (auto &it : ev["tail"]["messages"]) - ParseMessage(hContact, lastMsgId, it, false); - setId(hContact, DB_KEY_LASTMSGID, lastMsgId); - break; - - default: + __int64 srvLastId = _wtoi64(ev["lastMsgId"].as_mstring()); + if (srvLastId > lastMsgId) RetrieveUserHistory(hContact, lastMsgId); - } // check remote read if (g_bMessageState) { -- cgit v1.2.3