diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-16 15:17:47 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-16 15:17:47 +0300 |
commit | c00f494c8165b9f2d9facc6488173502b19ca696 (patch) | |
tree | c9b16d5341ed4336f7797333e12c926fe5e73211 /protocols/Discord/src/dispatch.cpp | |
parent | d50c14d30197fcf8d31e875d5c936a0890200be4 (diff) |
- added reaction to remote contact removal;
- now we remove a channel & friendship on local contact removal
Diffstat (limited to 'protocols/Discord/src/dispatch.cpp')
-rw-r--r-- | protocols/Discord/src/dispatch.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index 8d314e0836..ef8cb223f7 100644 --- a/protocols/Discord/src/dispatch.cpp +++ b/protocols/Discord/src/dispatch.cpp @@ -33,6 +33,8 @@ static handlers[] = // these structures must me sorted alphabetically { L"READY", &CDiscordProto::OnCommandReady }, + { L"RELATIONSHIP_REMOVE", &CDiscordProto::OnCommandFriendRemoved }, + { L"TYPING_START", &CDiscordProto::OnCommandTyping }, { L"USER_UPDATE", &CDiscordProto::OnCommandUserUpdate }, @@ -53,6 +55,22 @@ GatewayHandlerFunc CDiscordProto::GetHandler(const wchar_t *pwszCommand) ////////////////////////////////////////////////////////////////////////////////////// // reading a new message +void CDiscordProto::OnCommandFriendRemoved(const JSONNode &pRoot) +{ + SnowFlake id = _wtoi64(pRoot["id"].as_mstring()); + CDiscordUser *pUser = FindUser(id); + if (pUser != NULL) { + if (pUser->hContact) { + if (pUser->bIsPrivate) + db_delete_contact(pUser->hContact); + } + arUsers.remove(pUser); + } +} + +////////////////////////////////////////////////////////////////////////////////////// +// reading a new message + void CDiscordProto::OnCommandMessage(const JSONNode &pRoot) { PROTORECVEVENT recv = {}; |