From d782eaf66c6e77e44393e89c7d8df4416adafb9e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 24 May 2019 17:33:28 +0300 Subject: SkypeWeb: patch to save history in the correct order --- protocols/SkypeWeb/src/skype_db.cpp | 2 +- protocols/SkypeWeb/src/skype_messages.cpp | 28 +++++++++------------------- protocols/SkypeWeb/src/skype_proto.h | 1 - 3 files changed, 10 insertions(+), 21 deletions(-) (limited to 'protocols/SkypeWeb/src') diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp index 63e7b9aa32..f5459015fc 100644 --- a/protocols/SkypeWeb/src/skype_db.cpp +++ b/protocols/SkypeWeb/src/skype_db.cpp @@ -97,7 +97,7 @@ void CSkypeProto::EditEvent(MCONTACT hContact, MEVENT hEvent, const char *szCont } std::string newMsg = jMsg.write().c_str(); - dbei.cbBlob = newMsg.size() + 1; + dbei.cbBlob = int(newMsg.size() + 1); dbei.pBlob = (PBYTE)newMsg.c_str(); db_event_edit(hContact, hEvent, &dbei); } diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 17021d1030..80f054b2f8 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -17,22 +17,6 @@ along with this program. If not, see . #include "stdafx.h" -/* MESSAGE RECEIVING */ - -// incoming message flow -int CSkypeProto::OnReceiveMessage(MCONTACT hContact, const char *szContent, const char *szMessageId, time_t timestamp, int emoteOffset, bool isRead) -{ - PROTORECVEVENT recv = {}; - recv.timestamp = timestamp; - recv.szMessage = mir_strdup(szContent); - recv.lParam = emoteOffset; - recv.szMsgId = szMessageId; - if (isRead) - recv.flags |= PREF_CREATEREAD; - - return ProtoChainRecvMsg(hContact, &recv); -} - /* MESSAGE SENDING */ struct SendMessageParam @@ -121,7 +105,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) ptrA szClearedContent(strMessageType == "RichText" ? RemoveHtml(strContent.c_str()) : mir_strdup(strContent.c_str())); bool bEdited = node["skypeeditedid"]; - time_t timestamp = IsoToUnixTime(node["composetime"].as_string().c_str()); + time_t timestamp = time(0); // fuck the server time, we need to place events in the order of our local time int nEmoteOffset = atoi(node["skypeemoteoffset"].as_string().c_str()); @@ -157,8 +141,14 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) MEVENT hDbEvent = GetMessageFromDb(szMessageId); if (bEdited && hDbEvent != NULL) EditEvent(hContact, hDbEvent, szClearedContent, timestamp); - else - OnReceiveMessage(hContact, szClearedContent, szMessageId, timestamp, nEmoteOffset); + else { + PROTORECVEVENT recv = {}; + recv.timestamp = timestamp; + recv.szMessage = mir_strdup(szClearedContent); + recv.lParam = nEmoteOffset; + recv.szMsgId = szMessageId; + ProtoChainRecvMsg(hContact, &recv); + } } } else if (strMessageType == "Event/Call") { diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 1414d38855..70779bdc57 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -288,7 +288,6 @@ private: MEVENT GetMessageFromDb(const char *messageId); MEVENT AddDbEvent(WORD type, MCONTACT hContact, DWORD timestamp, DWORD flags, const char *content, const char *uid); void EditEvent(MCONTACT hContact, MEVENT hEvent, const char *szContent, time_t edit_time); - int OnReceiveMessage(MCONTACT hContact, const char *szContent, const char *szMessageId, time_t timestamp, int emoteOffset = 0, bool isRead = false); int OnSendMessage(MCONTACT hContact, int flags, const char *message); void OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg); -- cgit v1.2.3