diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-02-07 09:54:16 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-02-07 09:54:16 +0000 |
commit | 7bdabace3f6ab47b8571cdec9bfd6f5b2c360b46 (patch) | |
tree | 5d450c2098f6316df8bc3f42c7988c94eb1c2a0d /protocols/SkypeWeb/src/requests | |
parent | 941dca4cf7a93100c19a6e3b92e1bc6bf9e71f04 (diff) |
SkypeWeb: files sending
git-svn-id: http://svn.miranda-ng.org/main/trunk@16233 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/requests')
-rw-r--r-- | protocols/SkypeWeb/src/requests/asm/files.h (renamed from protocols/SkypeWeb/src/requests/asm/images.h) | 15 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/messages.h | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/poll.h | 1 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/trouter.h | 1 |
4 files changed, 13 insertions, 8 deletions
diff --git a/protocols/SkypeWeb/src/requests/asm/images.h b/protocols/SkypeWeb/src/requests/asm/files.h index d1494c01ef..7d13524945 100644 --- a/protocols/SkypeWeb/src/requests/asm/images.h +++ b/protocols/SkypeWeb/src/requests/asm/files.h @@ -3,18 +3,20 @@ class ASMObjectCreateRequest : public HttpRequest
{
public:
- ASMObjectCreateRequest(LoginInfo &li, const char *szContact) :
+ ASMObjectCreateRequest(LoginInfo &li, const char *szContact, const char *szFileName) :
HttpRequest(REQUEST_POST, "api.asm.skype.com/v1/objects")
{
+ flags &= (~NLHRF_DUMPASTEXT);
Headers
- << CHAR_VALUE("Authorization:", CMStringA(::FORMAT, "skype_token %s", li.api.szToken));
+ << CHAR_VALUE("Authorization", CMStringA(::FORMAT, "skype_token %s", li.api.szToken))
+ << CHAR_VALUE("Content-Type", "text/json");
JSONNode node, jPermissions, jPermission(JSON_ARRAY);
jPermissions.set_name("permissions");
jPermission.set_name(szContact);
- jPermission << JSONNode("read", (char*)NULL);
+ //jPermission << JSONNode("read");
jPermissions << jPermission;
- node << JSONNode("type", "pish/image") << jPermissions;
+ node << JSONNode("type", "sharing/file") << JSONNode("filename", szFileName) << jPermissions;
Body << VALUE(node.write().c_str());
@@ -25,10 +27,11 @@ class ASMObjectUploadRequest : public HttpRequest {
public:
ASMObjectUploadRequest(LoginInfo &li, const char *szObject, const PBYTE data, const size_t size) :
- HttpRequest(REQUEST_PUT, FORMAT, "api.asm.skype.com/v1/objects/%s/content/imgpsh", szObject)
+ HttpRequest(REQUEST_PUT, FORMAT, "api.asm.skype.com/v1/objects/%s/content/original", szObject)
{
Headers
- << CHAR_VALUE("Authorization:", CMStringA(::FORMAT, "skype_token %s", li.api.szToken));
+ << CHAR_VALUE("Authorization", CMStringA(::FORMAT, "skype_token %s", li.api.szToken))
+ << CHAR_VALUE("Content-Type", "application/octet-stream");
pData = (char*)mir_alloc(size);
memcpy(pData, data, size);
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index 66df812202..5132d13003 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class SendMessageRequest : public HttpRequest
{
public:
- SendMessageRequest(const char *username, time_t timestamp, const char *message, LoginInfo &li) :
+ SendMessageRequest(const char *username, time_t timestamp, const char *message, LoginInfo &li, const char *MessageType = nullptr) :
HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", li.endpoint.szServer, username)
{
Headers
@@ -32,7 +32,7 @@ public: JSONNode node;
node
<< JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu", (ULONGLONG)timestamp))
- << JSONNode("messagetype", "Text")
+ << JSONNode("messagetype", MessageType ? MessageType : "Text")
<< JSONNode("contenttype", "text")
<< JSONNode("content", message);
diff --git a/protocols/SkypeWeb/src/requests/poll.h b/protocols/SkypeWeb/src/requests/poll.h index 25b05d56b1..24c5146de6 100644 --- a/protocols/SkypeWeb/src/requests/poll.h +++ b/protocols/SkypeWeb/src/requests/poll.h @@ -25,6 +25,7 @@ public: HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions/0/poll", li.endpoint.szServer)
{
timeout = 60000;
+ flags |= NLHRF_PERSISTENT;
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
<< FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken);
diff --git a/protocols/SkypeWeb/src/requests/trouter.h b/protocols/SkypeWeb/src/requests/trouter.h index 910c442695..1de1dc83ac 100644 --- a/protocols/SkypeWeb/src/requests/trouter.h +++ b/protocols/SkypeWeb/src/requests/trouter.h @@ -132,6 +132,7 @@ public: HttpRequest(REQUEST_GET, FORMAT, "%ssocket.io/1/xhr-polling/%s", socketio.c_str(), sessId.c_str())
{
timeout = 60000;
+ flags |= NLHRF_PERSISTENT;
Url
<< CHAR_VALUE("sr", sr.c_str())
<< CHAR_VALUE("issuer", "edf")
|