summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-04-05 13:53:50 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-04-05 13:53:50 +0000
commit7c2b6ea1c3af9aab4c265ddc7ab6a6c2a07be5cc (patch)
tree8fe2c16fcd96e44d54326fdc8f4b4ac2ea5c42da /protocols/SkypeWeb
parent5413f05df37646178533a24f80e0e0238982af36 (diff)
SkypeWeb: cleanup headers (patch from MikalaiR)
git-svn-id: http://svn.miranda-ng.org/main/trunk@12611 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r--protocols/SkypeWeb/src/requests/endpoint.h7
-rw-r--r--protocols/SkypeWeb/src/requests/login.h8
-rw-r--r--protocols/SkypeWeb/src/requests/messages.h21
-rw-r--r--protocols/SkypeWeb/src/requests/poll.h10
-rw-r--r--protocols/SkypeWeb/src/requests/profile.h4
-rw-r--r--protocols/SkypeWeb/src/requests/reg_info.h6
-rw-r--r--protocols/SkypeWeb/src/requests/status.h11
-rw-r--r--protocols/SkypeWeb/src/requests/subscriptions.h7
-rw-r--r--protocols/SkypeWeb/src/skype_polling.cpp3
9 files changed, 13 insertions, 64 deletions
diff --git a/protocols/SkypeWeb/src/requests/endpoint.h b/protocols/SkypeWeb/src/requests/endpoint.h
index 11273e15cf..8af43de6c3 100644
--- a/protocols/SkypeWeb/src/requests/endpoint.h
+++ b/protocols/SkypeWeb/src/requests/endpoint.h
@@ -9,13 +9,8 @@ public:
{
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");
+ << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
CMStringA data;
int bitness = 32;
diff --git a/protocols/SkypeWeb/src/requests/login.h b/protocols/SkypeWeb/src/requests/login.h
index 54af48f211..e972852d07 100644
--- a/protocols/SkypeWeb/src/requests/login.h
+++ b/protocols/SkypeWeb/src/requests/login.h
@@ -12,10 +12,6 @@ public:
Url
<< INT_VALUE("client_id", 578134)
<< CHAR_VALUE("redirect_uri", "https%3A%2F%2Fweb.skype.com");
-
- Headers
- << CHAR_VALUE("Host", "login.skype.com")
- << CHAR_VALUE("Connection", "keep-alive");
}
LoginRequest(const char *skypename, const char *password, const char *pie, const char *etm) :
@@ -28,9 +24,7 @@ public:
<< CHAR_VALUE("redirect_uri", "https%3A%2F%2Fweb.skype.com");
Headers
- << CHAR_VALUE("Host", "login.skype.com")
- << CHAR_VALUE("Referer", "https://login.skype.com/login?method=skype&client_id=578134&redirect_uri=https%3A%2F%2Fweb.skype.com")
- << CHAR_VALUE("Connection", "keep-alive");
+ << CHAR_VALUE("Referer", "https://login.skype.com/login?method=skype&client_id=578134&redirect_uri=https%3A%2F%2Fweb.skype.com");
LPTIME_ZONE_INFORMATION tzi = tmi.getTziByContact(NULL);
char sign = tzi->Bias > 0 ? '-' : '+';
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h
index 130dd0c938..d58fc131aa 100644
--- a/protocols/SkypeWeb/src/requests/messages.h
+++ b/protocols/SkypeWeb/src/requests/messages.h
@@ -9,13 +9,8 @@ public:
{
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");
+ << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
CMStringA data;
data.AppendFormat("{\"clientmessageid\":\"%lld\",\"content\":\"%s\",\"messagetype\":\"RichText\",\"contenttype\":\"text\"}", timestamp, message);
@@ -32,13 +27,8 @@ public:
{
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");
+ << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
CMStringA state;
if (bstate) state = "Control/Typing";
else state = "Control/ClearTyping";
@@ -57,13 +47,8 @@ public:
{
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");
+ << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
}
};
diff --git a/protocols/SkypeWeb/src/requests/poll.h b/protocols/SkypeWeb/src/requests/poll.h
index 538e482eac..585a7a1ca4 100644
--- a/protocols/SkypeWeb/src/requests/poll.h
+++ b/protocols/SkypeWeb/src/requests/poll.h
@@ -8,17 +8,11 @@ public:
HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions/0/poll", server)
{
//timeout = 30 * 1000;
- //flags |= NLHRF_PERSISTENT;
+ flags |= NLHRF_PERSISTENT;
Headers
<< CHAR_VALUE("Connection", "keep-alive")
<< 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");
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
}
};
#endif //_SKYPE_POLL_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/requests/profile.h b/protocols/SkypeWeb/src/requests/profile.h
index e7d7a4b682..55ddc497c5 100644
--- a/protocols/SkypeWeb/src/requests/profile.h
+++ b/protocols/SkypeWeb/src/requests/profile.h
@@ -10,10 +10,6 @@ public:
Headers
<< CHAR_VALUE("X-Skypetoken", token)
<< CHAR_VALUE("Accept", "application/json");
-
-
- //AddHeader("Origin", "https://web.skype.com");
- //AddHeader("Referer", "https://web.skype.com/main");
}
};
diff --git a/protocols/SkypeWeb/src/requests/reg_info.h b/protocols/SkypeWeb/src/requests/reg_info.h
index d1f5191fc9..e90d3be855 100644
--- a/protocols/SkypeWeb/src/requests/reg_info.h
+++ b/protocols/SkypeWeb/src/requests/reg_info.h
@@ -9,12 +9,8 @@ public:
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("Expires", "0")
<< FORMAT_VALUE("Authentication", "skypetoken=%s", token)
- << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8")
- << CHAR_VALUE("Referer", "https://web.skype.com/main")
- << CHAR_VALUE("Origin", "https://web.skype.com")
- << CHAR_VALUE("Connection", "keep-alive");
+ << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
Body << VALUE("{}");
}
diff --git a/protocols/SkypeWeb/src/requests/status.h b/protocols/SkypeWeb/src/requests/status.h
index a8bbdc82f0..f7669e2197 100644
--- a/protocols/SkypeWeb/src/requests/status.h
+++ b/protocols/SkypeWeb/src/requests/status.h
@@ -7,19 +7,12 @@ public:
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")
- << CHAR_VALUE("Expires", "0")
- << CHAR_VALUE("RegistrationToken", auth)
- << 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");
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
Body << VALUE(statuss);
}
diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h
index cd29aa8da4..236b26f7cc 100644
--- a/protocols/SkypeWeb/src/requests/subscriptions.h
+++ b/protocols/SkypeWeb/src/requests/subscriptions.h
@@ -9,13 +9,8 @@ public:
{
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");
+ << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
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\"]}";
Body << VALUE(data);
diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp
index 5cd679aa8d..e963aad83b 100644
--- a/protocols/SkypeWeb/src/skype_polling.cpp
+++ b/protocols/SkypeWeb/src/skype_polling.cpp
@@ -58,11 +58,12 @@ void CSkypeProto::PollingThread(void*)
{
PollRequest *request = new PollRequest(regToken, server);
NETLIBHTTPREQUEST *response = request->Send(m_hNetlibUser);
+ m_pollingConnection = request->nlc;
delete request;
+
if (response != NULL)
{
- m_pollingConnection = response->nlc;
JSONROOT root(response->pData);
if (json_get(root, "errorCode") != NULL)
{