summaryrefslogtreecommitdiff
path: root/src/remoteauth/remoteauthclient.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2023-07-09 21:49:15 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2023-07-09 21:49:15 -0400
commit2ca5a21ab4a5c03ea8c8a584ca832d01d8661691 (patch)
treefa620c28142ab8cbb6e11df66a7a3852d8fa2437 /src/remoteauth/remoteauthclient.cpp
parent3c2fde661e0d8240fa03290c28e1475330ca15b2 (diff)
downloadabaddon-portaudio-2ca5a21ab4a5c03ea8c8a584ca832d01d8661691.tar.gz
abaddon-portaudio-2ca5a21ab4a5c03ea8c8a584ca832d01d8661691.zip
restart remote auth on cancel opcode
Diffstat (limited to 'src/remoteauth/remoteauthclient.cpp')
-rw-r--r--src/remoteauth/remoteauthclient.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/remoteauth/remoteauthclient.cpp b/src/remoteauth/remoteauthclient.cpp
index 7f41d71..467ea8b 100644
--- a/src/remoteauth/remoteauthclient.cpp
+++ b/src/remoteauth/remoteauthclient.cpp
@@ -58,6 +58,8 @@ void RemoteAuthClient::OnGatewayMessage(const std::string &str) {
HandleGatewayPendingTicket(j);
} else if (opcode == "pending_login") {
HandleGatewayPendingLogin(j);
+ } else if (opcode == "cancel") {
+ HandleGatewayCancel(j);
}
}
@@ -125,6 +127,11 @@ void RemoteAuthClient::HandleGatewayPendingLogin(const nlohmann::json &j) {
m_signal_pending_login.emit();
}
+void RemoteAuthClient::HandleGatewayCancel(const nlohmann::json &j) {
+ Stop();
+ Start();
+}
+
void RemoteAuthClient::OnRemoteAuthLoginResponse(const std::optional<std::string> &encrypted_token, DiscordError err) {
if (!encrypted_token.has_value()) {
m_log->error("Remote auth login failed: {}", static_cast<int>(err));