diff options
author | George Hazan <ghazan@miranda.im> | 2020-05-15 14:21:57 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-05-15 14:21:57 +0300 |
commit | dd01d74a7fe2ba22980476dd06b6efafd80c31a8 (patch) | |
tree | ba36dad71d2347aafb00af0e9e04b072f5b7eebf /protocols/ICQ-WIM | |
parent | e0cd08488f88b6effef6e1cca5bda05648c6c70f (diff) |
ICQ-WIM: newly received messages were erroneously marked as read
Diffstat (limited to 'protocols/ICQ-WIM')
-rw-r--r-- | protocols/ICQ-WIM/src/poll.cpp | 2 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.cpp | 2 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.h | 4 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 15 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/version.h | 2 |
5 files changed, 13 insertions, 12 deletions
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp index 104e0e6145..4d93f15c65 100644 --- a/protocols/ICQ-WIM/src/poll.cpp +++ b/protocols/ICQ-WIM/src/poll.cpp @@ -204,7 +204,7 @@ void CIcqProto::ProcessHistData(const JSONNode &ev) __int64 srvLastId = _wtoi64(ev["lastMsgId"].as_mstring()); if (srvLastId > lastMsgId) { debugLogA("We need to retrieve history for %S: %lld > %lld", wszId.c_str(), srvLastId, lastMsgId); - RetrieveUserHistory(hContact, lastMsgId); + RetrieveUserHistory(hContact, lastMsgId, false); } } else { diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index bae1495b54..d67a5204ca 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -156,7 +156,7 @@ INT_PTR CIcqProto::OnMenuLoadHistory(WPARAM hContact, LPARAM) { delSetting(hContact, DB_KEY_LASTMSGID); - RetrieveUserHistory(hContact, 1); + RetrieveUserHistory(hContact, 1, true); return 0; } diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index a30246ec19..9ef81dc69e 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -244,7 +244,7 @@ class CIcqProto : public PROTO<CIcqProto> void MarkAsRead(MCONTACT hContact); void MoveContactToGroup(MCONTACT hContact, const wchar_t *pwszGroup, const wchar_t *pwszNewGroup); bool RetrievePassword(); - void RetrieveUserHistory(MCONTACT, __int64 startMsgId); + void RetrieveUserHistory(MCONTACT, __int64 startMsgId, bool bCreateRead); void RetrieveUserInfo(MCONTACT = INVALID_CONTACT_ID); void SetServerStatus(int iNewStatus); void ShutdownSession(void); @@ -255,7 +255,7 @@ class CIcqProto : public PROTO<CIcqProto> void Json2int(MCONTACT, const JSONNode&, const char *szJson, const char *szSetting); void Json2string(MCONTACT, const JSONNode&, const char *szJson, const char *szSetting); MCONTACT ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact = -1); - void ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNode &msg, bool bFromHistory); + void ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNode &msg, bool bCreateRead); void OnLoggedIn(void); void OnLoggedOut(void); diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 3da3c2e2be..010c2e2741 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -367,7 +367,7 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact) return hContact; } -void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNode &it, bool bFromHistory) +void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNode &it, bool bCreateRead) { CMStringA szMsgId(it["msgId"].as_mstring()); __int64 msgId = _atoi64(szMsgId); @@ -390,7 +390,7 @@ void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNo wszText.TrimRight(); } - int iMsgTime = (bFromHistory) ? it["time"].as_int() : time(0); + int iMsgTime = (bCreateRead) ? it["time"].as_int() : time(0); if (isChatRoom(hContact)) { CMStringA reqId(it["reqId"].as_mstring()); @@ -422,7 +422,7 @@ void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNo } bool bIsOutgoing = it["outgoing"].as_bool(); - if (!bFromHistory && !bIsOutgoing && wszText.Left(26) == L"https://files.icq.net/get/") { + if (!bCreateRead && !bIsOutgoing && wszText.Left(26) == L"https://files.icq.net/get/") { CMStringW wszUrl(wszText.Mid(26)); int idx = wszUrl.Find(' '); if (idx != -1) @@ -440,13 +440,13 @@ void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNo return; } - debugLogA("Adding message %d:%s (%d)", hContact, szMsgId.c_str(), bFromHistory); + debugLogA("Adding message %d:%s (CR=%d)", hContact, szMsgId.c_str(), bCreateRead); ptrA szUtf(mir_utf8encodeW(wszText)); PROTORECVEVENT pre = {}; if (bIsOutgoing) pre.flags |= PREF_SENT; - if (bFromHistory) pre.flags |= PREF_CREATEREAD; + if (bCreateRead) pre.flags |= PREF_CREATEREAD; pre.szMsgId = szMsgId; pre.timestamp = iMsgTime; pre.szMessage = szUtf; @@ -521,7 +521,7 @@ AsyncHttpRequest* CIcqProto::UserInfoRequest(MCONTACT hContact) return pReq; } -void CIcqProto::RetrieveUserHistory(MCONTACT hContact, __int64 startMsgId) +void CIcqProto::RetrieveUserHistory(MCONTACT hContact, __int64 startMsgId, bool bCreateRead) { if (startMsgId == 0) startMsgId = -1; @@ -531,6 +531,7 @@ void CIcqProto::RetrieveUserHistory(MCONTACT hContact, __int64 startMsgId) pReq->flags |= NLHRF_NODUMPSEND; #endif pReq->hContact = hContact; + pReq->pUserInfo = (bCreateRead) ? pReq : 0; __int64 patchVer = getId(hContact, DB_KEY_PATCHVER); if (patchVer == 0) @@ -913,7 +914,7 @@ void CIcqProto::OnGetUserHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pR auto &results = root.results(); for (auto &it : results["messages"]) - ParseMessage(pReq->hContact, lastMsgId, it, true); + ParseMessage(pReq->hContact, lastMsgId, it, pReq->pUserInfo != nullptr); setId(pReq->hContact, DB_KEY_LASTMSGID, lastMsgId); } diff --git a/protocols/ICQ-WIM/src/version.h b/protocols/ICQ-WIM/src/version.h index 0f68bc24e4..8c60696fe5 100644 --- a/protocols/ICQ-WIM/src/version.h +++ b/protocols/ICQ-WIM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 95 #define __RELEASE_NUM 11 -#define __BUILD_NUM 10 +#define __BUILD_NUM 11 #include <stdver.h> |