more interface work, almost done now

This commit is contained in:
Green Sky 2024-11-06 10:07:49 +01:00
parent 49fda84aff
commit 727c341899
No known key found for this signature in database
4 changed files with 269 additions and 32 deletions

View File

@ -1,5 +1,25 @@
#include "./tox_default_impl.hpp" #include "./tox_default_impl.hpp"
Tox_Err_Bootstrap ToxDefaultImpl::toxBootstrap(const std::string& host, uint16_t port, const std::vector<uint8_t>& public_key) {
if (public_key.size() != TOX_PUBLIC_KEY_SIZE) {
return TOX_ERR_BOOTSTRAP_NULL;
}
Tox_Err_Bootstrap err = TOX_ERR_BOOTSTRAP_OK;
tox_bootstrap(_tox, host.c_str(), port, public_key.data(), &err);
return err;
}
Tox_Err_Bootstrap ToxDefaultImpl::toxAddTcpRelay(const std::string& host, uint16_t port, const std::vector<uint8_t>& public_key) {
if (public_key.size() != TOX_PUBLIC_KEY_SIZE) {
return TOX_ERR_BOOTSTRAP_NULL;
}
Tox_Err_Bootstrap err = TOX_ERR_BOOTSTRAP_OK;
tox_add_tcp_relay(_tox, host.c_str(), port, public_key.data(), &err);
return err;
}
Tox_Connection ToxDefaultImpl::toxSelfGetConnectionStatus(void) { Tox_Connection ToxDefaultImpl::toxSelfGetConnectionStatus(void) {
return tox_self_get_connection_status(_tox); return tox_self_get_connection_status(_tox);
} }
@ -30,6 +50,13 @@ std::vector<uint8_t> ToxDefaultImpl::toxSelfGetPublicKey(void) {
return self_pub; return self_pub;
} }
std::vector<uint8_t> ToxDefaultImpl::toxSelfGetSecretKey(void) {
std::vector<uint8_t> self_prv{};
self_prv.resize(TOX_SECRET_KEY_SIZE);
tox_self_get_secret_key(_tox, self_prv.data());
return self_prv;
}
Tox_Err_Set_Info ToxDefaultImpl::toxSelfSetName(std::string_view name) { Tox_Err_Set_Info ToxDefaultImpl::toxSelfSetName(std::string_view name) {
Tox_Err_Set_Info err = TOX_ERR_SET_INFO_OK; Tox_Err_Set_Info err = TOX_ERR_SET_INFO_OK;
tox_self_set_name(_tox, reinterpret_cast<const uint8_t*>(name.data()), name.size(), &err); tox_self_set_name(_tox, reinterpret_cast<const uint8_t*>(name.data()), name.size(), &err);
@ -735,6 +762,65 @@ std::vector<uint32_t> ToxDefaultImpl::toxGroupGetList(void) {
return group_list; return group_list;
} }
std::optional<Tox_Group_Privacy_State> ToxDefaultImpl::toxGroupGetPrivacyState(uint32_t group_number) {
Tox_Err_Group_State_Query err = TOX_ERR_GROUP_STATE_QUERY_OK;
const auto state = tox_group_get_privacy_state(_tox, group_number, &err);
if (err == TOX_ERR_GROUP_STATE_QUERY_OK) {
return state;
} else {
return std::nullopt;
}
}
std::optional<Tox_Group_Voice_State> ToxDefaultImpl::toxGroupGetVoiceState(uint32_t group_number) {
Tox_Err_Group_State_Query err = TOX_ERR_GROUP_STATE_QUERY_OK;
const auto state = tox_group_get_voice_state(_tox, group_number, &err);
if (err == TOX_ERR_GROUP_STATE_QUERY_OK) {
return state;
} else {
return std::nullopt;
}
}
std::optional<bool> ToxDefaultImpl::toxGroupGetTopicLock(uint32_t group_number) {
Tox_Err_Group_State_Query err = TOX_ERR_GROUP_STATE_QUERY_OK;
const auto state = tox_group_get_topic_lock(_tox, group_number, &err);
if (err == TOX_ERR_GROUP_STATE_QUERY_OK) {
return state == TOX_GROUP_TOPIC_LOCK_ENABLED;
} else {
return std::nullopt;
}
}
std::optional<uint16_t> ToxDefaultImpl::toxGroupGetPeerLimit(uint32_t group_number) {
Tox_Err_Group_State_Query err = TOX_ERR_GROUP_STATE_QUERY_OK;
const auto state = tox_group_get_peer_limit(_tox, group_number, &err);
if (err == TOX_ERR_GROUP_STATE_QUERY_OK) {
return state;
} else {
return std::nullopt;
}
}
std::optional<std::string> ToxDefaultImpl::toxGroupGetPassword(uint32_t group_number) {
std::string password;
Tox_Err_Group_State_Query err = TOX_ERR_GROUP_STATE_QUERY_OK;
const auto size = tox_group_get_password_size(_tox, group_number, &err);
if (err != TOX_ERR_GROUP_STATE_QUERY_OK) {
return std::nullopt;
}
password.resize(size);
tox_group_get_password(_tox, group_number, reinterpret_cast<uint8_t*>(password.data()), &err);
if (err == TOX_ERR_GROUP_STATE_QUERY_OK) {
return password;
} else {
return std::nullopt;
}
}
std::tuple<std::optional<uint32_t>, Tox_Err_Group_Send_Message> ToxDefaultImpl::toxGroupSendMessage(uint32_t group_number, Tox_Message_Type type, std::string_view message) { std::tuple<std::optional<uint32_t>, Tox_Err_Group_Send_Message> ToxDefaultImpl::toxGroupSendMessage(uint32_t group_number, Tox_Message_Type type, std::string_view message) {
Tox_Err_Group_Send_Message err = TOX_ERR_GROUP_SEND_MESSAGE_OK; Tox_Err_Group_Send_Message err = TOX_ERR_GROUP_SEND_MESSAGE_OK;
uint32_t message_id = tox_group_send_message(_tox, group_number, type, reinterpret_cast<const uint8_t*>(message.data()), message.size(), &err); uint32_t message_id = tox_group_send_message(_tox, group_number, type, reinterpret_cast<const uint8_t*>(message.data()), message.size(), &err);
@ -783,3 +869,56 @@ std::tuple<std::optional<uint32_t>, Tox_Err_Group_Invite_Accept> ToxDefaultImpl:
} }
} }
Tox_Err_Group_Set_Password ToxDefaultImpl::toxGroupSetPassword(uint32_t group_number, std::string_view password) {
Tox_Err_Group_Set_Password err = TOX_ERR_GROUP_SET_PASSWORD_OK;
tox_group_set_password(_tox, group_number, reinterpret_cast<const uint8_t*>(password.data()), password.size(), &err);
return err;
}
Tox_Err_Group_Set_Topic_Lock ToxDefaultImpl::toxGroupSetTopicLock(uint32_t group_number, bool topic_lock) {
Tox_Err_Group_Set_Topic_Lock err = TOX_ERR_GROUP_SET_TOPIC_LOCK_OK;
tox_group_set_topic_lock(
_tox,
group_number,
topic_lock ? TOX_GROUP_TOPIC_LOCK_ENABLED : TOX_GROUP_TOPIC_LOCK_DISABLED,
&err
);
return err;
}
Tox_Err_Group_Set_Voice_State ToxDefaultImpl::toxGroupSetVoiceState(uint32_t group_number, Tox_Group_Voice_State voice_state) {
Tox_Err_Group_Set_Voice_State err = TOX_ERR_GROUP_SET_VOICE_STATE_OK;
tox_group_set_voice_state(_tox, group_number, voice_state, &err);
return err;
}
Tox_Err_Group_Set_Privacy_State ToxDefaultImpl::toxGroupSetPrivacyState(uint32_t group_number, Tox_Group_Privacy_State privacy_state) {
Tox_Err_Group_Set_Privacy_State err = TOX_ERR_GROUP_SET_PRIVACY_STATE_OK;
tox_group_set_privacy_state(_tox, group_number, privacy_state, &err);
return err;
}
Tox_Err_Group_Set_Peer_Limit ToxDefaultImpl::toxGroupSetPeerLimit(uint32_t group_number, uint16_t max_peers) {
Tox_Err_Group_Set_Peer_Limit err = TOX_ERR_GROUP_SET_PEER_LIMIT_OK;
tox_group_set_peer_limit(_tox, group_number, max_peers, &err);
return err;
}
Tox_Err_Group_Set_Ignore ToxDefaultImpl::toxGroupSetIgnore(uint32_t group_number, uint32_t peer_id, bool ignore) {
Tox_Err_Group_Set_Ignore err = TOX_ERR_GROUP_SET_IGNORE_OK;
tox_group_set_ignore(_tox, group_number, peer_id, ignore, &err);
return err;
}
Tox_Err_Group_Set_Role ToxDefaultImpl::toxGroupSetRole(uint32_t group_number, uint32_t peer_id, Tox_Group_Role role) {
Tox_Err_Group_Set_Role err = TOX_ERR_GROUP_SET_ROLE_OK;
tox_group_set_role(_tox, group_number, peer_id, role, &err);
return err;
}
Tox_Err_Group_Kick_Peer ToxDefaultImpl::toxGroupKickPeer(uint32_t group_number, uint32_t peer_id) {
Tox_Err_Group_Kick_Peer err = TOX_ERR_GROUP_KICK_PEER_OK;
tox_group_kick_peer(_tox, group_number, peer_id, &err);
return err;
}

