From 108e6336657baa03d86659944b1e96c201379ac5 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sun, 16 Aug 2015 14:23:35 +0000 Subject: SkypeWeb: fix for messages timestamp git-svn-id: http://svn.miranda-ng.org/main/trunk@14965 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_messages.cpp | 22 +++++++++++++++------- protocols/SkypeWeb/src/skype_proto.cpp | 6 +++++- protocols/SkypeWeb/src/skype_proto.h | 2 ++ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index ba3c7eb5aa..2b7733c849 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -48,7 +48,7 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage) { if (!IsOnline()) { - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)"You cannot send when you are offline."); + ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("You cannot send when you are offline.")); return 0; } @@ -63,8 +63,10 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage) else SendRequest(new SendMessageRequest(username, param->hMessage, szMessage, li), &CSkypeProto::OnMessageSent, param); - m_OutMessages.insert((void*)param->hMessage); - + { + mir_cslock lck(m_lckOutMessagesList); + m_OutMessages.insert((void*)param->hMessage); + } return param->hMessage; } @@ -87,11 +89,14 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg) auto it = m_mpOutMessages.find(hMessage); if (it == m_mpOutMessages.end()) { - m_mpOutMessages[hMessage] = jRoot["OriginalArrivalTime"].as_int(); + m_mpOutMessages[hMessage] = (jRoot["OriginalArrivalTime"].as_int() / 1000); } } ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, hMessage, 0); - m_OutMessages.remove(hMessage); + { + mir_cslock lck(m_lckOutMessagesList); + m_OutMessages.remove(hMessage); + } } } else @@ -182,7 +187,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) { if (IsMe(szFromSkypename)) { - HANDLE hMessage = (HANDLE)atol(szMessageId); + HANDLE hMessage = (HANDLE)std::stoll(szMessageId.GetString()); if (m_OutMessages.getIndex(hMessage) != -1) { auto it = m_mpOutMessages.find(hMessage); @@ -191,7 +196,10 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) m_mpOutMessages[hMessage] = timestamp; } ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, hMessage, 0); - m_OutMessages.remove(hMessage); + { + mir_cslock lck(m_lckOutMessagesList); + m_OutMessages.remove(hMessage); + } } else { diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index bc9f1460a7..28d75c7b29 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -18,7 +18,11 @@ along with this program. If not, see . #include "stdafx.h" CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : - PROTO(protoName, userName), m_PopupClasses(1), m_InviteDialogs(1), m_GCCreateDialogs(1), m_OutMessages(3, PtrKeySortT) + PROTO(protoName, userName), + m_PopupClasses(1), + m_InviteDialogs(1), + m_GCCreateDialogs(1), + m_OutMessages(3, PtrKeySortT) { m_hProtoIcon = Icons[0].Handle; diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index dc1a15cb5b..69051e4afb 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -118,6 +118,7 @@ private: LIST m_GCCreateDialogs; //locks + mir_cs m_lckOutMessagesList; mir_cs m_InviteDialogsLock; mir_cs m_GCCreateDialogsLock; mir_cs messageSyncLock; @@ -262,6 +263,7 @@ private: void SyncHistory(); //chats + void InitGroupChatModule(); void CloseAllChatChatSessions(); -- cgit v1.2.3