diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-08-02 09:30:56 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-08-02 09:30:56 +0000 |
commit | 75c2ffb63a066e3ab8fac018af3e25b68f4f4d06 (patch) | |
tree | 1838a10a3bc34298891a0de81084d9349a189bea /protocols | |
parent | 436b6cd89f5b4b73d9c4c29ece117b71e1253319 (diff) |
SkypeWeb: Rework parsing call information.
git-svn-id: http://svn.miranda-ng.org/main/trunk@14810 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/SkypeWeb/src/skype_events.cpp | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index c9089e231f..b993a8973e 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -61,31 +61,43 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) {
ptrA type(mir_t2a(xmlGetAttrValue(xml, _T("type"))));
bool bType = (!mir_strcmpi(type, "started")) ? 1 : 0;
+ time_t callDuration = 0;
for (int i = 0; i < xmlGetChildCount(xml); i++)
{
- HXML xmlPart = xmlGetNthChild(xml, _T("part"), i);
+ HXML xmlPart = xmlGetNthChild(xml, _T("part"), i);
if (xmlPart != NULL)
{
- HXML xmlName = xmlGetChildByPath(xmlPart, _T("name"), 0);
HXML xmlDuration = xmlGetChildByPath(xmlPart, _T("duration"), 0);
- time_t callDuration = 0;
+
if (xmlDuration != NULL)
{
callDuration = _ttol(ptrT((TCHAR*)xmlGetText(xmlDuration)));
xmlDestroyNode(xmlDuration);
- }
- if (xmlName != NULL)
- {
- char szTime[MAX_PATH];
- strftime(szTime, sizeof(szTime), "%X", gmtime(&callDuration));
-
- szText.AppendFormat(Translate("%s %s this call (%s).\n"), _T2A(xmlGetText(xmlName)), bType ? Translate("enters") : Translate("leaves"), szTime);
- xmlDestroyNode(xmlName);
+ xmlDestroyNode(xmlPart);
+ break;
}
xmlDestroyNode(xmlPart);
}
}
+
+ if (bType)
+ {
+ szText = Translate("Call");
+ }
+ else
+ {
+ if (callDuration == 0)
+ {
+ szText = Translate("Call missed");
+ }
+ else
+ {
+ char szTime[100];
+ strftime(szTime, sizeof(szTime), "%X", gmtime(&callDuration));
+ szText.Format(Translate("Call ended (%s)"), szTime);
+ }
+ }
xmlDestroyNode(xml);
}
else
@@ -101,16 +113,15 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) {
for (int i = 0; i < xmlGetChildCount(xml); i++)
{
- long fileSize = 0;
+ LONGLONG fileSize = 0;
HXML xmlNode = xmlGetNthChild(xml, _T("file"), i);
if (xmlNode != NULL)
{
fileSize = _ttol(ptrT((TCHAR*)xmlGetAttrValue(xmlNode, _T("size"))));
- ptrA fileName(mir_utf8encodeT(ptrT((TCHAR*)xmlGetText(xmlNode))));
+ char *fileName = _T2A(ptrT((TCHAR*)xmlGetText(xmlNode)));
if (fileName != NULL)
{
- CMStringA msg(FORMAT, Translate("File transfer:\n\tFile name: %s\n\tSize: %d bytes"), fileName, fileSize);
- szText.AppendFormat("%s\n", msg);
+ szText.AppendFormat(Translate("File transfer:\n\tFile name: %s \n\tSize: %lld bytes \n"), fileName, fileSize);
}
xmlDestroyNode(xmlNode);
|