From dbc48cc0ec4df774c257d5175d62bce16e2437e3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 9 Dec 2023 20:00:47 +0300 Subject: PROTO_INTERFACE::OnContactDeleted to be able to block the contact's deletion --- protocols/Tox/src/tox_contacts.cpp | 8 +++++--- protocols/Tox/src/tox_proto.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'protocols/Tox') diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index ec95703156..7349f9ebe5 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -201,20 +201,22 @@ INT_PTR CToxProto::OnGrantAuth(WPARAM hContact, LPARAM) return 0; } -void CToxProto::OnContactDeleted(MCONTACT hContact) +bool CToxProto::OnContactDeleted(MCONTACT hContact) { if (!IsOnline()) - return; + return false; if (!isChatRoom(hContact)) { int32_t friendNumber = GetToxFriendNumber(hContact); TOX_ERR_FRIEND_DELETE error; if (!tox_friend_delete(m_tox, friendNumber, &error)) { debugLogA(__FUNCTION__": failed to delete friend (%d)", error); - return; + return false; } SaveToxProfile(m_tox); } + + return true; } void CToxProto::OnFriendRequest(Tox*, const uint8_t *pubKey, const uint8_t *message, size_t /* length */, void *arg) diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 5277caa0ba..4109c00ecb 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -67,7 +67,7 @@ public: int UserIsTyping(MCONTACT hContact, int type) override; void OnBuildProtoMenu(void) override; - void OnContactDeleted(MCONTACT) override; + bool OnContactDeleted(MCONTACT) override; MWindow OnCreateAccMgrUI(MWindow) override; void OnErase() override; void OnModulesLoaded() override; -- cgit v1.2.3