summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/connection.cpp2
-rw-r--r--protocols/Discord/src/gateway.cpp7
-rw-r--r--protocols/Discord/src/http.cpp2
-rw-r--r--protocols/Discord/src/mfa.cpp2
-rw-r--r--protocols/Discord/src/server.cpp10
-rw-r--r--protocols/Discord/src/stdafx.h1
6 files changed, 12 insertions, 12 deletions
diff --git a/protocols/Discord/src/connection.cpp b/protocols/Discord/src/connection.cpp
index 6835713687..2e740ba4c1 100644
--- a/protocols/Discord/src/connection.cpp
+++ b/protocols/Discord/src/connection.cpp
@@ -102,7 +102,7 @@ void CDiscordProto::ShutdownSession()
void CDiscordProto::ConnectionFailed(int iReason)
{
debugLogA("CDiscordProto::ConnectionFailed -> reason %d", iReason);
- delSetting("AccessToken");
+ delSetting(DB_KEY_TOKEN);
ProtoBroadcastAck(0, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, iReason);
ShutdownSession();
diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp
index 759afed573..30a32bb5f6 100644
--- a/protocols/Discord/src/gateway.cpp
+++ b/protocols/Discord/src/gateway.cpp
@@ -303,6 +303,13 @@ void CDiscordProto::GatewaySendResume()
GatewaySend(root);
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CDiscordProto::OnReceiveLogout(MHttpResponse *, AsyncHttpRequest *)
+{
+ delSetting(DB_KEY_TOKEN);
+}
+
bool CDiscordProto::GatewaySendStatus(int iStatus, const wchar_t *pwszStatusText)
{
if (iStatus == ID_STATUS_OFFLINE) {
diff --git a/protocols/Discord/src/http.cpp b/protocols/Discord/src/http.cpp
index 70cfe9db80..147bebe209 100644
--- a/protocols/Discord/src/http.cpp
+++ b/protocols/Discord/src/http.cpp
@@ -93,7 +93,7 @@ JsonReply::~JsonReply()
void CDiscordProto::ServerThread(void*)
{
- m_szAccessToken = getStringA("AccessToken");
+ m_szAccessToken = getStringA(DB_KEY_TOKEN);
m_hAPIConnection = nullptr;
m_bTerminated = false;
diff --git a/protocols/Discord/src/mfa.cpp b/protocols/Discord/src/mfa.cpp
index 9de79283fa..292826d3e1 100644
--- a/protocols/Discord/src/mfa.cpp
+++ b/protocols/Discord/src/mfa.cpp
@@ -107,6 +107,6 @@ void CDiscordProto::OnSendTotp(MHttpResponse *pReply, struct AsyncHttpRequest *p
auto &data = root.data();
CMStringA szToken = data["token"].as_mstring();
m_szAccessToken = szToken.Detach();
- setString("AccessToken", m_szAccessToken);
+ setString(DB_KEY_TOKEN, m_szAccessToken);
RetrieveMyInfo();
}
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index 75167a7a60..7bc887edef 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -193,14 +193,6 @@ void CDiscordProto::OnReceiveGateway(MHttpResponse *pReply, AsyncHttpRequest*)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// logs a session out
-
-void CDiscordProto::OnReceiveLogout(MHttpResponse *, AsyncHttpRequest *)
-{
- delSetting("AccessToken");
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
void CDiscordProto::SetServerStatus(int iStatus)
{
@@ -284,7 +276,7 @@ void CDiscordProto::OnReceiveToken(MHttpResponse *pReply, AsyncHttpRequest*)
if (auto &token = data["token"]) {
CMStringA szToken = token.as_mstring();
m_szAccessToken = szToken.Detach();
- setString("AccessToken", m_szAccessToken);
+ setString(DB_KEY_TOKEN, m_szAccessToken);
RetrieveMyInfo();
return;
}
diff --git a/protocols/Discord/src/stdafx.h b/protocols/Discord/src/stdafx.h
index 7588a978d8..3b3bbc819a 100644
--- a/protocols/Discord/src/stdafx.h
+++ b/protocols/Discord/src/stdafx.h
@@ -54,6 +54,7 @@
extern IconItem g_iconList[];
#define DB_KEY_ID "id"
+#define DB_KEY_TOKEN "AccessToken"
#define DB_KEY_PASSWORD "Password"
#define DB_KEY_DISCR "Discriminator"
#define DB_KEY_MFA "MfaEnabled"