From 4df7c33b50f90a2ec4079a08e818c207d9644d8c Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Mon, 20 Apr 2015 07:48:09 +0000 Subject: SkypeWeb: Support calls in history. git-svn-id: http://svn.miranda-ng.org/main/trunk@12954 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_history_sync.cpp | 36 +++++++++++++++++++++++++++ protocols/SkypeWeb/src/skype_messages.cpp | 31 ++++++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 2322ecb930..2bd1b2fa7c 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -92,6 +92,42 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) else AddMessageToDb(hContact, timestamp, flags, clientMsgId, message, emoteOffset); } + else if (!mir_strcmpi(messageType, "Event/Call")) + { + //content=user name6 + //Echo / Sound Test Service6 + + //content=user name + MCONTACT hContact = FindContact(ptrA(ContactUrlToName(conversationLink))); + ptrA name; + int iType, iDuration; + ptrA skypename(ContactUrlToName(from)); + bool isMe = IsMe(skypename); + int flags = DBEF_UTF | DBEF_READ; + if (isMe) + flags |= DBEF_SENT; + HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("partlist")); + if (xml != NULL) + { + + ptrA type(mir_t2a(xi.getAttrValue(xml, _T("type")))); + + if (!mir_strcmpi(type, "ended")) iType = 0; + else if (!mir_strcmpi(type, "started")) iType = 1; + + HXML xmlNode = xi.getChildByPath(xml, _T("part"), 0); + HXML duration = xmlNode == NULL ? NULL : xi.getChildByPath(xmlNode, _T("duration"), 0); + iDuration = xmlNode != NULL ? atoi(mir_t2a(xi.getText(xmlNode))) : NULL; + + xi.destroyNode(xml); + } + CMStringA text = ""; + if (iType == 1) + text.Append(Translate("Call started")); + else if (iType == 0) + text.AppendFormat("%s\n%s: %d", Translate("Call ended"), Translate("Duration"), iDuration != NULL ? iDuration : 0); + AddMessageToDb(hContact, timestamp, flags, clientMsgId, text.GetBuffer()); + } } else if (conversationLink != NULL && strstr(conversationLink, "/19:")) { diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 474d23a502..30476a5d99 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -257,7 +257,36 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) OnReceiveMessage(clientMsgId, conversationLink, timestamp, message, emoteOffset); } else if (!mir_strcmpi(messageType, "Event/SkypeVideoMessage")){} - + else if (!mir_strcmpi(messageType, "Event/Call")) + { + //content=user name6 + //Echo / Sound Test Service6 + + //content=user name + ptrA name; + int iType, iDuration; + HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("partlist")); + if (xml != NULL) + { + + ptrA type(mir_t2a(xi.getAttrValue(xml, _T("type")))); + + if (!mir_strcmpi(type, "ended")) iType = 0; + else if (!mir_strcmpi(type, "started")) iType = 1; + + HXML xmlNode = xi.getChildByPath(xml, _T("part"), 0); + HXML duration = xmlNode == NULL ? NULL : xi.getChildByPath(xmlNode, _T("duration"), 0); + iDuration = xmlNode != NULL ? atoi(mir_t2a(xi.getText(xmlNode))) : NULL; + + xi.destroyNode(xml); + } + CMStringA text = ""; + if (iType == 1) + text.Append(Translate("Call started")); + else if (iType == 0) + text.AppendFormat("%s\n%s: %d", Translate("Call ended"), Translate("Duration"), iDuration != NULL ? iDuration : 0); + OnReceiveMessage(clientMsgId, conversationLink, timestamp, text.GetBuffer()); + } } -- cgit v1.2.3