summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-04-29 13:54:24 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-04-29 13:54:24 +0000
commitd667adb8f13d6e8917c225260631ad6905c3fbcf (patch)
tree2d9e8f59b19274b45b1bc150ecd265ee2240182a /protocols/SkypeWeb
parent89113840fb4160af43bbc6cc22b1b13c5118259d (diff)
SkypeWeb: TRouter support part 0.2.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13241 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r--protocols/SkypeWeb/src/requests/trouter.h35
-rw-r--r--protocols/SkypeWeb/src/skype_login.cpp1
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h9
-rw-r--r--protocols/SkypeWeb/src/skype_trouter.cpp59
4 files changed, 97 insertions, 7 deletions
diff --git a/protocols/SkypeWeb/src/requests/trouter.h b/protocols/SkypeWeb/src/requests/trouter.h
index 833c1d850f..02f29e84d9 100644
--- a/protocols/SkypeWeb/src/requests/trouter.h
+++ b/protocols/SkypeWeb/src/requests/trouter.h
@@ -19,7 +19,7 @@ class CreateTrouterRequest : public HttpRequest
{
public:
CreateTrouterRequest() :
- HttpRequest(REQUEST_POST,"go.trouter.io/v1/users/ME/endpoints")
+ HttpRequest(REQUEST_POST,"go.trouter.io/v2/a")
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
@@ -27,10 +27,10 @@ public:
}
};
-class CreatePoliciesRequest : public HttpRequest
+class CreateTrouterPoliciesRequest : public HttpRequest
{
public:
- CreatePoliciesRequest(const char *token, const char *sr) :
+ CreateTrouterPoliciesRequest(const char *token, const char *sr) :
HttpRequest(REQUEST_POST, FORMAT, "prod.tpc.skype.com/v1/policies")
{
Headers
@@ -49,9 +49,32 @@ public:
//{"sr":"AUKRNgA8_eKV0Ibsx037Gbd8GVrsDg8zLQRt1pH8sCyIAile3gtoWmlq2x1yZ_VNZ3tf","issuer":"edf","sp":"connect","st":"1430236511619","se":"1430318082619","sig":"nYczCdlBENCxoAFLy7lPkGELVV1w5TcUnpSUE2G7GLA"}
};
-//GET https://193-149-88-131.drip.trouter.io/socket.io/1/?sr=AUKRNgA8_eKV0Ibsx037Gbd8GVrsDg8zLQRt1pH8sCyIAile3gtoWmlq2x1yZ_VNZ3tf&issuer=edf&sp=connect&st=1430236511619&se=1430318082619&sig=nYczCdlBENCxoAFLy7lPkGELVV1w5TcUnpSUE2G7GLA&r=193.149.88.131&v=v2&p=443&ccid=huzHTfsZt3wZ&dom=web.skype.com&tc=%7B%22cv%22:%222014.8.26%22,%22hr%22:%22%22,%22ua%22:%22SWX%22,%22v%22:%221.2.273%22%7D&t=1430236827898 HTTP/1.1
-//3725b0e4-a8b6-49c9-9cf1-6bef4672fe7a:150:150:websocket,xhr-polling,jsonp-polling
-// ^ supported
+class GetTrouterRequest : public HttpRequest
+{
+public:
+ GetTrouterRequest(const char *socketio, const char *sr, int st, int se, const char *sig,
+ const char *instance, const char *ccid) :
+ HttpRequest(REQUEST_POST, FORMAT, "%ssocket.io/1/", socketio)
+ {
+ Url
+ << CHAR_VALUE("sr", sr)
+ << CHAR_VALUE("issuer", "edf")
+ << CHAR_VALUE("sp", "connect")
+ << INT_VALUE("st", st)
+ << INT_VALUE("se", se)
+ << CHAR_VALUE("sig", sig)
+ << CHAR_VALUE("r", instance)
+ << CHAR_VALUE("v", "v2")
+ << INT_VALUE("p", 443)
+ << CHAR_VALUE("ccid", ccid)
+ << CHAR_VALUE("tc", ptrA(mir_urlEncode("{\"cv\":\"2014.8.26\",\"hr\":\"\",\"ua\":\"Miranda_NG\",\"v\":\"\"}")))
+ << INT_VALUE("t", time(NULL)*1000);
+
+ Headers
+ << CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
+ }
+};
+
//GET https://193-149-88-131.drip.trouter.io/socket.io/1/websocket/3725b0e4-a8b6-49c9-9cf1-6bef4672fe7a?sr=AUKRNgA8_eKV0Ibsx037Gbd8GVrsDg8zLQRt1pH8sCyIAile3gtoWmlq2x1yZ_VNZ3tf&issuer=edf&sp=connect&st=1430236511619&se=1430318082619&sig=nYczCdlBENCxoAFLy7lPkGELVV1w5TcUnpSUE2G7GLA&r=193.149.88.131&v=v2&p=443&ccid=huzHTfsZt3wZ&dom=web.skype.com&tc=%7B%22cv%22:%222014.8.26%22,%22hr%22:%22%22,%22ua%22:%22SWX%22,%22v%22:%221.2.273%22%7D HTTP/1.1
//is websocket
//
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp
index ea77a60369..b7fc362995 100644
--- a/protocols/SkypeWeb/src/skype_login.cpp
+++ b/protocols/SkypeWeb/src/skype_login.cpp
@@ -109,6 +109,7 @@ void CSkypeProto::OnLoginSuccess()
TokenSecret = getStringA("TokenSecret");
Server = getStringA("Server");
SendRequest(new CreateEndpointRequest(TokenSecret, Server), &CSkypeProto::OnEndpointCreated);
+ SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter);
PushRequest(new GetProfileRequest(TokenSecret), &CSkypeProto::LoadProfile);
PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL);
PushRequest(new GetContactListRequest(TokenSecret), &CSkypeProto::LoadContactList);
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 53e8a2b876..f64e8579e7 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -84,7 +84,7 @@ private:
RequestQueue *requestQueue;
bool isTerminated;
std::map<std::string, std::string> cookies;
- HANDLE m_pollingConnection, m_hPollingThread;
+ HANDLE m_pollingConnection, m_hPollingThread, m_hTrouterThread;
static std::map<std::tstring, std::tstring> languages;
static INT_PTR CALLBACK PasswordEditorProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -144,6 +144,13 @@ private:
void OnCapabilitiesSended (const NETLIBHTTPREQUEST *response);
void OnStatusChanged (const NETLIBHTTPREQUEST *response);
+ //TRouter
+
+ void OnCreateTrouter(const NETLIBHTTPREQUEST *response);
+ void OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response);
+ void OnGetTrouter(const NETLIBHTTPREQUEST *response);
+ void CSkypeProto::TRouterThread(void*);
+
// profile
void UpdateProfileFirstName (JSONNODE *root, MCONTACT hContact = NULL);
void UpdateProfileLastName (JSONNODE *root, MCONTACT hContact = NULL);
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp
index a546bc07eb..c1c2b33468 100644
--- a/protocols/SkypeWeb/src/skype_trouter.cpp
+++ b/protocols/SkypeWeb/src/skype_trouter.cpp
@@ -16,3 +16,62 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common.h"
+void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response)
+{
+ if (response == NULL || response->pData == NULL)
+ return;
+
+ JSONROOT root(response->pData);
+
+ ptrA ccid(mir_t2a(ptrT(json_as_string(json_get(root, "ccid")))));
+ ptrA connId(mir_t2a(ptrT(json_as_string(json_get(root, "connId")))));
+ ptrA id(mir_t2a(ptrT(json_as_string(json_get(root, "cid")))));
+ ptrA instance(mir_t2a(ptrT(json_as_string(json_get(root, "instance")))));
+ ptrA socketio(mir_t2a(ptrT(json_as_string(json_get(root, "socketio")))));
+
+ setString("Trouter_ccid", ccid);
+ setString("Trouter_connId", connId);
+ setString("Trouter_id", id);
+ setString("Trouter_instance", instance);
+ setString("Trouter_socketio", socketio);
+
+ SendRequest(new CreateTrouterPoliciesRequest(TokenSecret, connId), &CSkypeProto::OnTrouterPoliciesCreated);
+}
+
+void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response)
+{
+ if (response == NULL || response->pData == NULL)
+ return;
+
+ JSONROOT root(response->pData);
+
+ int st = _ttoi(json_as_string(json_get(root, "st")));
+ int se = _ttoi(json_as_string(json_get(root, "se")));
+ ptrA sig(mir_t2a(ptrT(json_as_string(json_get(root, "sig")))));
+
+ SendRequest(new GetTrouterRequest
+ (
+ getStringA("Trouter_socketio"),
+ getStringA("Trouter_connId"),
+ st, se, sig,
+ getStringA("Trouter_instance"),
+ getStringA("Trouter_ccid")
+ ));
+
+
+}
+
+void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response)
+{
+ if (response == NULL || response->pData == NULL)
+ return;
+ CMStringA data(response->pData);
+ int iStart = 0;
+ CMStringA szToken = data.Tokenize(";", iStart).Trim();
+ setString("Trouter_SessId", szToken);
+}
+
+void CSkypeProto::TRouterThread(void*)
+{
+
+} \ No newline at end of file