View File

@ -8,6 +8,9 @@ struct ToxDefaultImpl : public ToxI {
virtual ~ToxDefaultImpl(void) {} virtual ~ToxDefaultImpl(void) {}
Tox_Err_Bootstrap toxBootstrap(const std::string& host, uint16_t port, const std::vector<uint8_t>& public_key) override;
Tox_Err_Bootstrap toxAddTcpRelay(const std::string& host, uint16_t port, const std::vector<uint8_t>& public_key) override;
Tox_Connection toxSelfGetConnectionStatus(void) override; Tox_Connection toxSelfGetConnectionStatus(void) override;
uint32_t toxIterationInterval(void) override; uint32_t toxIterationInterval(void) override;
@ -17,7 +20,7 @@ struct ToxDefaultImpl : public ToxI {
uint32_t toxSelfGetNospam(void) override; uint32_t toxSelfGetNospam(void) override;
std::vector<uint8_t> toxSelfGetPublicKey(void) override; std::vector<uint8_t> toxSelfGetPublicKey(void) override;
//virtual void toxSelfGetSecretKey(const Tox *tox, uint8_t *secret_key); std::vector<uint8_t> toxSelfGetSecretKey(void) override;
Tox_Err_Set_Info toxSelfSetName(std::string_view name) override; Tox_Err_Set_Info toxSelfSetName(std::string_view name) override;
std::string toxSelfGetName(void) override; std::string toxSelfGetName(void) override;
@ -122,11 +125,11 @@ struct ToxDefaultImpl : public ToxI {
size_t toxGroupGetNumberGroups(void) override; size_t toxGroupGetNumberGroups(void) override;
std::vector<uint32_t> toxGroupGetList(void) override; std::vector<uint32_t> toxGroupGetList(void) override;
//virtual Tox_Group_Privacy_State toxGroupGetPrivacyState(uint32_t group_number, Tox_Err_Group_State_Queries *error) = 0; std::optional<Tox_Group_Privacy_State> toxGroupGetPrivacyState(uint32_t group_number) override;
//virtual Tox_Group_Voice_State toxGroupGetVoiceState(uint32_t group_number, Tox_Err_Group_State_Queries *error) = 0; std::optional<Tox_Group_Voice_State> toxGroupGetVoiceState(uint32_t group_number) override;
//virtual Tox_Group_Topic_Lock toxGroupGetTopicLock(uint32_t group_number, Tox_Err_Group_State_Queries *error) = 0; std::optional<bool> toxGroupGetTopicLock(uint32_t group_number) override;
//virtual uint16_t toxGroupGetPeerLimit(uint32_t group_number, Tox_Err_Group_State_Queries *error) = 0; std::optional<uint16_t> toxGroupGetPeerLimit(uint32_t group_number) override;
//virtual std::string toxGroupGetPassword(uint32_t group_number, Tox_Err_Group_State_Queries *error) = 0; std::optional<std::string> toxGroupGetPassword(uint32_t group_number) override;
std::tuple<std::optional<uint32_t>, Tox_Err_Group_Send_Message> toxGroupSendMessage(uint32_t group_number, Tox_Message_Type type, std::string_view message) override; std::tuple<std::optional<uint32_t>, Tox_Err_Group_Send_Message> toxGroupSendMessage(uint32_t group_number, Tox_Message_Type type, std::string_view message) override;
std::tuple<std::optional<uint32_t>, Tox_Err_Group_Send_Private_Message> toxGroupSendPrivateMessage(uint32_t group_number, uint32_t peer_id, Tox_Message_Type type, std::string_view message) override; std::tuple<std::optional<uint32_t>, Tox_Err_Group_Send_Private_Message> toxGroupSendPrivateMessage(uint32_t group_number, uint32_t peer_id, Tox_Message_Type type, std::string_view message) override;
@ -136,14 +139,14 @@ struct ToxDefaultImpl : public ToxI {
Tox_Err_Group_Invite_Friend toxGroupInviteFriend(uint32_t group_number, uint32_t friend_number) override; Tox_Err_Group_Invite_Friend toxGroupInviteFriend(uint32_t group_number, uint32_t friend_number) override;
std::tuple<std::optional<uint32_t>, Tox_Err_Group_Invite_Accept> toxGroupInviteAccept(uint32_t friend_number, const std::vector<uint8_t>& invite_data, std::string_view name, std::string_view password) override; std::tuple<std::optional<uint32_t>, Tox_Err_Group_Invite_Accept> toxGroupInviteAccept(uint32_t friend_number, const std::vector<uint8_t>& invite_data, std::string_view name, std::string_view password) override;
//virtual Tox_Err_Group_Founder_Set_Password toxGroupFounderSetPassword(uint32_t group_number, std::string_view password) = 0;
//virtual Tox_Err_Group_Founder_Set_Topic_Lock toxGroupFounderSetTopicLock(uint32_t group_number, Tox_Group_Topic_Lock topic_lock) = 0;
//virtual Tox_Err_Group_Founder_Set_Voice_State toxGroupFounderSetVoiceState(uint32_t group_number, Tox_Group_Voice_State voice_state) = 0;
//virtual Tox_Err_Group_Founder_Set_Privacy_State toxGroupFounderSetPrivacyState(uint32_t group_number, Tox_Group_Privacy_State privacy_state) = 0;
//virtual Tox_Err_Group_Founder_Set_Peer_Limit toxGroupFounderSetPeerLimit(uint32_t group_number, uint16_t max_peers) = 0;
//virtual Tox_Err_Group_Set_Ignore toxGroupSetIgnore(uint32_t group_number, uint32_t peer_id, bool ignore) = 0;
//virtual Tox_Err_Group_Mod_Set_Role toxGroupModSetRole(uint32_t group_number, uint32_t peer_id, Tox_Group_Role role) = 0;
//virtual Tox_Err_Group_Mod_Kick_Peer toxGroupModKickPeer(uint32_t group_number, uint32_t peer_id) = 0;
Tox_Err_Group_Set_Password toxGroupSetPassword(uint32_t group_number, std::string_view password) override;
Tox_Err_Group_Set_Topic_Lock toxGroupSetTopicLock(uint32_t group_number, bool topic_lock) override;
Tox_Err_Group_Set_Voice_State toxGroupSetVoiceState(uint32_t group_number, Tox_Group_Voice_State voice_state) override;
Tox_Err_Group_Set_Privacy_State toxGroupSetPrivacyState(uint32_t group_number, Tox_Group_Privacy_State privacy_state) override;
Tox_Err_Group_Set_Peer_Limit toxGroupSetPeerLimit(uint32_t group_number, uint16_t max_peers) override;
Tox_Err_Group_Set_Ignore toxGroupSetIgnore(uint32_t group_number, uint32_t peer_id, bool ignore) override;
Tox_Err_Group_Set_Role toxGroupSetRole(uint32_t group_number, uint32_t peer_id, Tox_Group_Role role) override;
Tox_Err_Group_Kick_Peer toxGroupKickPeer(uint32_t group_number, uint32_t peer_id) override;
}; };

View File

@ -1,6 +1,5 @@
#pragma once #pragma once
//#include <tox/tox.h>
#include "./toxcore_enums.hpp" #include "./toxcore_enums.hpp"
#include <string_view> #include <string_view>
@ -8,16 +7,18 @@
#include <string> #include <string>
#include <tuple> #include <tuple>
#include <optional> #include <optional>
#include <cstdint>
// TODO: c++20 span // TODO: c++20 span
// TODO: use span in utils // TODO: use span in utils
// yea use spans, replace all vec params with ByteSpan
// TODO: asyncable // TODO: asyncable
// defines the full interface for tox // defines the full interface for tox
// HACK: raw // HACK: raw
struct ToxI_raw { struct ToxI_raw {
static constexpr const char* version {"9"}; static constexpr const char* version {"10"};
virtual ~ToxI_raw(void) {} virtual ~ToxI_raw(void) {}
@ -25,8 +26,9 @@ struct ToxI_raw {
// size stuff // size stuff
// options? (no) // options? (no)
// get save data? // get save data?
// bootstrap
// add tcp relay virtual Tox_Err_Bootstrap toxBootstrap(const std::string& host, uint16_t port, const std::vector<uint8_t>& public_key /*[TOX_PUBLIC_KEY_SIZE]*/) = 0;
virtual Tox_Err_Bootstrap toxAddTcpRelay(const std::string& host, uint16_t port, const std::vector<uint8_t>& public_key /*[TOX_PUBLIC_KEY_SIZE]*/) = 0;
virtual Tox_Connection toxSelfGetConnectionStatus(void) = 0; virtual Tox_Connection toxSelfGetConnectionStatus(void) = 0;
virtual uint32_t toxIterationInterval(void) = 0; virtual uint32_t toxIterationInterval(void) = 0;
@ -38,7 +40,7 @@ struct ToxI_raw {
virtual uint32_t toxSelfGetNospam(void) = 0; virtual uint32_t toxSelfGetNospam(void) = 0;
virtual std::vector<uint8_t> toxSelfGetPublicKey(void) = 0; virtual std::vector<uint8_t> toxSelfGetPublicKey(void) = 0;
//virtual void toxSelfGetSecretKey(const Tox *tox, uint8_t *secret_key); virtual std::vector<uint8_t> toxSelfGetSecretKey(void) = 0;
virtual Tox_Err_Set_Info toxSelfSetName(std::string_view name) = 0; virtual Tox_Err_Set_Info toxSelfSetName(std::string_view name) = 0;
virtual std::string toxSelfGetName(void) = 0; virtual std::string toxSelfGetName(void) = 0;
@ -153,11 +155,12 @@ struct ToxI_raw {
virtual size_t toxGroupGetNumberGroups(void) = 0; virtual size_t toxGroupGetNumberGroups(void) = 0;
virtual std::vector<uint32_t> toxGroupGetList(void) = 0; virtual std::vector<uint32_t> toxGroupGetList(void) = 0;
//virtual Tox_Group_Privacy_State toxGroupGetPrivacyState(uint32_t group_number, Tox_Err_Group_State_Queries *error) = 0; // only 1 error type, skip
//virtual Tox_Group_Voice_State toxGroupGetVoiceState(uint32_t group_number, Tox_Err_Group_State_Queries *error) = 0; virtual std::optional<Tox_Group_Privacy_State> toxGroupGetPrivacyState(uint32_t group_number) = 0;
//virtual Tox_Group_Topic_Lock toxGroupGetTopicLock(uint32_t group_number, Tox_Err_Group_State_Queries *error) = 0; virtual std::optional<Tox_Group_Voice_State> toxGroupGetVoiceState(uint32_t group_number) = 0;
//virtual uint16_t toxGroupGetPeerLimit(uint32_t group_number, Tox_Err_Group_State_Queries *error) = 0; virtual std::optional<bool> toxGroupGetTopicLock(uint32_t group_number) = 0;
//virtual std::string toxGroupGetPassword(uint32_t group_number, Tox_Err_Group_State_Queries *error) = 0; virtual std::optional<uint16_t> toxGroupGetPeerLimit(uint32_t group_number) = 0;
virtual std::optional<std::string> toxGroupGetPassword(uint32_t group_number) = 0;
// returns message_id // returns message_id
virtual std::tuple<std::optional<uint32_t>, Tox_Err_Group_Send_Message> toxGroupSendMessage(uint32_t group_number, Tox_Message_Type type, std::string_view message) = 0; virtual std::tuple<std::optional<uint32_t>, Tox_Err_Group_Send_Message> toxGroupSendMessage(uint32_t group_number, Tox_Message_Type type, std::string_view message) = 0;
@ -168,15 +171,15 @@ struct ToxI_raw {
virtual Tox_Err_Group_Invite_Friend toxGroupInviteFriend(uint32_t group_number, uint32_t friend_number) = 0; virtual Tox_Err_Group_Invite_Friend toxGroupInviteFriend(uint32_t group_number, uint32_t friend_number) = 0;
virtual std::tuple<std::optional<uint32_t>, Tox_Err_Group_Invite_Accept> toxGroupInviteAccept(uint32_t friend_number, const std::vector<uint8_t>& invite_data, std::string_view name, std::string_view password) = 0; virtual std::tuple<std::optional<uint32_t>, Tox_Err_Group_Invite_Accept> toxGroupInviteAccept(uint32_t friend_number, const std::vector<uint8_t>& invite_data, std::string_view name, std::string_view password) = 0;
//virtual Tox_Err_Group_Founder_Set_Password toxGroupFounderSetPassword(uint32_t group_number, std::string_view password) = 0;
//virtual Tox_Err_Group_Founder_Set_Topic_Lock toxGroupFounderSetTopicLock(uint32_t group_number, Tox_Group_Topic_Lock topic_lock) = 0;
//virtual Tox_Err_Group_Founder_Set_Voice_State toxGroupFounderSetVoiceState(uint32_t group_number, Tox_Group_Voice_State voice_state) = 0;
//virtual Tox_Err_Group_Founder_Set_Privacy_State toxGroupFounderSetPrivacyState(uint32_t group_number, Tox_Group_Privacy_State privacy_state) = 0;
//virtual Tox_Err_Group_Founder_Set_Peer_Limit toxGroupFounderSetPeerLimit(uint32_t group_number, uint16_t max_peers) = 0;
//virtual Tox_Err_Group_Set_Ignore toxGroupSetIgnore(uint32_t group_number, uint32_t peer_id, bool ignore) = 0;
//virtual Tox_Err_Group_Mod_Set_Role toxGroupModSetRole(uint32_t group_number, uint32_t peer_id, Tox_Group_Role role) = 0;
//virtual Tox_Err_Group_Mod_Kick_Peer toxGroupModKickPeer(uint32_t group_number, uint32_t peer_id) = 0;
virtual Tox_Err_Group_Set_Password toxGroupSetPassword(uint32_t group_number, std::string_view password) = 0;
virtual Tox_Err_Group_Set_Topic_Lock toxGroupSetTopicLock(uint32_t group_number, bool topic_lock) = 0;
virtual Tox_Err_Group_Set_Voice_State toxGroupSetVoiceState(uint32_t group_number, Tox_Group_Voice_State voice_state) = 0;
virtual Tox_Err_Group_Set_Privacy_State toxGroupSetPrivacyState(uint32_t group_number, Tox_Group_Privacy_State privacy_state) = 0;
virtual Tox_Err_Group_Set_Peer_Limit toxGroupSetPeerLimit(uint32_t group_number, uint16_t max_peers) = 0;
virtual Tox_Err_Group_Set_Ignore toxGroupSetIgnore(uint32_t group_number, uint32_t peer_id, bool ignore) = 0;
virtual Tox_Err_Group_Set_Role toxGroupSetRole(uint32_t group_number, uint32_t peer_id, Tox_Group_Role role) = 0;
virtual Tox_Err_Group_Kick_Peer toxGroupKickPeer(uint32_t group_number, uint32_t peer_id) = 0;
}; };
// HACK: work around zppbits inability to pass string_view as parameter ( https://github.com/eyalz800/zpp_bits/issues/107 ) // HACK: work around zppbits inability to pass string_view as parameter ( https://github.com/eyalz800/zpp_bits/issues/107 )

View File

@ -14,6 +14,13 @@
// TODO: replace all types // TODO: replace all types
// TODO: replace all errors with custom // TODO: replace all errors with custom
enum Tox_Err_Bootstrap {
TOX_ERR_BOOTSTRAP_OK,
TOX_ERR_BOOTSTRAP_NULL,
TOX_ERR_BOOTSTRAP_BAD_HOST,
TOX_ERR_BOOTSTRAP_BAD_PORT,
};
enum Tox_Connection { enum Tox_Connection {
TOX_CONNECTION_NONE, TOX_CONNECTION_NONE,
TOX_CONNECTION_TCP, TOX_CONNECTION_TCP,
@ -225,6 +232,12 @@ enum Tox_Group_Privacy_State {
TOX_GROUP_PRIVACY_STATE_PRIVATE, TOX_GROUP_PRIVACY_STATE_PRIVATE,
}; };
enum Tox_Group_Voice_State {
TOX_GROUP_VOICE_STATE_ALL,
TOX_GROUP_VOICE_STATE_MODERATOR,
TOX_GROUP_VOICE_STATE_FOUNDER,
};
enum Tox_Err_Group_Join { enum Tox_Err_Group_Join {
TOX_ERR_GROUP_JOIN_OK, TOX_ERR_GROUP_JOIN_OK,
TOX_ERR_GROUP_JOIN_INIT, TOX_ERR_GROUP_JOIN_INIT,
@ -275,6 +288,11 @@ enum Tox_Err_Group_Peer_Query {
TOX_ERR_GROUP_PEER_QUERY_PEER_NOT_FOUND, TOX_ERR_GROUP_PEER_QUERY_PEER_NOT_FOUND,
}; };
//enum Tox_Err_Group_State_Query {
// TOX_ERR_GROUP_STATE_QUERY_OK,
// TOX_ERR_GROUP_STATE_QUERY_GROUP_NOT_FOUND,
//};
enum Tox_Err_Group_Topic_Set { enum Tox_Err_Group_Topic_Set {
TOX_ERR_GROUP_TOPIC_SET_OK, TOX_ERR_GROUP_TOPIC_SET_OK,
TOX_ERR_GROUP_TOPIC_SET_GROUP_NOT_FOUND, TOX_ERR_GROUP_TOPIC_SET_GROUP_NOT_FOUND,
@ -354,5 +372,79 @@ enum Tox_Err_Group_Invite_Accept {
TOX_ERR_GROUP_INVITE_ACCEPT_FAIL_SEND, TOX_ERR_GROUP_INVITE_ACCEPT_FAIL_SEND,
}; };
enum Tox_Err_Group_Set_Password {
TOX_ERR_GROUP_SET_PASSWORD_OK,
TOX_ERR_GROUP_SET_PASSWORD_GROUP_NOT_FOUND,
TOX_ERR_GROUP_SET_PASSWORD_PERMISSIONS,
TOX_ERR_GROUP_SET_PASSWORD_TOO_LONG,
TOX_ERR_GROUP_SET_PASSWORD_FAIL_SEND,
TOX_ERR_GROUP_SET_PASSWORD_MALLOC,
TOX_ERR_GROUP_SET_PASSWORD_DISCONNECTED,
};
enum Tox_Err_Group_Set_Topic_Lock {
TOX_ERR_GROUP_SET_TOPIC_LOCK_OK,
TOX_ERR_GROUP_SET_TOPIC_LOCK_GROUP_NOT_FOUND,
TOX_ERR_GROUP_SET_TOPIC_LOCK_INVALID,
TOX_ERR_GROUP_SET_TOPIC_LOCK_PERMISSIONS,
TOX_ERR_GROUP_SET_TOPIC_LOCK_FAIL_SET,
TOX_ERR_GROUP_SET_TOPIC_LOCK_FAIL_SEND,
TOX_ERR_GROUP_SET_TOPIC_LOCK_DISCONNECTED,
};
enum Tox_Err_Group_Set_Voice_State {
TOX_ERR_GROUP_SET_VOICE_STATE_OK,
TOX_ERR_GROUP_SET_VOICE_STATE_GROUP_NOT_FOUND,
TOX_ERR_GROUP_SET_VOICE_STATE_PERMISSIONS,
TOX_ERR_GROUP_SET_VOICE_STATE_FAIL_SET,
TOX_ERR_GROUP_SET_VOICE_STATE_FAIL_SEND,
TOX_ERR_GROUP_SET_VOICE_STATE_DISCONNECTED,
};
enum Tox_Err_Group_Set_Privacy_State {
TOX_ERR_GROUP_SET_PRIVACY_STATE_OK,
TOX_ERR_GROUP_SET_PRIVACY_STATE_GROUP_NOT_FOUND,
TOX_ERR_GROUP_SET_PRIVACY_STATE_PERMISSIONS,
TOX_ERR_GROUP_SET_PRIVACY_STATE_FAIL_SET,
TOX_ERR_GROUP_SET_PRIVACY_STATE_FAIL_SEND,
TOX_ERR_GROUP_SET_PRIVACY_STATE_DISCONNECTED,
};
enum Tox_Err_Group_Set_Peer_Limit {
TOX_ERR_GROUP_SET_PEER_LIMIT_OK,
TOX_ERR_GROUP_SET_PEER_LIMIT_GROUP_NOT_FOUND,
TOX_ERR_GROUP_SET_PEER_LIMIT_PERMISSIONS,
TOX_ERR_GROUP_SET_PEER_LIMIT_FAIL_SET,
TOX_ERR_GROUP_SET_PEER_LIMIT_FAIL_SEND,
TOX_ERR_GROUP_SET_PEER_LIMIT_DISCONNECTED,
};
enum Tox_Err_Group_Set_Ignore {
TOX_ERR_GROUP_SET_IGNORE_OK,
TOX_ERR_GROUP_SET_IGNORE_GROUP_NOT_FOUND,
TOX_ERR_GROUP_SET_IGNORE_PEER_NOT_FOUND,
TOX_ERR_GROUP_SET_IGNORE_SELF,
};
enum Tox_Err_Group_Set_Role {
TOX_ERR_GROUP_SET_ROLE_OK,
TOX_ERR_GROUP_SET_ROLE_GROUP_NOT_FOUND,
TOX_ERR_GROUP_SET_ROLE_PEER_NOT_FOUND,
TOX_ERR_GROUP_SET_ROLE_PERMISSIONS,
TOX_ERR_GROUP_SET_ROLE_ASSIGNMENT,
TOX_ERR_GROUP_SET_ROLE_FAIL_ACTION,
TOX_ERR_GROUP_SET_ROLE_SELF,
};
enum Tox_Err_Group_Kick_Peer {
TOX_ERR_GROUP_KICK_PEER_OK,
TOX_ERR_GROUP_KICK_PEER_GROUP_NOT_FOUND,
TOX_ERR_GROUP_KICK_PEER_PEER_NOT_FOUND,
TOX_ERR_GROUP_KICK_PEER_PERMISSIONS,
TOX_ERR_GROUP_KICK_PEER_FAIL_ACTION,
TOX_ERR_GROUP_KICK_PEER_FAIL_SEND,
TOX_ERR_GROUP_KICK_PEER_SELF,
};
#endif // C_TOXCORE_TOXCORE_TOX_H #endif // C_TOXCORE_TOXCORE_TOX_H