summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-05-03 12:58:17 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-05-03 12:58:21 +0300
commit6594ad4b05fd17ece2219d75a10723eddc8f219d (patch)
tree30d2b4cee033048293dc994c19bee1577a636582 /protocols
parent1de0a66138ef40b80b3fc528cf2cfed93be444ed (diff)
Discord: support for CDF_DEL_CONTACT flag in OnContactDeleted
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/proto.cpp18
1 files changed, 10 insertions, 8 deletions
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;
}