From 6594ad4b05fd17ece2219d75a10723eddc8f219d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 3 May 2024 12:58:17 +0300 Subject: Discord: support for CDF_DEL_CONTACT flag in OnContactDeleted --- protocols/Discord/src/proto.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'protocols/Discord/src') diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index c4ac40a83d..daa6d1ee18 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -624,17 +624,19 @@ int CDiscordProto::OnAccountChanged(WPARAM iAction, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// -bool CDiscordProto::OnContactDeleted(MCONTACT hContact, uint32_t) +bool CDiscordProto::OnContactDeleted(MCONTACT hContact, uint32_t flags) { - CDiscordUser *pUser = FindUser(getId(hContact, DB_KEY_ID)); - if (pUser == nullptr || !m_bOnline) - return false; + if (flags & CDF_DEL_CONTACT) { + CDiscordUser *pUser = FindUser(getId(hContact, DB_KEY_ID)); + if (pUser == nullptr || !m_bOnline) + return false; - if (pUser->channelId) - Push(new AsyncHttpRequest(this, REQUEST_DELETE, CMStringA(FORMAT, "/channels/%lld", pUser->channelId), nullptr)); + if (pUser->channelId) + Push(new AsyncHttpRequest(this, REQUEST_DELETE, CMStringA(FORMAT, "/channels/%lld", pUser->channelId), nullptr)); - if (pUser->id) - RemoveFriend(pUser->id); + if (pUser->id) + RemoveFriend(pUser->id); + } return true; } -- cgit v1.2.3