summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-17 20:14:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-17 20:14:18 +0300
commit2c24fa93c95554e9c1ea46df9a202157951714cc (patch)
tree91d35b54767afddc1e4a5ba7398db9a154844bfe
parentb8ee680ac79eb37cd1ff1ca9e1b1a0dbcf830b9b (diff)
fixes #2352 (ICQ-WIM: separate flag for ParseMessage to use server-side or local time)
-rw-r--r--protocols/ICQ-WIM/src/poll.cpp2
-rw-r--r--protocols/ICQ-WIM/src/proto.h2
-rw-r--r--protocols/ICQ-WIM/src/server.cpp6
3 files changed, 5 insertions, 5 deletions
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<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 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);
}