From 01decc6f90584cea4020275f24b00ecbd861a0e0 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sun, 26 Apr 2015 16:55:06 +0000 Subject: SkypeWeb: Filetransfers in history. Chats work without AutoSynchronization. git-svn-id: http://svn.miranda-ng.org/main/trunk@13171 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_history_sync.cpp | 32 ++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'protocols/SkypeWeb/src/skype_history_sync.cpp') diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 1e4f4641fb..f4dfda202b 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -53,6 +53,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) time_t timestamp = IsoToUnixTime(composeTime); ptrA skypename(ContactUrlToName(from)); bool isEdited = (json_get(message, "skypeeditedid") != NULL); + MCONTACT hContact = FindContact(ptrA(ContactUrlToName(conversationLink))); if (conversationLink != NULL && strstr(conversationLink, "/8:")) { if (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText")) @@ -63,8 +64,6 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) if (isMe) flags |= DBEF_SENT; - MCONTACT hContact = FindContact(ptrA(ContactUrlToName(conversationLink))); - ptrA message(RemoveHtml(content)); MEVENT dbevent = GetMessageFromDb(hContact, skypeEditedId); @@ -101,8 +100,6 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) //Echo / Sound Test Service6 //content=user name - MCONTACT hContact = FindContact(ptrA(ContactUrlToName(conversationLink))); - ptrA name; int iType = 3, iDuration = 0; ptrA skypename(ContactUrlToName(from)); bool isMe = IsMe(skypename); @@ -146,6 +143,30 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) } AddMessageToDb(hContact, timestamp, flags, clientMsgId, text.GetBuffer()); } + else if (!mir_strcmpi(messageType, "RichText/Files")) + { + //content=run.bat + HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("files")); + if (xml != NULL) + { + for (int i=0; i < xi.getChildCount(xml); i++) + { + int fileSize; CMStringA msg = ""; + HXML xmlNode = xi.getNthChild(xml, L"file", i); + if (xmlNode == NULL) + break; + fileSize = atoi(_T2A(xi.getAttrValue(xmlNode, L"size"))); + ptrA fileName(mir_t2a(xi.getText(xmlNode))); + if (fileName == NULL || fileSize == NULL) + continue; + + msg.Empty(); + msg.AppendFormat("%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize , Translate("bytes")); + AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_READ, clientMsgId, msg.GetBuffer()); + + } + } + } } else if (conversationLink != NULL && strstr(conversationLink, "/19:")) { @@ -199,13 +220,14 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) char *skypeEditedId = mir_t2a(json_as_string(json_get(lastMessage, "skypeeditedid"))); bool isEdited = (skypeEditedId != NULL); char *conversationLink = mir_t2a(json_as_string(json_get(lastMessage, "conversationLink"))); - time_t composeTime(IsoToUnixTime(ptrT(json_as_string(json_get(lastMessage, "conversationLink"))))); + time_t composeTime(IsoToUnixTime(ptrT(json_as_string(json_get(lastMessage, "composetime"))))); ptrA skypename; TCHAR *topic; if (conversationLink != NULL && strstr(conversationLink, "/8:")) { + if (!getByte("AutoSync", 1)) continue; skypename = ContactUrlToName(conversationLink); } else if (conversationLink != NULL && strstr(conversationLink, "/19:")) -- cgit v1.2.3