From 3cf3097094e4e1ebf1a34775f8a03c2cb288392c Mon Sep 17 00:00:00 2001 From: Green Sky Date: Mon, 11 Mar 2024 11:46:18 +0100 Subject: [PATCH] toxcore update + private interface update --- external/solanaceae_tox | 2 +- external/solanaceae_toxcore | 2 +- src/tox_private_impl.hpp | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/external/solanaceae_tox b/external/solanaceae_tox index 4bd7235..ce81ef7 160000 --- a/external/solanaceae_tox +++ b/external/solanaceae_tox @@ -1 +1 @@ -Subproject commit 4bd7235a739dec020365d216509474f641029113 +Subproject commit ce81ef7cf7cea2fe2091912c9eafe787cbba6100 diff --git a/external/solanaceae_toxcore b/external/solanaceae_toxcore index 3b75a1c..cf36790 160000 --- a/external/solanaceae_toxcore +++ b/external/solanaceae_toxcore @@ -1 +1 @@ -Subproject commit 3b75a1c5d30c945d98df61513d80bc1b9c3ea8a0 +Subproject commit cf3679018be3f90db0f2f1e9433a966692976421 diff --git a/src/tox_private_impl.hpp b/src/tox_private_impl.hpp index fe2605d..706d8ef 100644 --- a/src/tox_private_impl.hpp +++ b/src/tox_private_impl.hpp @@ -16,4 +16,20 @@ struct ToxPrivateImpl : public ToxPrivateI { uint16_t toxDHTGetNumCloselistAnnounceCapable(void) override { return tox_dht_get_num_closelist_announce_capable(_tox); } + + std::tuple, Tox_Err_Group_Peer_Query> toxGroupPeerGetIPAddress(uint32_t group_number, uint32_t peer_id) override { + Tox_Err_Group_Peer_Query err = TOX_ERR_GROUP_PEER_QUERY_OK; + size_t str_size = tox_group_peer_get_ip_address_size(_tox, group_number, peer_id, &err); + if (err != TOX_ERR_GROUP_PEER_QUERY_OK) { + return {std::nullopt, err}; + } + std::string ip_str(str_size, '\0'); + + tox_group_peer_get_ip_address(_tox, group_number, peer_id, reinterpret_cast(ip_str.data()), &err); + if (err == TOX_ERR_GROUP_PEER_QUERY_OK) { + return {ip_str, err}; + } else { + return {std::nullopt, err}; + } + } };