update tox private impl
This commit is contained in:
parent
2c80406795
commit
4e6193a09e
@ -16,4 +16,20 @@ struct ToxPrivateImpl : public ToxPrivateI {
|
||||
uint16_t toxDHTGetNumCloselistAnnounceCapable(void) override {
|
||||
return tox_dht_get_num_closelist_announce_capable(_tox);
|
||||
}
|
||||
|
||||
std::tuple<std::optional<std::string>, 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<uint8_t*>(ip_str.data()), &err);
|
||||
if (err == TOX_ERR_GROUP_PEER_QUERY_OK) {
|
||||
return {ip_str, err};
|
||||
} else {
|
||||
return {std::nullopt, err};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user