diff options
Diffstat (limited to 'protocols/Steam/src')
-rw-r--r-- | protocols/Steam/src/resource.h | 4 | ||||
-rw-r--r-- | protocols/Steam/src/steam_account.cpp | 21 | ||||
-rw-r--r-- | protocols/Steam/src/steam_dialogs.cpp | 14 |
3 files changed, 26 insertions, 13 deletions
diff --git a/protocols/Steam/src/resource.h b/protocols/Steam/src/resource.h index 3432481021..f2817e7d20 100644 --- a/protocols/Steam/src/resource.h +++ b/protocols/Steam/src/resource.h @@ -23,6 +23,8 @@ #define IDC_GROUP 1021
#define IDC_BM_LIST 1064
#define IDC_TEXT 1082
+#define IDC_CUSTOM1 1083
+#define IDC_BUTTON1 1084
#define IDC_OPENDOMAIN 1200
#define IDC_GETDOMAIN 1200
@@ -32,7 +34,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 120
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1083
+#define _APS_NEXT_CONTROL_VALUE 1085
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp index f05741f0bd..70f1c561d4 100644 --- a/protocols/Steam/src/steam_account.cpp +++ b/protocols/Steam/src/steam_account.cpp @@ -102,7 +102,7 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) new SteamWebApi::AuthorizationRequest(username, base64RsaEncryptedPassword, timestamp, guardId, guard.code),
&CSteamProto::OnAuthorization);
}
-
+
node = json_get(root, "captcha_needed");
if (json_as_bool(node) > 0)
{
@@ -117,8 +117,6 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) NETLIBHTTPREQUEST *response = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)request);
delete request;
- CallService(MS_UTILS_OPENURL, 0, (LPARAM)url);
-
CaptchaParam captcha = { 0 };
captcha.size = response->dataLength;
captcha.data = (BYTE*)mir_alloc(captcha.size);
@@ -126,13 +124,20 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response);
- if (DialogBoxParam(
+ int res = DialogBoxParam(
g_hInstance,
MAKEINTRESOURCE(IDD_CAPTCHA),
NULL,
CSteamProto::CaptchaProc,
- (LPARAM)&captcha) != 1)
+ (LPARAM)&captcha);
+
+ mir_free(captcha.data);
+
+ if (res != 1)
+ {
+ SetStatus(ID_STATUS_OFFLINE);
return;
+ }
ptrA username(mir_urlEncode(ptrA(mir_utf8encodeW(getWStringA("Username")))));
ptrA base64RsaEncryptedPassword(getStringA("EncryptedPassword"));
@@ -143,12 +148,16 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg) &CSteamProto::OnAuthorization);
}
+ SetStatus(ID_STATUS_OFFLINE);
return;
}
-
+
node = json_get(root, "login_complete");
if (!json_as_bool(node))
+ {
+ SetStatus(ID_STATUS_OFFLINE);
return;
+ }
node = json_get(root, "oauth");
root = json_parse(ptrA(mir_u2a(json_as_string(node))));
diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp index 4df9192d81..882a30b70a 100644 --- a/protocols/Steam/src/steam_dialogs.cpp +++ b/protocols/Steam/src/steam_dialogs.cpp @@ -83,18 +83,20 @@ INT_PTR CALLBACK CSteamProto::CaptchaProc(HWND hwnd, UINT message, WPARAM wParam return 0;
}
- FIMEMORY *memory = fei->FI_OpenMemory(captcha->data, captcha->size);
- FIBITMAP *bitmap = fei->FI_LoadFromMemory(FIF_PNG, memory, PNG_DEFAULT);
- fei->FI_CloseMemory(memory);
+ FIMEMORY *stream = fei->FI_OpenMemory(captcha->data, captcha->size);
+ FREE_IMAGE_FORMAT fif = fei->FI_GetFileTypeFromMemory(stream, 0);
+ FIBITMAP *bitmap = fei->FI_LoadFromMemory(fif, stream, 0);
+ fei->FI_CloseMemory(stream);
PAINTSTRUCT ps;
HDC hDC = BeginPaint(hwnd, &ps);
- SetStretchBltMode(hDC, COLORONCOLOR);
+ //SetStretchBltMode(hDC, COLORONCOLOR);
StretchDIBits(
hDC,
- 0, 0,
- 206, 40,
+ 11, 11,
+ fei->FI_GetWidth(bitmap) - 13,
+ fei->FI_GetHeight(bitmap),
0, 0,
fei->FI_GetWidth(bitmap),
fei->FI_GetHeight(bitmap),
|