summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/dispatch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Discord/src/dispatch.cpp')
-rw-r--r--protocols/Discord/src/dispatch.cpp18
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 = {};