summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-05-24 17:33:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-05-24 17:33:28 +0300
commitd782eaf66c6e77e44393e89c7d8df4416adafb9e (patch)
treee095a21674884a83c83276cd11d9fda0187efd66 /protocols/SkypeWeb/src
parenta66dc37bc321e89ff881ba0ccbe2a4ae3fa2720e (diff)
SkypeWeb: patch to save history in the correct order
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r--protocols/SkypeWeb/src/skype_db.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp28
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h1
3 files changed, 10 insertions, 21 deletions
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 <http://www.gnu.org/licenses/>.
#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);