From ab75f8e4a3968c956425844415237a4fa6fcee63 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Tue, 26 May 2015 19:15:20 +0000 Subject: Steam: merge new api git-svn-id: http://svn.miranda-ng.org/main/trunk@13850 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Steam/src/api/authorization.h | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 protocols/Steam/src/api/authorization.h (limited to 'protocols/Steam/src/api/authorization.h') diff --git a/protocols/Steam/src/api/authorization.h b/protocols/Steam/src/api/authorization.h new file mode 100644 index 0000000000..e7b2ee8c39 --- /dev/null +++ b/protocols/Steam/src/api/authorization.h @@ -0,0 +1,59 @@ +#ifndef _STEAM_REQUEST_AUTHORIZATION_H_ +#define _STEAM_REQUEST_AUTHORIZATION_H_ + +class AuthorizationRequest : public HttpRequest +{ +public: + AuthorizationRequest(const char *username, const char *password, const char *timestamp) : + HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/dologin") + { + flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP; + + char data[1024]; + mir_snprintf(data, SIZEOF(data), + "username=%s&password=%s&oauth_client_id=3638BFB1&oauth_scope=read_profile write_profile read_client write_client&captchagid=-1&rsatimestamp=%s", + ptrA(mir_urlEncode(username)), + ptrA(mir_urlEncode(password)), + timestamp); + + SetData(data, strlen(data)); + AddHeader("Content-Type", "application/x-www-form-urlencoded"); + } + + AuthorizationRequest(const char *username, const char *password, const char *timestamp, const char *guardCode) : + HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/dologin") + { + flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP; + + char data[1024]; + mir_snprintf(data, SIZEOF(data), + "username=%s&password=%s&emailauth=%s&loginfriendlyname=MirandaNG&oauth_client_id=3638BFB1&oauth_scope=read_profile write_profile read_client write_client&captchagid=-1&rsatimestamp=%s", + ptrA(mir_urlEncode(username)), + ptrA(mir_urlEncode(password)), + guardCode, + timestamp); + + SetData(data, strlen(data)); + AddHeader("Content-Type", "application/x-www-form-urlencoded"); + } + + AuthorizationRequest(const char *username, const char *password, const char *timestamp, const char *captchaId, const char *captchaText) : + HttpRequest(REQUEST_POST, STEAM_WEB_URL "/mobilelogin/dologin") + { + flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP; + + char data[1024]; + mir_snprintf(data, SIZEOF(data), + "username=%s&password=%s&emailauth=&captchagid=%s&captcha_text=%s&oauth_client_id=3638BFB1&oauth_scope=read_profile write_profile read_client write_client&rsatimestamp=%s", + ptrA(mir_urlEncode(username)), + ptrA(mir_urlEncode(password)), + captchaId, + ptrA(mir_urlEncode(captchaText)), + timestamp); + + SetData(data, strlen(data)); + AddHeader("Content-Type", "application/x-www-form-urlencoded"); + } +}; + +#endif //_STEAM_REQUEST_AUTHORIZATION_H_ -- cgit v1.2.3