summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-05-07 15:58:59 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-05-07 15:58:59 +0000
commitaa6b13e2545e7b8dbab49bc14909443643e375e9 (patch)
treedf88fb1a7bcc79f1fa78ae9dd2d8ed734026088b /protocols
parentfb2739625f4424488433e4edc53082e452e610fa (diff)
SkypeWeb: Manual JSON formation removed. Other fixes. Version bump.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13475 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/src/requests/capabilities.h28
-rw-r--r--protocols/SkypeWeb/src/requests/subscriptions.h18
-rw-r--r--protocols/SkypeWeb/src/requests/trouter.h31
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp3
-rw-r--r--protocols/SkypeWeb/src/skype_history_sync.cpp8
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_options.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_poll_processing.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_search.cpp4
-rw-r--r--protocols/SkypeWeb/src/version.h2
10 files changed, 87 insertions, 13 deletions
diff --git a/protocols/SkypeWeb/src/requests/capabilities.h b/protocols/SkypeWeb/src/requests/capabilities.h
index 35d241adc0..2cf5459b62 100644
--- a/protocols/SkypeWeb/src/requests/capabilities.h
+++ b/protocols/SkypeWeb/src/requests/capabilities.h
@@ -39,10 +39,36 @@ public:
bitness = 64;
#endif
- CMStringA data(::FORMAT, "{\"id\":\"messagingService\",\"type\":\"EndpointPresenceDoc\",\"selfLink\":\"uri\",\"privateInfo\":{\"epname\":\"%s\"},\"publicInfo\":{\"capabilities\":\"Audio|Video\",\"typ\":125,\"skypeNameVersion\":\"Miranda NG Skype\",\"nodeInfo\":\"xx\",\"version\":\"%s x%d\"}}", compName, g_szMirVer, bitness);
+ CMStringA verString(::FORMAT, "%s x%d", g_szMirVer, bitness);
+ JSONNODE *node = json_new(5);
+ JSONNODE *privateInfo = json_new(5);
+ JSONNODE *publicInfo = json_new(5);
+
+ json_set_name(privateInfo, "privateInfo");
+ json_set_name(publicInfo, "publicInfo");
+
+ json_push_back(node, json_new_a ("id", "messagingService" ));
+ json_push_back(node, json_new_a ("type", "EndpointPresenceDoc" ));
+ json_push_back(node, json_new_a ("selfLink", "uri" ));
+
+ json_push_back(privateInfo, json_new_a ("epname", compName ));
+
+ json_push_back(publicInfo, json_new_a ("capabilities", "Audio|Video" ));
+ json_push_back(publicInfo, json_new_i ("capabilities", 125 ));
+ json_push_back(publicInfo, json_new_a ("skypeNameVersion","Miranda NG Skype" ));
+ json_push_back(publicInfo, json_new_a ("nodeInfo", "xx" ));
+ json_push_back(publicInfo, json_new_a ("version", verString.GetBuffer() ));
+
+ json_push_back(node, privateInfo);
+ json_push_back(node, publicInfo);
+
+ ptrA data(mir_utf8encodeT(ptrT(json_write(node))));
+
Body <<
VALUE(data);
+
+ json_delete(node);
}
};
#endif //_SKYPE_REQUEST_CAPS_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h
index 2490329140..d0f8c60460 100644
--- a/protocols/SkypeWeb/src/requests/subscriptions.h
+++ b/protocols/SkypeWeb/src/requests/subscriptions.h
@@ -28,9 +28,25 @@ public:
<< CHAR_VALUE("Accept", "application/json, text/javascript")
<< FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+
+ JSONNODE *node = json_new(5);
+ JSONNODE *interestedResources = json_new(4);
+ json_set_name(interestedResources, "interestedResources");
- const char *data = "{\"channelType\":\"httpLongPoll\",\"template\":\"raw\",\"interestedResources\":[\"/v1/users/ME/conversations/ALL/properties\",\"/v1/users/ME/conversations/ALL/messages\",\"/v1/users/ME/contacts/ALL\",\"/v1/threads/ALL\"]}";
+ json_push_back(node, json_new_a("channelType", "httpLongPoll"));
+ json_push_back(node, json_new_a("template", "raw" ));
+
+ json_push_back(interestedResources, json_new_a(NULL, "/v1/users/ME/conversations/ALL/properties"));
+ json_push_back(interestedResources, json_new_a(NULL, "/v1/users/ME/conversations/ALL/messages"));
+ json_push_back(interestedResources, json_new_a(NULL, "/v1/users/ME/contacts/ALL"));
+ json_push_back(interestedResources, json_new_a(NULL, "/v1/threads/ALL"));
+ json_push_back(node, interestedResources);
+
+ ptrA data(mir_utf8encodeT(ptrT(json_write(node))));
+
Body << VALUE(data);
+
+ json_delete(node);
}
};
diff --git a/protocols/SkypeWeb/src/requests/trouter.h b/protocols/SkypeWeb/src/requests/trouter.h
index 0e64aa9590..0401d0f13a 100644
--- a/protocols/SkypeWeb/src/requests/trouter.h
+++ b/protocols/SkypeWeb/src/requests/trouter.h
@@ -59,10 +59,37 @@ public:
<< CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml")
<< CHAR_VALUE("X-Skypetoken", token);
- CMStringA data;
- data.AppendFormat("{\"clientDescription\":{\"aesKey\":\"\",\"languageId\":\"en-US\",\"platform\":\"SWX\",\"templateKey\":\"SkypeWeb_1.0\"},\"registrationId\":\"%s\",\"nodeId\":\"\",\"transports\":{\"TROUTER\":[{\"context\":\"\",\"path\":\"%s\",\"ttl\":3600}]}}", id, trouterUrl);
+ JSONNODE *node = json_new(5);
+ JSONNODE *clientDescription = json_new(5);
+ JSONNODE *transports = json_new(5);
+ JSONNODE *TRouter = json_new(5);
+ JSONNODE *TROUTER = json_new(4);
+
+ json_set_name(clientDescription, "clientDescription");
+ json_set_name(transports, "transports");
+ json_set_name(TROUTER, "TROUTER");
+
+ json_push_back(node, json_new_a("registrationId", id ));
+ json_push_back(node, json_new_a("nodeId", "" ));
+
+ json_push_back(clientDescription, json_new_a("aesKey", "" ));
+ json_push_back(clientDescription, json_new_a("languageId", "en-US" ));
+ json_push_back(clientDescription, json_new_a("platform", "SWX" ));
+ json_push_back(clientDescription, json_new_a("templateKey", "SkypeWeb_1.0"));
+ json_push_back(node, clientDescription);
+
+ json_push_back(TRouter, json_new_a("context", ""));
+ json_push_back(TRouter, json_new_a("path", trouterUrl));
+ json_push_back(TRouter, json_new_i("ttl", 3600));
+ json_push_back(TROUTER, TRouter);
+ json_push_back(transports, TROUTER);
+ json_push_back(node, transports);
+
+ ptrA data(mir_utf8encodeT(ptrT(json_write(node))));
Body << VALUE(data);
+
+ json_delete(node);
}
};
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index aa9f07d748..c9d3dca714 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -192,7 +192,8 @@ INT_PTR CSkypeProto::OnJoinChatRoom(WPARAM hContact, LPARAM)
if (hContact)
{
ptrT idT(getTStringA(hContact, "ChatRoomID"));
- StartChatRoom(idT, idT);
+ ptrT nameT(getTStringA(hContact, "Nick"));
+ StartChatRoom(idT, nameT != NULL ? nameT : idT);
}
return 0;
}
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp
index fc855687af..747f3f299b 100644
--- a/protocols/SkypeWeb/src/skype_history_sync.cpp
+++ b/protocols/SkypeWeb/src/skype_history_sync.cpp
@@ -176,8 +176,12 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response)
HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("URIObject"));
if (xml != NULL)
{
- ptrA url(mir_t2a(xi.getAttrValue(xml, L"url_thumbnail")));
- AddMessageToDb(hContact, timestamp, flags, clientMsgId, url);
+ ptrA url(mir_t2a(xi.getAttrValue(xml, L"uri")));
+ ptrA object(ParseUrl(url, "/objects/"));
+
+ CMStringA data(FORMAT, "%s: https://api.asm.skype.com/s/i?%s", Translate("Image"), object);
+
+ AddMessageToDb(hContact, timestamp, flags, clientMsgId, data.GetBuffer());
}
} //Picture
}
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 18f2fe8775..3eb0064718 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -382,7 +382,7 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node)
if (clientMsgId && (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText")))
{
- PushRequest(new MarkMessageReadRequest(skypename, RegToken, _ttoi(json_as_string(json_get(node, "id"))), timestamp, false, Server));
+ PushRequest(new MarkMessageReadRequest(skypename, RegToken, _ttoi(json_as_string(json_get(node, "id"))), timestamp, false, Server));
}
}
diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp
index 7097dc658b..c39c3bc0ee 100644
--- a/protocols/SkypeWeb/src/skype_options.cpp
+++ b/protocols/SkypeWeb/src/skype_options.cpp
@@ -47,7 +47,7 @@ void CSkypeOptionsMain::OnInitDialog()
void CSkypeOptionsMain::OnApply()
{
- if (mir_strcmpi(m_proto->getStringA(SKYPE_SETTINGS_ID), m_skypename.GetTextA()) || mir_strcmpi(m_proto->getStringA("Password"), m_password.GetTextA()))
+ if (mir_strcmpi(ptrA(m_proto->getStringA(SKYPE_SETTINGS_ID)), ptrA(m_skypename.GetTextA())) || mir_strcmpi(ptrA(m_proto->getStringA("Password")), ptrA(m_password.GetTextA())))
m_proto->delSetting("TokenExpiresIn");
m_proto->setString(SKYPE_SETTINGS_ID, m_skypename.GetTextA());
m_proto->setString("Password", m_password.GetTextA());
diff --git a/protocols/SkypeWeb/src/skype_poll_processing.cpp b/protocols/SkypeWeb/src/skype_poll_processing.cpp
index 2e48339b86..ead44bb3a3 100644
--- a/protocols/SkypeWeb/src/skype_poll_processing.cpp
+++ b/protocols/SkypeWeb/src/skype_poll_processing.cpp
@@ -92,7 +92,7 @@ void CSkypeProto::ProcessUserPresenceRes(JSONNODE *node)
ptrA selfLink(mir_t2a(ptrT(json_as_string(json_get(node, "selfLink")))));
ptrA status(mir_t2a(ptrT(json_as_string(json_get(node, "status")))));
- char *skypename;
+ ptrA skypename;
if (strstr(selfLink, "/8:"))
{
diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp
index 3b026e0292..8153e681c3 100644
--- a/protocols/SkypeWeb/src/skype_search.cpp
+++ b/protocols/SkypeWeb/src/skype_search.cpp
@@ -28,13 +28,13 @@ void CSkypeProto::SearchBasicThread(void* id)
debugLogA("CSkypeProto::OnSearchBasicThread");
if (!IsOnline())
return;
- ptrA token(getStringA("TokenSecret"));
ptrA string(mir_urlEncode(ptrA(mir_utf8encodeT((TCHAR*)id))));
- SendRequest(new GetSearchRequest(token, string), &CSkypeProto::OnSearch);
+ SendRequest(new GetSearchRequest(TokenSecret, string), &CSkypeProto::OnSearch);
}
void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response)
{
+ debugLogA(__FUNCTION__);
if (response == NULL)
{
ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
diff --git a/protocols/SkypeWeb/src/version.h b/protocols/SkypeWeb/src/version.h
index a28642f9ab..ac4f137709 100644
--- a/protocols/SkypeWeb/src/version.h
+++ b/protocols/SkypeWeb/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 11
#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>