diff options
author | George Hazan <george.hazan@gmail.com> | 2024-02-05 13:17:46 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-02-05 13:17:46 +0300 |
commit | 92937e4817268a029cc2446b74319a0d29025ed2 (patch) | |
tree | 04c8243f74ab9df13f98fcd217f8609bebe752a0 /protocols/ICQ-WIM/src/server.cpp | |
parent | 89a1de0eaf8377c97c9486492f08ca095effd906 (diff) |
fixes #4141 (ICQ: при удалении своего сообщения нужно сразу же запрашивать новые события у сервера)
Diffstat (limited to 'protocols/ICQ-WIM/src/server.cpp')
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 945ab57ba3..abba88aa22 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -822,15 +822,26 @@ void CIcqProto::OnGetPatches(MHttpResponse *pReply, AsyncHttpRequest *pReq) for (auto &it : results["patch"]) {
std::string type = it["type"].as_string();
__int64 msgId = _wtoi64(it["msgId"].as_mstring());
- if (type == "update")
+ if (type == "update" || type == "modify")
events[msgId] = true;
else
events[msgId] = false;
}
for (auto &it : events) {
- if (it.second)
- RetrieveHistoryChunk(pReq->hContact, it.first, it.first-1, 1);
+ if (it.second) {
+ bool bFound = false;
+
+ for (auto &msg: results["messages"])
+ if (_wtoi64(msg["msgId"].as_mstring()) == it.first) {
+ bFound = true;
+ __int64 lastMsgId;
+ ParseMessage(pReq->hContact, lastMsgId, msg, true, false);
+ }
+
+ if (!bFound)
+ RetrieveHistoryChunk(pReq->hContact, it.first, it.first - 1, 1);
+ }
else {
char msgId[100];
_i64toa(it.first, msgId, 10);
@@ -858,6 +869,21 @@ void CIcqProto::ProcessPatchVersion(MCONTACT hContact, __int64 currPatch) Push(pReq);
}
+void CIcqProto::RetrievePatches(MCONTACT hContact)
+{
+ __int64 oldPatch(getId(hContact, DB_KEY_PATCHVER));
+ if (!oldPatch)
+ oldPatch = 1;
+
+ auto *pReq = new AsyncRapiRequest(this, "getHistory", &CIcqProto::OnGetPatches);
+ #ifndef _DEBUG
+ pReq->flags |= NLHRF_NODUMPSEND;
+ #endif
+ pReq->hContact = hContact;
+ pReq->params << WCHAR_PARAM("sn", GetUserId(hContact)) << INT_PARAM("fromMsgId", -1) << INT_PARAM("count", -1) << SINT64_PARAM("patchVersion", oldPatch);
+ Push(pReq);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
void CIcqProto::OnGetUserHistory(MHttpResponse *pReply, AsyncHttpRequest *pReq)
|