diff options
author | George Hazan <ghazan@miranda.im> | 2017-02-01 15:35:35 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-02-01 15:35:35 +0300 |
commit | a394c200ee2664b177d376259ab26b78bb854c19 (patch) | |
tree | 4d242c59abf14e7ae7270d4c6e88bce753bd984b /protocols/Discord | |
parent | 1c2dead34ab9c54829cb0f27a7bfe0e917474ec0 (diff) |
added handler for a USER_SETTINGS_UPDATE command
Diffstat (limited to 'protocols/Discord')
-rw-r--r-- | protocols/Discord/src/dispatch.cpp | 10 | ||||
-rw-r--r-- | protocols/Discord/src/proto.h | 1 | ||||
-rw-r--r-- | protocols/Discord/src/server.cpp | 1 | ||||
-rw-r--r-- | protocols/Discord/src/utils.cpp | 2 |
4 files changed, 13 insertions, 1 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index 0dc544eab1..becbab63f9 100644 --- a/protocols/Discord/src/dispatch.cpp +++ b/protocols/Discord/src/dispatch.cpp @@ -44,6 +44,7 @@ static handlers[] = // these structures must me sorted alphabetically { L"TYPING_START", &CDiscordProto::OnCommandTyping }, + { L"USER_SETTINGS_UPDATE", &CDiscordProto::OnCommandUserSettingsUpdate }, { L"USER_UPDATE", &CDiscordProto::OnCommandUserUpdate }, }; @@ -425,3 +426,12 @@ void CDiscordProto::OnCommandUserUpdate(const JSONNode &pRoot) RetrieveAvatar(hContact); } } + +void CDiscordProto::OnCommandUserSettingsUpdate(const JSONNode &pRoot) +{ + int iStatus = StrToStatus(pRoot["status"].as_mstring()); + if (iStatus != 0) { + int iOldStatus = m_iStatus; m_iStatus = iStatus; + ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus); + } +} diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index 96428bf2dd..3fde65a597 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -248,6 +248,7 @@ public: void OnCommandReady(const JSONNode&); void OnCommandTyping(const JSONNode&); void OnCommandUserUpdate(const JSONNode&); + void OnCommandUserSettingsUpdate(const JSONNode&); void OnLoggedIn(); void OnLoggedOut(); diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp index be38b7ffac..afd8e7de0b 100644 --- a/protocols/Discord/src/server.cpp +++ b/protocols/Discord/src/server.cpp @@ -230,7 +230,6 @@ void CDiscordProto::OnReceiveCreateChannel(NETLIBHTTPREQUEST *pReply, AsyncHttpR OnCommandChannelCreated(root); } - void CDiscordProto::OnReceiveChannels(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*) { if (pReply->resultCode != 200) diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp index 6813313bc0..a9b95b6f49 100644 --- a/protocols/Discord/src/utils.cpp +++ b/protocols/Discord/src/utils.cpp @@ -28,6 +28,8 @@ int StrToStatus(const CMStringW &str) { if (str == L"idle") return ID_STATUS_NA; + if (str == L"dnd") + return ID_STATUS_DND; if (str == L"online") return ID_STATUS_ONLINE; if (str == L"offline") |