summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-01-23 18:34:15 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-01-23 18:34:15 +0300
commitac6a2d3c5a668324d4115305a621a81e4b5d99fb (patch)
treeb650b4c84c1f7b26d1ca8b1d58776fd65870eec9 /protocols/Discord/src/server.cpp
parent705649686832a6e12d7eea59e20528a7e61abe14 (diff)
automatic channel creation if user has none
Diffstat (limited to 'protocols/Discord/src/server.cpp')
-rw-r--r--protocols/Discord/src/server.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index e8cc6a752f..a818622d67 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -203,6 +203,18 @@ void CDiscordProto::OnReceiveAuth(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *p
}
/////////////////////////////////////////////////////////////////////////////////////////
+// channels
+
+void CDiscordProto::OnReceiveCreateChannel(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*)
+{
+ if (pReply->resultCode != 200)
+ return;
+
+ JSONNode root = JSONNode::parse(pReply->pData);
+ if (root)
+ OnCommandChannelCreated(root);
+}
+
void CDiscordProto::OnReceiveChannels(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*)
{
@@ -214,9 +226,9 @@ void CDiscordProto::OnReceiveChannels(NETLIBHTTPREQUEST *pReply, AsyncHttpReques
return;
for (auto it = root.begin(); it != root.end(); ++it) {
- JSONNode &p = *it;
+ const JSONNode &p = *it;
- JSONNode &user = p["recipient"];
+ const JSONNode &user = p["recipient"];
if (!user)
continue;