summaryrefslogtreecommitdiff
path: root/protocols/Icq10/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-01-04 20:56:15 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-01-04 20:56:15 +0300
commit09051fd3a6a4d9d7f0946adc7e601a8ac1621450 (patch)
tree40d41644393641b3bdd4676cdabe5c0860a36a7b /protocols/Icq10/src/server.cpp
parent560cfb2b62a67f6a0f5486f7e381c6233c9813cf (diff)
fixes #1720 (ICQ 10 duplicates sent messages in History )
Diffstat (limited to 'protocols/Icq10/src/server.cpp')
-rw-r--r--protocols/Icq10/src/server.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp
index 02fbaf8ad4..ba78846ca2 100644
--- a/protocols/Icq10/src/server.cpp
+++ b/protocols/Icq10/src/server.cpp
@@ -437,7 +437,7 @@ void CIcqProto::OnGetUserHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pR
if (root.error() != 20000)
return;
- __int64 lastMsgId = getId(hContact, "LastMsgId");
+ __int64 lastMsgId = getId(hContact, DB_KEY_LASTMSGID);
const JSONNode &results = root.results();
for (auto &it : results["messages"]) {
@@ -448,7 +448,7 @@ void CIcqProto::OnGetUserHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pR
lastMsgId = msgId;
}
- setId(hContact, "LastMsgId", lastMsgId);
+ setId(hContact, DB_KEY_LASTMSGID, lastMsgId);
}
void CIcqProto::OnGetUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
@@ -571,6 +571,12 @@ void CIcqProto::OnSendMessage(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq)
}
}
}
+
+ const JSONNode &data = root.data();
+ __int64 msgId = _wtoi64(data["histMsgId"].as_mstring());
+ __int64 lastId = getId(ownMsg->m_hContact, DB_KEY_LASTMSGID);
+ if (msgId > lastId)
+ setId(ownMsg->m_hContact, DB_KEY_LASTMSGID, msgId);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -621,12 +627,12 @@ void CIcqProto::ProcessHistData(const JSONNode &ev)
MCONTACT hContact = CreateContact(dwUin, true);
- __int64 lastMsgId = getId(hContact, "LastMsgId");
+ __int64 lastMsgId = getId(hContact, DB_KEY_LASTMSGID);
__int64 srvlastId = _wtoi64(ev["lastMsgId"].as_mstring());
// on first start we don't load history not to create dups
if (lastMsgId == 0)
- setId(hContact, "LastMsgId", srvlastId);
+ setId(hContact, DB_KEY_LASTMSGID, srvlastId);
// or load missing messages if any
else if (srvlastId > lastMsgId)
RetrieveUserHistory(hContact, srvlastId, lastMsgId);