summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-10-27 17:42:04 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-10-27 17:42:09 +0300
commit0a641111470bf1910bed3fe1cd57f31c6c1ecfce (patch)
tree5481d28959399223ae37bdfe91d332d8393e71ab /protocols/Discord/src/server.cpp
parent0ba90e004d457b50c5ae16993c22d48336f58959 (diff)
fixes #4761 (Ability to use third party discord reimplementations)
Diffstat (limited to 'protocols/Discord/src/server.cpp')
-rw-r--r--protocols/Discord/src/server.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index 172faebe47..beef589e30 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -143,9 +143,17 @@ void CDiscordProto::OnReceiveHistory(MHttpResponse *pReply, AsyncHttpRequest *pR
/////////////////////////////////////////////////////////////////////////////////////////
// retrieves user info
-void CDiscordProto::RetrieveMyInfo()
+void CDiscordProto::OnReceiveGateway(MHttpResponse *pReply, AsyncHttpRequest *)
{
- Push(new AsyncHttpRequest(this, REQUEST_GET, "/users/@me", &CDiscordProto::OnReceiveMyInfo));
+ JsonReply root(pReply);
+ if (!root) {
+ ShutdownSession();
+ return;
+ }
+
+ auto &data = root.data();
+ m_szGateway = data["url"].as_mstring();
+ ForkThread(&CDiscordProto::GatewayThread, nullptr);
}
void CDiscordProto::OnReceiveMyInfo(MHttpResponse *pReply, AsyncHttpRequest*)
@@ -178,20 +186,9 @@ void CDiscordProto::OnReceiveMyInfo(MHttpResponse *pReply, AsyncHttpRequest*)
CheckAvatarChange(0, data["avatar"].as_mstring());
}
-/////////////////////////////////////////////////////////////////////////////////////////
-// finds a gateway address
-
-void CDiscordProto::OnReceiveGateway(MHttpResponse *pReply, AsyncHttpRequest*)
+void CDiscordProto::RetrieveMyInfo()
{
- JsonReply root(pReply);
- if (!root) {
- ShutdownSession();
- return;
- }
-
- auto &data = root.data();
- m_szGateway = data["url"].as_mstring();
- ForkThread(&CDiscordProto::GatewayThread, nullptr);
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/users/@me", &CDiscordProto::OnReceiveMyInfo));
}
/////////////////////////////////////////////////////////////////////////////////////////