summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Discord/src/options.cpp')
-rw-r--r--protocols/Discord/src/options.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/protocols/Discord/src/options.cpp b/protocols/Discord/src/options.cpp
index 3262b37671..dc1c6eafa8 100644
--- a/protocols/Discord/src/options.cpp
+++ b/protocols/Discord/src/options.cpp
@@ -81,7 +81,15 @@ public:
void onClick_Logout(CCtrlButton *)
{
- m_proto->Push(new AsyncHttpRequest(m_proto, REQUEST_POST, "/auth/logout", &CDiscordProto::OnReceiveLogout));
+ auto *pReq = new AsyncHttpRequest(m_proto, REQUEST_POST, "/auth/logout", &CDiscordProto::OnReceiveLogout);
+ pReq->pUserInfo = this;
+ m_proto->Push(pReq);
+ }
+
+ void onLogout()
+ {
+ m_edUserName.Enable();
+ m_edPassword.Enable();
}
void onChange_GroupChats(CCtrlCheck*)
@@ -92,6 +100,16 @@ public:
}
};
+void CDiscordProto::OnReceiveLogout(MHttpResponse *, AsyncHttpRequest *pReq)
+{
+ delSetting(DB_KEY_TOKEN);
+ m_szAccessToken = 0;
+ ShutdownSession();
+
+ auto *pDlg = (CDiscardAccountOptions *)pReq->pUserInfo;
+ pDlg->onLogout();
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
MWindow CDiscordProto::OnCreateAccMgrUI(MWindow hwndParent)