summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-01-07 13:45:34 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-01-07 19:55:09 +0300
commite012650957335d5f4295441debf849b3b9b2f4ef (patch)
tree54438907b350f05b598ff16d9fbcb17c92672647 /protocols/Discord/src/server.cpp
parente59fe8f85cfa3e309a465dd92d17ebfc7093c5fb (diff)
first version of Discord with working gateway connection
Diffstat (limited to 'protocols/Discord/src/server.cpp')
-rw-r--r--protocols/Discord/src/server.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index a5ac8e215a..855565d327 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -124,6 +124,26 @@ void CDiscordProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpReques
}
/////////////////////////////////////////////////////////////////////////////////////////
+// finds a gateway address
+
+void CDiscordProto::OnReceiveGateway(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*)
+{
+ if (pReply->resultCode != 200) {
+ ShutdownSession();
+ return;
+ }
+
+ JSONNode root = JSONNode::parse(pReply->pData);
+ if (!root) {
+ ShutdownSession();
+ return;
+ }
+
+ m_szGateway = root["url"].as_mstring();
+ ForkThread(&CDiscordProto::GatewayThread, NULL);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
void CDiscordProto::SetServerStatus(int iStatus)
{
@@ -224,5 +244,3 @@ LBL_Error:
RetrieveUserInfo(NULL);
}
-
-/////////////////////////////////////////////////////////////////////////////////////////