From 04f4e2acfbc82946ca3def654214c08071a87359 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 20 Jun 2015 13:55:58 +0000 Subject: xml api became a set of functions git-svn-id: http://svn.miranda-ng.org/main/trunk@14288 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/main.cpp | 2 -- protocols/SkypeWeb/src/skype_chatrooms.cpp | 52 +++++++++++++-------------- protocols/SkypeWeb/src/skype_history_sync.cpp | 26 +++++++------- protocols/SkypeWeb/src/skype_messages.cpp | 26 +++++++------- 4 files changed, 52 insertions(+), 54 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index 0d09d03e32..c944b64fb5 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -18,7 +18,6 @@ along with this program. If not, see . #include "stdafx.h" int hLangpack; -XML_API xi; HINSTANCE g_hInstance; CLIST_INTERFACE *pcli; char g_szMirVer[100]; @@ -55,7 +54,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); - mir_getXI(&xi); mir_getCLI(); CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(g_szMirVer), LPARAM(g_szMirVer)); diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 51b70c307a..eef1c9179f 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -293,37 +293,37 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) ptrA xinitiator, xtarget, initiator; //content = 14291862291648:initiator8:user - HXML xml = xi.parseString(ptrT(mir_a2t(content.c_str())), 0, _T("addmember")); + HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("addmember")); if (xml == NULL) return; - for (int i = 0; i < xi.getChildCount(xml); i++) + for (int i = 0; i < xmlGetChildCount(xml); i++) { - HXML xmlNode = xi.getNthChild(xml, L"target", i); + HXML xmlNode = xmlGetNthChild(xml, L"target", i); if (xmlNode == NULL) break; - xtarget = mir_t2a(xi.getText(xmlNode)); + xtarget = mir_t2a(xmlGetText(xmlNode)); CMStringA target = ParseUrl(xtarget, "8:"); AddChatContact(_A2T(chatname), target, target, L"User"); } - xi.destroyNode(xml); + xmlDestroyNode(xml); } else if (!mir_strcmpi(messageType.c_str(), "ThreadActivity/DeleteMember")) { ptrA xinitiator, xtarget; //content = 14291862291648:initiator8:user - HXML xml = xi.parseString(ptrT(mir_a2t(content.c_str())), 0, _T("deletemember")); + HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("deletemember")); if (xml != NULL) { - HXML xmlNode = xi.getChildByPath(xml, _T("initiator"), 0); - xinitiator = node != NULL ? mir_t2a(xi.getText(xmlNode)) : NULL; + HXML xmlNode = xmlGetChildByPath(xml, _T("initiator"), 0); + xinitiator = node != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL; - xmlNode = xi.getChildByPath(xml, _T("target"), 0); - xtarget = xmlNode != NULL ? mir_t2a(xi.getText(xmlNode)) : NULL; + xmlNode = xmlGetChildByPath(xml, _T("target"), 0); + xtarget = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL; - xi.destroyNode(xml); + xmlDestroyNode(xml); } if (xtarget == NULL) return; @@ -337,15 +337,15 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) { //content=14295327021308:usertest topic ptrA xinitiator, value; - HXML xml = xi.parseString(ptrT(mir_a2t(content.c_str())), 0, _T("topicupdate")); + HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("topicupdate")); if (xml != NULL) { - HXML xmlNode = xi.getChildByPath(xml, _T("initiator"), 0); - xinitiator = xmlNode != NULL ? mir_t2a(xi.getText(xmlNode)) : NULL; + HXML xmlNode = xmlGetChildByPath(xml, _T("initiator"), 0); + xinitiator = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL; - xmlNode = xi.getChildByPath(xml, _T("value"), 0); - value = xmlNode != NULL ? mir_t2a(xi.getText(xmlNode)) : NULL; + xmlNode = xmlGetChildByPath(xml, _T("value"), 0); + value = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL; - xi.destroyNode(xml); + xmlDestroyNode(xml); } CMStringA initiator = ParseUrl(xinitiator, "8:"); @@ -356,20 +356,20 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) { //content=14295512583638:user8:user1admin ptrA xinitiator, xId, xRole; - HXML xml = xi.parseString(ptrT(mir_a2t(content.c_str())), 0, _T("roleupdate")); + HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("roleupdate")); if (xml != NULL) { - HXML xmlNode = xi.getChildByPath(xml, _T("initiator"), 0); - xinitiator = xmlNode != NULL ? mir_t2a(xi.getText(xmlNode)) : NULL; + HXML xmlNode = xmlGetChildByPath(xml, _T("initiator"), 0); + xinitiator = xmlNode != NULL ? mir_t2a(xmlGetText(xmlNode)) : NULL; - xmlNode = xi.getChildByPath(xml, _T("target"), 0); + xmlNode = xmlGetChildByPath(xml, _T("target"), 0); if (xmlNode != NULL) { - HXML xmlId = xi.getChildByPath(xmlNode, _T("id"), 0); - HXML xmlRole = xi.getChildByPath(xmlNode, _T("role"), 0); - xId = xmlId != NULL ? mir_t2a(xi.getText(xmlId)) : NULL; - xRole = xmlRole != NULL ? mir_t2a(xi.getText(xmlRole)) : NULL; + HXML xmlId = xmlGetChildByPath(xmlNode, _T("id"), 0); + HXML xmlRole = xmlGetChildByPath(xmlNode, _T("role"), 0); + xId = xmlId != NULL ? mir_t2a(xmlGetText(xmlId)) : NULL; + xRole = xmlRole != NULL ? mir_t2a(xmlGetText(xmlRole)) : NULL; } - xi.destroyNode(xml); + xmlDestroyNode(xml); CMStringA initiator = ParseUrl(xinitiator, "8:"); CMStringA id = ParseUrl(xId, "8:"); diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index c21ee4573a..ef57c93e8a 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -107,19 +107,19 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) //content=user name int iType = 3, iDuration = 0; CMStringA skypename(ContactUrlToName(from.c_str())); - HXML xml = xi.parseString(ptrT(mir_a2t(content.c_str())), 0, _T("partlist")); + HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("partlist")); if (xml != NULL) { - ptrA type(mir_t2a(xi.getAttrValue(xml, _T("type")))); + ptrA type(mir_t2a(xmlGetAttrValue(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 = duration != NULL ? atoi(mir_t2a(xi.getText(duration))) : NULL; + HXML xmlNode = xmlGetChildByPath(xml, _T("part"), 0); + HXML duration = xmlNode == NULL ? NULL : xmlGetChildByPath(xmlNode, _T("duration"), 0); + iDuration = duration != NULL ? atoi(mir_t2a(xmlGetText(duration))) : NULL; - xi.destroyNode(xml); + xmlDestroyNode(xml); } CMStringA text = ""; if (iType == 1) @@ -147,17 +147,17 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) else if (!mir_strcmpi(messageType.c_str(), "RichText/Files")) { //content=run.bat - HXML xml = xi.parseString(ptrT(mir_a2t(content.c_str())), 0, _T("files")); + HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("files")); if (xml != NULL) { - for (int i = 0; i < xi.getChildCount(xml); i++) + for (int i = 0; i < xmlGetChildCount(xml); i++) { int fileSize; CMStringA msg = ""; - HXML xmlNode = xi.getNthChild(xml, L"file", i); + HXML xmlNode = xmlGetNthChild(xml, L"file", i); if (xmlNode == NULL) break; - fileSize = atoi(_T2A(xi.getAttrValue(xmlNode, L"size"))); - ptrA fileName(mir_t2a(xi.getText(xmlNode))); + fileSize = atoi(_T2A(xmlGetAttrValue(xmlNode, L"size"))); + ptrA fileName(mir_t2a(xmlGetText(xmlNode))); if (fileName == NULL || fileSize == NULL) continue; @@ -170,10 +170,10 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) else if (!mir_strcmpi(messageType.c_str(), "RichText/UriObject")) { //content=Для просмотра этого общего фото перейдите по ссылке: https://api.asm.skype.com/s/i?0-weu-d1-262f0a1ee256d03b8e4b8360d9208834 - HXML xml = xi.parseString(ptrT(mir_a2t(content.c_str())), 0, _T("URIObject")); + HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("URIObject")); if (xml != NULL) { - CMStringA object(ParseUrl(_T2A(xi.getAttrValue(xml, L"uri")), "/objects/")); + CMStringA object(ParseUrl(_T2A(xmlGetAttrValue(xml, L"uri")), "/objects/")); CMStringA data(FORMAT, "%s: https://api.asm.skype.com/s/i?%s", Translate("Image"), object.c_str()); AddMessageToDb(hContact, timestamp, flags, clientMsgId.c_str(), data.GetBuffer()); diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index cdd86adf49..87ed6a37fe 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -199,20 +199,20 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) //Echo / Sound Test Service6 //content=user name int iType = 3, iDuration = 0; - HXML xml = xi.parseString(ptrT(mir_a2t(content.c_str())), 0, _T("partlist")); + HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("partlist")); if (xml != NULL) { - ptrA type(mir_t2a(xi.getAttrValue(xml, _T("type")))); + ptrA type(mir_t2a(xmlGetAttrValue(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 = duration != NULL ? atoi(mir_t2a(xi.getText(duration))) : NULL; + HXML xmlNode = xmlGetChildByPath(xml, _T("part"), 0); + HXML duration = xmlNode == NULL ? NULL : xmlGetChildByPath(xmlNode, _T("duration"), 0); + iDuration = duration != NULL ? atoi(mir_t2a(xmlGetText(duration))) : NULL; - xi.destroyNode(xml); + xmlDestroyNode(xml); } CMStringA text = ""; if (iType == 1) @@ -244,17 +244,17 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) else if (!mir_strcmpi(messageType.c_str(), "RichText/Files")) { //content=run.bat - HXML xml = xi.parseString(ptrT(mir_a2t(content.c_str())), 0, _T("files")); + HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("files")); if (xml != NULL) { - for (int i = 0; i < xi.getChildCount(xml); i++) + for (int i = 0; i < xmlGetChildCount(xml); i++) { int fileSize; - HXML xmlNode = xi.getNthChild(xml, _T("file"), i); + HXML xmlNode = xmlGetNthChild(xml, _T("file"), i); if (xmlNode == NULL) break; - fileSize = atoi(_T2A(xi.getAttrValue(xmlNode, _T("size")))); - ptrA fileName(mir_utf8encodeT(xi.getText(xmlNode))); + fileSize = atoi(_T2A(xmlGetAttrValue(xmlNode, _T("size")))); + ptrA fileName(mir_utf8encodeT(xmlGetText(xmlNode))); if (fileName == NULL || fileSize == NULL) continue; @@ -267,10 +267,10 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) else if (!mir_strcmpi(messageType.c_str(), "RichText/UriObject")) { //content=Для просмотра этого общего фото перейдите по ссылке: https://api.asm.skype.com/s/i?0-weu-d1-262f0a1ee256d03b8e4b8360d9208834 - HXML xml = xi.parseString(ptrT(mir_a2t(content.c_str())), 0, _T("URIObject")); + HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("URIObject")); if (xml != NULL) { - CMStringA object(ParseUrl(_T2A(xi.getAttrValue(xml, L"uri")), "/objects/")); + CMStringA object(ParseUrl(_T2A(xmlGetAttrValue(xml, L"uri")), "/objects/")); CMStringA data(FORMAT, "%s: https://api.asm.skype.com/s/i?%s", Translate("Image"), object.c_str()); AddMessageToDb(hContact, timestamp, DBEF_UTF, clientMsgId.c_str(), data.GetBuffer()); } -- cgit v1.2.3