summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_messages.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-08-15 19:23:04 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-08-15 19:23:04 +0000
commitef92e3ef473fd0e3bea04af6179678e615b1813f (patch)
treec5b54d5fbffc54c9bc7f91e534b0976ffb31c73a /protocols/SkypeWeb/src/skype_messages.cpp
parentbfa87af56480a56464b448541b321e5fe1a86303 (diff)
SkypeWeb: Server time for outgoing messages. Option "Local time for incoming messages" removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@14962 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_messages.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 29e9a4e2aa..ba3c7eb5aa 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -81,6 +81,15 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg)
{
if (m_OutMessages.getIndex(hMessage) != -1)
{
+ if (response->pData != NULL)
+ {
+ JSONNode jRoot = JSONNode::parse(response->pData);
+ auto it = m_mpOutMessages.find(hMessage);
+ if (it == m_mpOutMessages.end())
+ {
+ m_mpOutMessages[hMessage] = jRoot["OriginalArrivalTime"].as_int();
+ }
+ }
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, hMessage, 0);
m_OutMessages.remove(hMessage);
}
@@ -129,6 +138,13 @@ int CSkypeProto::OnPreCreateMessage(WPARAM, LPARAM lParam)
memcpy(&evt->dbei->pBlob[evt->dbei->cbBlob], messageId, messageId.GetLength());
evt->dbei->cbBlob += messageId.GetLength();
+ auto it = m_mpOutMessages.find((HANDLE)evt->seq);
+ if (it != m_mpOutMessages.end())
+ {
+ evt->dbei->timestamp = it->second;
+ m_mpOutMessages.erase(it);
+ }
+
return 0;
}
@@ -145,7 +161,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node)
ptrA szClearedContent(RemoveHtml(strContent.c_str()));
bool bEdited = node["skypeeditedid"];
- time_t timestamp = getByte("UseLocalTime", 0) ? time(NULL) : IsoToUnixTime(node["composetime"].as_string().c_str());
+ time_t timestamp = IsoToUnixTime(node["composetime"].as_string().c_str());
int nEmoteOffset = node["skypeemoteoffset"].as_int();
@@ -169,6 +185,11 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node)
HANDLE hMessage = (HANDLE)atol(szMessageId);
if (m_OutMessages.getIndex(hMessage) != -1)
{
+ auto it = m_mpOutMessages.find(hMessage);
+ if (it == m_mpOutMessages.end())
+ {
+ m_mpOutMessages[hMessage] = timestamp;
+ }
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, hMessage, 0);
m_OutMessages.remove(hMessage);
}