summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/SkypeWeb/src/skype_poll_processing.cpp51
1 files changed, 50 insertions, 1 deletions
diff --git a/protocols/SkypeWeb/src/skype_poll_processing.cpp b/protocols/SkypeWeb/src/skype_poll_processing.cpp
index 8cf980e324..e55a080fb8 100644
--- a/protocols/SkypeWeb/src/skype_poll_processing.cpp
+++ b/protocols/SkypeWeb/src/skype_poll_processing.cpp
@@ -148,7 +148,56 @@ void CSkypeProto::ProcessNewMessageRes(JSONNODE *node)
void CSkypeProto::ProcessConversationUpdateRes(JSONNODE *node)
{
- return;
+ debugLogA("CSkypeProto::ProcessNewMessageRes");
+ JSONNODE *lastmsg = json_get(node, "lastMessage");
+
+ ptrA clientMsgId(mir_t2a(ptrT(json_as_string(json_get(lastmsg, "clientmessageid")))));
+ ptrA skypeEditedId(mir_t2a(ptrT(json_as_string(json_get(lastmsg, "skypeeditedid")))));
+ ptrA messageType(mir_t2a(ptrT(json_as_string(json_get(lastmsg, "messagetype")))));
+ ptrA from(mir_t2a(ptrT(json_as_string(json_get(lastmsg, "from")))));
+ ptrA content(mir_t2a(ptrT(json_as_string(json_get(lastmsg, "content")))));
+ ptrT composeTime(json_as_string(json_get(lastmsg, "composetime")));
+ ptrA conversationLink(mir_t2a(ptrT(json_as_string(json_get(lastmsg, "conversationLink")))));
+ ptrA type(mir_t2a(ptrT(json_as_string(json_get(node, "type")))));
+ time_t timestamp = IsoToUnixTime(composeTime);
+
+ if (strstr(conversationLink, "/8:"))
+ {
+ if (!mir_strcmpi(type, "Message"))
+ {
+ ptrA skypename(ContactUrlToName(from));
+ MCONTACT hContact = GetContact(skypename);
+
+ if (hContact == NULL && !IsMe(skypename))
+ AddContact(skypename, true);
+
+ if (!mir_strcmpi(messageType, "Control/Typing"))
+ {
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, 5);
+ }
+ else if (!mir_strcmpi(messageType, "Control/ClearTyping"))
+ {
+ CallService(MS_PROTO_CONTACTISTYPING, hContact, 0);
+ }
+ else if (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText"))
+ {
+ int emoteOffset = json_as_int(json_get(node, "skypeemoteoffset"));
+ if (IsMe(skypename))
+ {
+ hContact = GetContact(ptrA(ContactUrlToName(conversationLink)));
+ int hMessage = atoi(clientMsgId);
+ ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)hMessage, 0);
+ AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_SENT, clientMsgId, &content[emoteOffset], emoteOffset);
+ return;
+ }
+ OnReceiveMessage(clientMsgId, from, timestamp, content, emoteOffset);
+ }
+ else if (!mir_strcmpi(messageType, "Event/SkypeVideoMessage"))
+ {
+ return; //not supported
+ }
+ }
+ }
}
void CSkypeProto::ProcessThreadUpdateRes(JSONNODE *node)