diff options
author | George Hazan <george.hazan@gmail.com> | 2023-12-09 20:00:47 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-12-09 20:00:47 +0300 |
commit | dbc48cc0ec4df774c257d5175d62bce16e2437e3 (patch) | |
tree | 525937d7b3e549bb75a817571dcecc0f7e32f82d /protocols/Tox | |
parent | 4d29366657d2ee93db4913a5a07af0d26820c058 (diff) |
PROTO_INTERFACE::OnContactDeleted to be able to block the contact's deletion
Diffstat (limited to 'protocols/Tox')
-rw-r--r-- | protocols/Tox/src/tox_contacts.cpp | 8 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.h | 2 |
2 files changed, 6 insertions, 4 deletions
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;
|