From 2c24fa93c95554e9c1ea46df9a202157951714cc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 17 May 2020 20:14:18 +0300 Subject: fixes #2352 (ICQ-WIM: separate flag for ParseMessage to use server-side or local time) --- protocols/ICQ-WIM/src/poll.cpp | 2 +- protocols/ICQ-WIM/src/proto.h | 2 +- protocols/ICQ-WIM/src/server.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'protocols') diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp index 4d93f15c65..cb7ca2fe59 100644 --- a/protocols/ICQ-WIM/src/poll.cpp +++ b/protocols/ICQ-WIM/src/poll.cpp @@ -209,7 +209,7 @@ void CIcqProto::ProcessHistData(const JSONNode &ev) } else { for (auto &it : ev["tail"]["messages"]) - ParseMessage(hContact, lastMsgId, it, false); + ParseMessage(hContact, lastMsgId, it, false, true); setId(hContact, DB_KEY_LASTMSGID, lastMsgId); } diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h index 9ef81dc69e..2a4436fb39 100644 --- a/protocols/ICQ-WIM/src/proto.h +++ b/protocols/ICQ-WIM/src/proto.h @@ -255,7 +255,7 @@ class CIcqProto : public PROTO 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 bCreateRead); + void ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNode &msg, bool bCreateRead, bool bLocalTime); void OnLoggedIn(void); void OnLoggedOut(void); diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 010c2e2741..f9442cabcc 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 bCreateRead) +void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNode &it, bool bCreateRead, bool bLocalTime) { 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 = (bCreateRead) ? it["time"].as_int() : time(0); + int iMsgTime = (bLocalTime) ? time(0) : it["time"].as_int(); if (isChatRoom(hContact)) { CMStringA reqId(it["reqId"].as_mstring()); @@ -914,7 +914,7 @@ void CIcqProto::OnGetUserHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pR auto &results = root.results(); for (auto &it : results["messages"]) - ParseMessage(pReq->hContact, lastMsgId, it, pReq->pUserInfo != nullptr); + ParseMessage(pReq->hContact, lastMsgId, it, pReq->pUserInfo != nullptr, false); setId(pReq->hContact, DB_KEY_LASTMSGID, lastMsgId); } -- cgit v1.2.3