diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-20 07:48:09 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-20 07:48:09 +0000 |
commit | 4df7c33b50f90a2ec4079a08e818c207d9644d8c (patch) | |
tree | db0815145c56b74a5b281176b69fc99f6eaa1132 | |
parent | d179fcc04d6999c9ef44ac4dc312f0ca685192df (diff) |
SkypeWeb: Support calls in history.
git-svn-id: http://svn.miranda-ng.org/main/trunk@12954 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/SkypeWeb/src/skype_history_sync.cpp | 36 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 31 |
2 files changed, 66 insertions, 1 deletions
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=<partlist type="ended" alt=""><part identity="username"><name>user name</name><duration>6</duration></part>
+ //<part identity="echo123"><name>Echo / Sound Test Service</name><duration>6</duration></part></partlist>
+
+ //content=<partlist type="started" alt=""><part identity="username"><name>user name</name></part></partlist>
+ 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=<partlist type="ended" alt=""><part identity="username"><name>user name</name><duration>6</duration></part>
+ //<part identity="echo123"><name>Echo / Sound Test Service</name><duration>6</duration></part></partlist>
+
+ //content=<partlist type="started" alt=""><part identity="username"><name>user name</name></part></partlist>
+ 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());
+ }
}
|