add group constants getters

This commit is contained in:
Green Sky 2023-10-11 01:17:46 +02:00
parent dfa5a501ec
commit f8851c1033
No known key found for this signature in database
4 changed files with 63 additions and 0 deletions

View File

@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
project(solanaceae) project(solanaceae)
add_library(solanaceae_toxcore_interface INTERFACE
#./solanaceae/toxcore/tox_interface.hpp
)
target_include_directories(solanaceae_toxcore_interface INTERFACE .)
target_compile_features(solanaceae_toxcore_interface INTERFACE cxx_std_17)
add_library(solanaceae_toxcore add_library(solanaceae_toxcore
./solanaceae/toxcore/utils.hpp ./solanaceae/toxcore/utils.hpp
./solanaceae/toxcore/utils.cpp ./solanaceae/toxcore/utils.cpp
@ -26,5 +32,6 @@ target_include_directories(solanaceae_toxcore PUBLIC .)
target_compile_features(solanaceae_toxcore PUBLIC cxx_std_17) target_compile_features(solanaceae_toxcore PUBLIC cxx_std_17)
target_link_libraries(solanaceae_toxcore PUBLIC target_link_libraries(solanaceae_toxcore PUBLIC
toxcore toxcore
solanaceae_toxcore_interface
) )

View File

@ -285,6 +285,42 @@ Tox_Err_Friend_Custom_Packet ToxDefaultImpl::toxFriendSendLosslessPacket(uint32_
return err; return err;
} }
uint32_t ToxDefaultImpl::toxGroupMaxTopicLength(void) {
return tox_group_max_topic_length();
}
uint32_t ToxDefaultImpl::toxGroupMaxPartLength(void) {
return tox_group_max_part_length();
}
uint32_t ToxDefaultImpl::toxGroupMaxMessageLength(void) {
return tox_group_max_message_length();
}
uint32_t ToxDefaultImpl::toxGroupMaxCustomLossyPacketLength(void) {
return tox_group_max_custom_lossy_packet_length();
}
uint32_t ToxDefaultImpl::toxGroupMaxCustomLosslessPacketLength(void) {
return tox_group_max_custom_lossless_packet_length();
}
uint32_t ToxDefaultImpl::toxGroupMaxGroupNameLength(void) {
return tox_group_max_group_name_length();
}
uint32_t ToxDefaultImpl::toxGroupMaxPasswordSize(void) {
return tox_group_max_password_size();
}
uint32_t ToxDefaultImpl::toxGroupChatIdSize(void) {
return tox_group_chat_id_size();
}
uint32_t ToxDefaultImpl::toxGroupPeerPublicKeySize(void) {
return tox_group_peer_public_key_size();
}
std::tuple<std::optional<uint32_t>, Tox_Err_Group_New> ToxDefaultImpl::toxGroupNew(Tox_Group_Privacy_State privacy_state, std::string_view group_name, std::string_view name) { std::tuple<std::optional<uint32_t>, Tox_Err_Group_New> ToxDefaultImpl::toxGroupNew(Tox_Group_Privacy_State privacy_state, std::string_view group_name, std::string_view name) {
Tox_Err_Group_New err = TOX_ERR_GROUP_NEW_OK; Tox_Err_Group_New err = TOX_ERR_GROUP_NEW_OK;
auto res = tox_group_new(_tox, privacy_state, reinterpret_cast<const uint8_t*>(group_name.data()), group_name.size(), reinterpret_cast<const uint8_t*>(name.data()), name.size(), &err); auto res = tox_group_new(_tox, privacy_state, reinterpret_cast<const uint8_t*>(group_name.data()), group_name.size(), reinterpret_cast<const uint8_t*>(name.data()), name.size(), &err);

View File

@ -64,6 +64,16 @@ struct ToxDefaultImpl : public ToxI {
// group // group
uint32_t toxGroupMaxTopicLength(void) override;
uint32_t toxGroupMaxPartLength(void) override;
uint32_t toxGroupMaxMessageLength(void) override;
uint32_t toxGroupMaxCustomLossyPacketLength(void) override;
uint32_t toxGroupMaxCustomLosslessPacketLength(void) override;
uint32_t toxGroupMaxGroupNameLength(void) override;
uint32_t toxGroupMaxPasswordSize(void) override;
uint32_t toxGroupChatIdSize(void) override;
uint32_t toxGroupPeerPublicKeySize(void) override;
std::tuple<std::optional<uint32_t>, Tox_Err_Group_New> toxGroupNew(Tox_Group_Privacy_State privacy_state, std::string_view group_name, std::string_view name) override; std::tuple<std::optional<uint32_t>, Tox_Err_Group_New> toxGroupNew(Tox_Group_Privacy_State privacy_state, std::string_view group_name, std::string_view name) override;
std::tuple<std::optional<uint32_t>, Tox_Err_Group_Join> toxGroupJoin(const std::vector<uint8_t>& chat_id, std::string_view name, std::string_view password) override; std::tuple<std::optional<uint32_t>, Tox_Err_Group_Join> toxGroupJoin(const std::vector<uint8_t>& chat_id, std::string_view name, std::string_view password) override;
std::optional<bool> toxGroupIsConnected(uint32_t group_number) override; std::optional<bool> toxGroupIsConnected(uint32_t group_number) override;

View File

@ -106,6 +106,16 @@ struct ToxI_raw {
// group // group
virtual uint32_t toxGroupMaxTopicLength(void) = 0;
virtual uint32_t toxGroupMaxPartLength(void) = 0;
virtual uint32_t toxGroupMaxMessageLength(void) = 0;
virtual uint32_t toxGroupMaxCustomLossyPacketLength(void) = 0;
virtual uint32_t toxGroupMaxCustomLosslessPacketLength(void) = 0;
virtual uint32_t toxGroupMaxGroupNameLength(void) = 0;
virtual uint32_t toxGroupMaxPasswordSize(void) = 0;
virtual uint32_t toxGroupChatIdSize(void) = 0;
virtual uint32_t toxGroupPeerPublicKeySize(void) = 0;
virtual std::tuple<std::optional<uint32_t>, Tox_Err_Group_New> toxGroupNew(Tox_Group_Privacy_State privacy_state, std::string_view group_name, std::string_view name) = 0; virtual std::tuple<std::optional<uint32_t>, Tox_Err_Group_New> toxGroupNew(Tox_Group_Privacy_State privacy_state, std::string_view group_name, std::string_view name) = 0;
virtual std::tuple<std::optional<uint32_t>, Tox_Err_Group_Join> toxGroupJoin(const std::vector<uint8_t>& chat_id, std::string_view name, std::string_view password) = 0; virtual std::tuple<std::optional<uint32_t>, Tox_Err_Group_Join> toxGroupJoin(const std::vector<uint8_t>& chat_id, std::string_view name, std::string_view password) = 0;
virtual std::optional<bool> toxGroupIsConnected(uint32_t group_number) = 0; // only 1 error type, skip virtual std::optional<bool> toxGroupIsConnected(uint32_t group_number) = 0; // only 1 error type, skip