summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/dialogs.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2016-04-17 11:14:33 +0000
committerRobert Pösel <robyer@seznam.cz>2016-04-17 11:14:33 +0000
commit1218cb54337c4683baf728bec19701da1f10e5ac (patch)
tree925726d9fbed53764efebbe7e1bbbbf2bd8339f9 /protocols/FacebookRM/src/dialogs.cpp
parent0c1facf5ca73994ad269fd18a88e5b8fe68551c8 (diff)
Facebook: Implement login with two-way authorization
It shows dialog that asks for verification code. User can press button to request code via SMS. Allows 3 attempts to entering correct code, then plugin disconnects. git-svn-id: http://svn.miranda-ng.org/main/trunk@16685 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/dialogs.cpp')
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index 2b8ec51728..9ce23811a7 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -635,3 +635,49 @@ INT_PTR CALLBACK FBOptionsMessagingProc(HWND hwnd, UINT message, WPARAM wparam,
return FALSE;
}
+
+/////////////////////////////////////////////////////////////////////////////////
+
+CFacebookGuardDialog::CFacebookGuardDialog(FacebookProto *proto, const char *fb_dtsg)
+ : CFacebookDlgBase(proto, IDD_GUARD, false),
+ m_ok(this, IDOK),
+ m_sms(this, IDSMS),
+ m_text(this, IDC_TEXT),
+ m_fb_dtsg(fb_dtsg)
+{
+ memset(m_code, 0, sizeof(m_code));
+ m_ok.OnClick = Callback(this, &CFacebookGuardDialog::OnOk);
+ m_sms.OnClick = Callback(this, &CFacebookGuardDialog::OnSms);
+}
+
+void CFacebookGuardDialog::OnInitDialog()
+{
+ SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle("facebook"), TRUE));
+ SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(GetIconHandle("facebook")));
+
+ SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 6, 0);
+
+ Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "GuardWindow");
+}
+
+void CFacebookGuardDialog::OnOk(CCtrlButton*)
+{
+ mir_strncpy(m_code, ptrA(m_text.GetTextA()), _countof(m_code));
+ EndDialog(m_hwnd, DIALOG_RESULT_OK);
+}
+
+void CFacebookGuardDialog::OnSms(CCtrlButton *btn)
+{
+ btn->Disable();
+ m_proto->facy.sms_code(m_fb_dtsg);
+}
+
+void CFacebookGuardDialog::OnClose()
+{
+ Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "GuardWindow");
+}
+
+const char* CFacebookGuardDialog::GetCode()
+{
+ return m_code;
+}