summaryrefslogtreecommitdiff
path: root/protocols/Slack/src/slack_dialogs.cpp
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2017-03-12 21:19:21 +0300
committeraunsane <aunsane@gmail.com>2017-03-12 21:19:38 +0300
commitb9c2a6953f0fa75a1c4de6079e9c97b3a60be7e5 (patch)
tree83940e0306fd9b0eca9dfe7ce679b437cde9331b /protocols/Slack/src/slack_dialogs.cpp
parent9826bda7bcd2a2024eac0fcecffc9633f5ac79f6 (diff)
Slack: initial commit
Diffstat (limited to 'protocols/Slack/src/slack_dialogs.cpp')
-rw-r--r--protocols/Slack/src/slack_dialogs.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/protocols/Slack/src/slack_dialogs.cpp b/protocols/Slack/src/slack_dialogs.cpp
new file mode 100644
index 0000000000..b495af842e
--- /dev/null
+++ b/protocols/Slack/src/slack_dialogs.cpp
@@ -0,0 +1,36 @@
+#include "stdafx.h"
+
+CSlackOAuth::CSlackOAuth(CSlackProto *proto)
+ : CSuper(proto, IDD_OAUTH, false),
+ m_authorize(this, IDC_OAUTH_AUTHORIZE, SLACK_URL "/oauth/authorize?scope=identify+read+post&redirect_uri=" SLACK_REDIRECT_URL "&client_id=" SLACK_CLIENT_ID),
+ m_code(this, IDC_OAUTH_CODE), m_ok(this, IDOK)
+{
+ m_ok.OnClick = Callback(this, &CSlackOAuth::OnOk);
+
+ Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "OAuthWindow");
+}
+
+void CSlackOAuth::OnInitDialog()
+{
+ CSuper::OnInitDialog();
+
+ Window_SetIcon_IcoLib(m_hwnd, m_proto->GetIconHandle(IDI_SLACK));
+
+ SendMessage(m_code.GetHwnd(), EM_LIMITTEXT, 40, 0);
+}
+
+void CSlackOAuth::OnOk(CCtrlButton*)
+{
+ mir_strncpy(m_authCode, ptrA(m_code.GetTextA()), _countof(m_authCode));
+ EndDialog(m_hwnd, 1);
+}
+
+void CSlackOAuth::OnClose()
+{
+ Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "OAuthWindow");
+}
+
+const char* CSlackOAuth::GetAuthCode()
+{
+ return m_authCode;
+} \ No newline at end of file