summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/requests
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-04-03 05:33:18 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-04-03 05:33:18 +0000
commita50ae784ce7394b2621cf42a28cab7edd31e6c6a (patch)
treed32d2925947e77442d364c1849adfd54bb896276 /protocols/SkypeWeb/src/requests
parent2e511ab1b1ff3d78c695874e3b28ff4ce7680cc8 (diff)
login fix and some other fixes (patch by MikalaiR)
git-svn-id: http://svn.miranda-ng.org/main/trunk@12581 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/requests')
-rw-r--r--protocols/SkypeWeb/src/requests/endpoint.h9
-rw-r--r--protocols/SkypeWeb/src/requests/messages.h29
-rw-r--r--protocols/SkypeWeb/src/requests/poll.h4
-rw-r--r--protocols/SkypeWeb/src/requests/reg_info.h4
-rw-r--r--protocols/SkypeWeb/src/requests/status.h8
-rw-r--r--protocols/SkypeWeb/src/requests/subscriptions.h4
6 files changed, 43 insertions, 15 deletions
diff --git a/protocols/SkypeWeb/src/requests/endpoint.h b/protocols/SkypeWeb/src/requests/endpoint.h
index f6dd9c604c..a5d05b7ec7 100644
--- a/protocols/SkypeWeb/src/requests/endpoint.h
+++ b/protocols/SkypeWeb/src/requests/endpoint.h
@@ -4,8 +4,8 @@
class GetEndpointRequest : public HttpRequest
{
public:
- GetEndpointRequest(const char *regToken, const char *endpointID) :
- HttpRequest(REQUEST_PUT, FORMAT, "client-s.gateway.messenger.live.com/v1/users/ME/endpoints/%s/presenceDocs/messagingService", ptrA(mir_urlEncode(endpointID)))
+ GetEndpointRequest(const char *regToken, const char *endpointID, const char *server = "client-s.gateway.messenger.live.com") :
+ HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/endpoints/%s/presenceDocs/messagingService", server, ptrA(mir_urlEncode(endpointID)))
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
@@ -16,9 +16,10 @@ public:
<< CHAR_VALUE("Referer", "https://web.skype.com/main")
<< CHAR_VALUE("Origin", "https://web.skype.com")
<< CHAR_VALUE("Connection", "keep-alive");
-
+ CMStringA data;
+ data.AppendFormat ("{\"id\":\"messagingService\",\"type\":\"EndpointPresenceDoc\",\"selfLink\":\"uri\",\"privateInfo\":{\"epname\":\"Miranda\"},\"publicInfo\":{\"capabilities\":\"\",\"typ\":125,\"skypeNameVersion\":\"0/%s//\",\"nodeInfo\":\"xx\",\"version\":\"0/%s\"}}", MIRANDA_VERSION_STRING, MIRANDA_VERSION_STRING);
Body <<
- VALUE("{\"id\":\"messagingService\",\"type\":\"EndpointPresenceDoc\",\"selfLink\":\"uri\",\"privateInfo\":{\"epname\":\"Miranda\"},\"publicInfo\":{\"capabilities\":\"\",\"type\":1,\"skypeNameVersion\":\"0/0.95.4//\",\"nodeInfo\":\"xx\",\"version\":\"0/0.95.4\"}}");
+ VALUE(data);
}
};
#endif //_SKYPE_REQUEST_ENDPOINT_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h
index e86f54fce9..ecd939bbd0 100644
--- a/protocols/SkypeWeb/src/requests/messages.h
+++ b/protocols/SkypeWeb/src/requests/messages.h
@@ -4,8 +4,8 @@
class SendMsgRequest : public HttpRequest
{
public:
- SendMsgRequest(const char *regToken, const char *username, const char *message) :
- HttpRequest(REQUEST_POST, FORMAT, "client-s.gateway.messenger.live.com/v1/users/ME/conversations/8:%s/messages", username)
+ SendMsgRequest(const char *regToken, const char *username, const char *message, const char *server = "client-s.gateway.messenger.live.com") :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", server, username)
{
Headers
<< CHAR_VALUE("Accept", "application / json, text / javascript")
@@ -21,4 +21,29 @@ public:
}
};
+class SendTypingRequest : public HttpRequest
+{
+public:
+ SendTypingRequest(const char *regToken, const char *username,bool bstate, const char *server = "client-s.gateway.messenger.live.com") :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", server, mir_urlEncode(username))
+ {
+ Headers
+ << CHAR_VALUE("Accept", "application / json, text / javascript")
+ << CHAR_VALUE("Expires", "0")
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8")
+ << CHAR_VALUE("BehaviorOverride", "redirectAs404")
+ << CHAR_VALUE("Referer", "https://web.skype.com/main")
+ << CHAR_VALUE("Origin", "https://web.skype.com")
+ << CHAR_VALUE("Connection", "keep-alive");
+ CMStringA state;
+ if (bstate) state = "Control/Typing";
+ else state = "Control/ClearTyping";
+ CMStringA data;
+ data.AppendFormat("{\"clienmessageid\":%d, \"content\":\"\", \"messagetype\":\"%s\", \"contenttype\":\"text\"}", time(NULL), state);
+
+ Body << VALUE(data);
+ }
+};
+
#endif //_SKYPE_REQUEST_MESSAGES_H_
diff --git a/protocols/SkypeWeb/src/requests/poll.h b/protocols/SkypeWeb/src/requests/poll.h
index 48108ccdbc..538e482eac 100644
--- a/protocols/SkypeWeb/src/requests/poll.h
+++ b/protocols/SkypeWeb/src/requests/poll.h
@@ -4,8 +4,8 @@
class PollRequest : public HttpRequest
{
public:
- PollRequest(const char *regToken) :
- HttpRequest(REQUEST_POST, "client-s.gateway.messenger.live.com/v1/users/ME/endpoints/SELF/subscriptions/0/poll")
+ PollRequest(const char *regToken, const char *server = "client-s.gateway.messenger.live.com") :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions/0/poll", server)
{
//timeout = 30 * 1000;
//flags |= NLHRF_PERSISTENT;
diff --git a/protocols/SkypeWeb/src/requests/reg_info.h b/protocols/SkypeWeb/src/requests/reg_info.h
index 47f649ec61..d1f5191fc9 100644
--- a/protocols/SkypeWeb/src/requests/reg_info.h
+++ b/protocols/SkypeWeb/src/requests/reg_info.h
@@ -4,8 +4,8 @@
class GetRegInfoRequest : public HttpRequest
{
public:
- GetRegInfoRequest(const char *token) :
- HttpRequest(REQUEST_POST, "client-s.gateway.messenger.live.com/v1/users/ME/endpoints")
+ GetRegInfoRequest(const char *token, const char *server = "client-s.gateway.messenger.live.com") :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints", server)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
diff --git a/protocols/SkypeWeb/src/requests/status.h b/protocols/SkypeWeb/src/requests/status.h
index 1fc30bac81..a8bbdc82f0 100644
--- a/protocols/SkypeWeb/src/requests/status.h
+++ b/protocols/SkypeWeb/src/requests/status.h
@@ -4,10 +4,12 @@
class SetStatusRequest : public HttpRequest
{
public:
- SetStatusRequest(const char *regToken, const char *status) :
- HttpRequest(REQUEST_PUT, "client-s.gateway.messenger.live.com/v1/users/ME/presenceDocs/messagingService")
+ SetStatusRequest(const char *regToken, const char *status, const char *server = "client-s.gateway.messenger.live.com") :
+ HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/presenceDocs/messagingService", server)
{
CMStringA auth = "registrationToken=";
+ CMStringA statuss;
+ statuss.AppendFormat("{\"status\":\"%s\"}", status);
auth += regToken;
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
@@ -19,7 +21,7 @@ public:
<< CHAR_VALUE("Origin", "https://web.skype.com")
<< CHAR_VALUE("Connection", "keep-alive");
- Body << FORMAT_VALUE("{\"status\":\"%s\"}", status);
+ Body << VALUE(statuss);
}
};
diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h
index 624c7685a4..cd29aa8da4 100644
--- a/protocols/SkypeWeb/src/requests/subscriptions.h
+++ b/protocols/SkypeWeb/src/requests/subscriptions.h
@@ -4,8 +4,8 @@
class SubscriptionsRequest : public HttpRequest
{
public:
- SubscriptionsRequest(const char *regToken) :
- HttpRequest(REQUEST_POST, "client-s.gateway.messenger.live.com/v1/users/ME/endpoints/SELF/subscriptions")
+ SubscriptionsRequest(const char *regToken, const char *server = "client-s.gateway.messenger.live.com") :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions", server)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")