summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-04-18 22:24:28 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-04-18 22:24:28 +0000
commit0e78d281be6ce359321346526f9687bab987d9e1 (patch)
tree6824185b4baa11cff7fa006249e2ef7e2276ceed
parentb6c4bc14c137ecf8f4bea73f01ebde7786bf8a0f (diff)
Steam: fixed captacha & guard dialogs
git-svn-id: http://svn.miranda-ng.org/main/trunk@12926 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Steam/src/steam_account.cpp6
-rw-r--r--protocols/Steam/src/steam_dialogs.cpp20
-rw-r--r--protocols/Steam/src/steam_dialogs.h7
3 files changed, 19 insertions, 14 deletions
diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp
index 2ed21e78dc..9ea391ad95 100644
--- a/protocols/Steam/src/steam_account.cpp
+++ b/protocols/Steam/src/steam_account.cpp
@@ -115,7 +115,7 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
ptrA timestamp(getStringA("RsaTimestamp"));
PushRequest(
- new SteamWebApi::AuthorizationRequest(username, password, timestamp, ptrA(guardDialog.GetGuardCode())),
+ new SteamWebApi::AuthorizationRequest(username, password, timestamp, guardDialog.GetGuardCode()),
&CSteamProto::OnAuthorization);
return;
}
@@ -138,14 +138,12 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
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, ptrA(captchaDialog.GetCaptchaText())),
+ new SteamWebApi::AuthorizationRequest(username, password, timestamp, captchaId, captchaDialog.GetCaptchaText()),
&CSteamProto::OnAuthorization);
return;
}
diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp
index 13df916cf0..c071c7cc84 100644
--- a/protocols/Steam/src/steam_dialogs.cpp
+++ b/protocols/Steam/src/steam_dialogs.cpp
@@ -59,6 +59,7 @@ void CSteamGuardDialog::OnInitDialog()
void CSteamGuardDialog::OnOk(CCtrlButton*)
{
+ mir_strncpy(m_guardCode, ptrA(m_text.GetTextA()), SIZEOF(m_guardCode) + 1);
EndDialog(m_hwnd, 1);
}
@@ -67,16 +68,17 @@ void CSteamGuardDialog::OnClose()
Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "GuardWindow");
}
-char * CSteamGuardDialog::GetGuardCode()
+const char* CSteamGuardDialog::GetGuardCode()
{
- return m_text.GetTextA();
+ return m_guardCode;
}
/////////////////////////////////////////////////////////////////////////////////
CSteamCaptchaDialog::CSteamCaptchaDialog(CSteamProto *proto, BYTE *captchaImage, int captchaImageSize) :
- CSuper(proto, IDD_GUARD, false),
- m_ok(this, IDOK), m_text(this, IDC_TEXT)
+ CSuper(proto, IDD_CAPTCHA, false),
+ m_ok(this, IDOK), m_text(this, IDC_TEXT),
+ m_captchaImage(NULL)
{
m_captchaImageSize = captchaImageSize;
m_captchaImage = (BYTE*)mir_alloc(captchaImageSize);
@@ -86,7 +88,8 @@ CSteamCaptchaDialog::CSteamCaptchaDialog(CSteamProto *proto, BYTE *captchaImage,
CSteamCaptchaDialog::~CSteamCaptchaDialog()
{
- mir_free(m_captchaImage);
+ if(m_captchaImage)
+ mir_free(m_captchaImage);
}
void CSteamCaptchaDialog::OnInitDialog()
@@ -96,13 +99,14 @@ void CSteamCaptchaDialog::OnInitDialog()
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIcon(iconName, 16));
SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIcon(iconName, 32));
- SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 5, 0);
+ SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 6, 0);
Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "CaptchaWindow");
}
void CSteamCaptchaDialog::OnOk(CCtrlButton*)
{
+ mir_strncpy(m_captchaText, ptrA(m_text.GetTextA()), SIZEOF(m_captchaText) + 1);
EndDialog(m_hwnd, 1);
}
@@ -158,9 +162,9 @@ INT_PTR CSteamCaptchaDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
-char * CSteamCaptchaDialog::GetCaptchaText()
+const char* CSteamCaptchaDialog::GetCaptchaText()
{
- return m_text.GetTextA();
+ return m_captchaText;
}
/////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Steam/src/steam_dialogs.h b/protocols/Steam/src/steam_dialogs.h
index 768d87c75c..d98eac7222 100644
--- a/protocols/Steam/src/steam_dialogs.h
+++ b/protocols/Steam/src/steam_dialogs.h
@@ -32,6 +32,7 @@ private:
typedef CSteamDlgBase CSuper;
char m_domain[32];
+ char m_guardCode[5];
CCtrlEdit m_text;
CCtrlButton m_ok;
@@ -45,7 +46,7 @@ protected:
public:
CSteamGuardDialog(CSteamProto *proto, char *domain);
- char *GetGuardCode();
+ const char *GetGuardCode();
};
/////////////////////////////////////////////////////////////////////////////////
@@ -55,6 +56,8 @@ class CSteamCaptchaDialog : public CSteamDlgBase
private:
typedef CSteamDlgBase CSuper;
+ char m_captchaText[6];
+
BYTE *m_captchaImage;
int m_captchaImageSize;
@@ -72,7 +75,7 @@ public:
CSteamCaptchaDialog(CSteamProto *proto, BYTE *captchaImage, int captchaImageSize);
~CSteamCaptchaDialog();
- char *GetCaptchaText();
+ const char *GetCaptchaText();
};
/////////////////////////////////////////////////////////////////////////////////