From 77633ec5799b374a1899d05ae69a2e5f978f2a7c Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 3 Apr 2015 20:53:10 +0000 Subject: Steam: moved to core ui git-svn-id: http://svn.miranda-ng.org/main/trunk@12594 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Steam/src/steam_account.cpp | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'protocols/Steam/src/steam_account.cpp') diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp index 01adca1cf6..2ed21e78dc 100644 --- a/protocols/Steam/src/steam_account.cpp +++ b/protocols/Steam/src/steam_account.cpp @@ -104,18 +104,18 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) node = json_get(root, "emaildomain"); ptrA emailDomain(mir_utf8encodeW(ptrT(json_as_string(node)))); - GuardParam guard; - mir_strncpy(guard.domain, emailDomain, SIZEOF(guard.domain)); - - if (DialogBoxParam(g_hInstance, MAKEINTRESOURCE(IDD_GUARD), NULL, CSteamProto::GuardProc, (LPARAM)&guard) != IDOK) + CSteamGuardDialog guardDialog(this, emailDomain); + if (!guardDialog.DoModal()) + { return; + } ptrA username(mir_utf8encodeW(getWStringA("Username"))); ptrA password(getStringA("EncryptedPassword")); ptrA timestamp(getStringA("RsaTimestamp")); PushRequest( - new SteamWebApi::AuthorizationRequest(username, password, timestamp, guard.code), + new SteamWebApi::AuthorizationRequest(username, password, timestamp, ptrA(guardDialog.GetGuardCode())), &CSteamProto::OnAuthorization); return; } @@ -130,34 +130,22 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) NETLIBHTTPREQUEST *response = request->Send(m_hNetlibUser); delete request; - CaptchaParam captcha = { 0 }; - captcha.size = response->dataLength; - captcha.data = (BYTE*)mir_alloc(captcha.size); - memcpy(captcha.data, response->pData, captcha.size); - - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); - - int res = DialogBoxParam( - g_hInstance, - MAKEINTRESOURCE(IDD_CAPTCHA), - NULL, - CSteamProto::CaptchaProc, - (LPARAM)&captcha); - - mir_free(captcha.data); - - if (res != 1) + CSteamCaptchaDialog captchaDialog(this, (BYTE*)response->pData, response->dataLength); + if (!captchaDialog.DoModal()) { + CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); SetStatus(ID_STATUS_OFFLINE); return; } + CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); + ptrA username(mir_utf8encodeW(getWStringA("Username"))); ptrA password(getStringA("EncryptedPassword")); ptrA timestamp(getStringA("RsaTimestamp")); PushRequest( - new SteamWebApi::AuthorizationRequest(username, password, timestamp, captchaId, captcha.text), + new SteamWebApi::AuthorizationRequest(username, password, timestamp, captchaId, ptrA(captchaDialog.GetCaptchaText())), &CSteamProto::OnAuthorization); return; } -- cgit v1.2.3