summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/requests
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/SkypeWeb/src/requests
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/SkypeWeb/src/requests')
-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
3 files changed, 73 insertions, 4 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);
}
};