1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-22 09:13:03 +01:00

Remove usage of deprecated API typedefs

This commit is contained in:
jfreegman 2022-02-03 12:23:28 -05:00
parent ba896fd124
commit 2eeb1de20d
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
9 changed files with 64 additions and 64 deletions

View File

@ -204,7 +204,7 @@ void cmd_group_accept(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*
tox_self_get_name(m, (uint8_t *) self_nick); tox_self_get_name(m, (uint8_t *) self_nick);
self_nick[nick_len] = '\0'; self_nick[nick_len] = '\0';
TOX_ERR_GROUP_INVITE_ACCEPT err; Tox_Err_Group_Invite_Accept err;
uint32_t groupnumber = tox_group_invite_accept(m, self->num, Friends.list[self->num].group_invite.data, uint32_t groupnumber = tox_group_invite_accept(m, self->num, Friends.list[self->num].group_invite.data,
Friends.list[self->num].group_invite.length, (const uint8_t *) self_nick, nick_len, Friends.list[self->num].group_invite.length, (const uint8_t *) self_nick, nick_len,
(const uint8_t *) passwd, passwd_len, &err); (const uint8_t *) passwd, passwd_len, &err);
@ -240,7 +240,7 @@ void cmd_group_invite(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*
return; return;
} }
TOX_ERR_GROUP_INVITE_FRIEND err; Tox_Err_Group_Invite_Friend err;
if (!tox_group_invite_friend(m, groupnumber, self->num, &err)) { if (!tox_group_invite_friend(m, groupnumber, self->num, &err)) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to invite contact to group (error %d).", err); line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to invite contact to group (error %d).", err);

View File

@ -489,7 +489,7 @@ void cmd_groupchat(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
tox_self_get_name(m, (uint8_t *) self_nick); tox_self_get_name(m, (uint8_t *) self_nick);
self_nick[nick_length] = '\0'; self_nick[nick_length] = '\0';
TOX_ERR_GROUP_NEW err; Tox_Err_Group_New err;
uint32_t groupnumber = tox_group_new(m, TOX_GROUP_PRIVACY_STATE_PUBLIC, (const uint8_t *) name, len, uint32_t groupnumber = tox_group_new(m, TOX_GROUP_PRIVACY_STATE_PUBLIC, (const uint8_t *) name, len,
(const uint8_t *) self_nick, nick_length, &err); (const uint8_t *) self_nick, nick_length, &err);
@ -578,7 +578,7 @@ void cmd_join(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
tox_self_get_name(m, (uint8_t *) self_nick); tox_self_get_name(m, (uint8_t *) self_nick);
self_nick[nick_length] = '\0'; self_nick[nick_length] = '\0';
TOX_ERR_GROUP_JOIN err; Tox_Err_Group_Join err;
uint32_t groupnumber = tox_group_join(m, (uint8_t *) id_bin, (const uint8_t *) self_nick, nick_length, uint32_t groupnumber = tox_group_join(m, (uint8_t *) id_bin, (const uint8_t *) self_nick, nick_length,
(const uint8_t *) passwd, passwd_len, &err); (const uint8_t *) passwd, passwd_len, &err);

View File

@ -37,7 +37,7 @@ void cmd_chatid(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
char chatid[TOX_GROUP_CHAT_ID_SIZE * 2 + 1] = {0}; char chatid[TOX_GROUP_CHAT_ID_SIZE * 2 + 1] = {0};
char chat_public_key[TOX_GROUP_CHAT_ID_SIZE]; char chat_public_key[TOX_GROUP_CHAT_ID_SIZE];
TOX_ERR_GROUP_STATE_QUERIES err; Tox_Err_Group_State_Queries err;
if (!tox_group_get_chat_id(m, self->num, (uint8_t *) chat_public_key, &err)) { if (!tox_group_get_chat_id(m, self->num, (uint8_t *) chat_public_key, &err)) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to retrieve the Chat ID (error %d).", err); line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to retrieve the Chat ID (error %d).", err);
@ -90,7 +90,7 @@ void cmd_ignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
return; return;
} }
TOX_ERR_GROUP_TOGGLE_IGNORE err; Tox_Err_Group_Toggle_Ignore err;
tox_group_toggle_ignore(m, self->num, peer_id, true, &err); tox_group_toggle_ignore(m, self->num, peer_id, true, &err);
switch (err) { switch (err) {
@ -132,7 +132,7 @@ void cmd_kick(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
return; return;
} }
TOX_ERR_GROUP_MOD_KICK_PEER err; Tox_Err_Group_Mod_Kick_Peer err;
tox_group_mod_kick_peer(m, self->num, target_peer_id, &err); tox_group_mod_kick_peer(m, self->num, target_peer_id, &err);
switch (err) { switch (err) {
@ -210,7 +210,7 @@ void cmd_mod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
return; return;
} }
TOX_ERR_GROUP_SELF_QUERY s_err; Tox_Err_Group_Self_Query s_err;
uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err); uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err);
if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) { if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) {
@ -218,7 +218,7 @@ void cmd_mod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
return; return;
} }
TOX_ERR_GROUP_MOD_SET_ROLE err; Tox_Err_Group_Mod_Set_Role err;
tox_group_mod_set_role(m, self->num, target_peer_id, TOX_GROUP_ROLE_MODERATOR, &err); tox_group_mod_set_role(m, self->num, target_peer_id, TOX_GROUP_ROLE_MODERATOR, &err);
switch (err) { switch (err) {
@ -268,7 +268,7 @@ void cmd_unmod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
return; return;
} }
TOX_ERR_GROUP_SELF_QUERY s_err; Tox_Err_Group_Self_Query s_err;
uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err); uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err);
if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) { if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) {
@ -281,7 +281,7 @@ void cmd_unmod(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
return; return;
} }
TOX_ERR_GROUP_MOD_SET_ROLE err; Tox_Err_Group_Mod_Set_Role err;
tox_group_mod_set_role(m, self->num, target_peer_id, TOX_GROUP_ROLE_USER, &err); tox_group_mod_set_role(m, self->num, target_peer_id, TOX_GROUP_ROLE_USER, &err);
switch (err) { switch (err) {
@ -323,7 +323,7 @@ void cmd_set_passwd(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*ar
len = strlen(passwd); len = strlen(passwd);
} }
TOX_ERR_GROUP_FOUNDER_SET_PASSWORD err; Tox_Err_Group_Founder_Set_Password err;
tox_group_founder_set_password(m, self->num, (uint8_t *) passwd, len, &err); tox_group_founder_set_password(m, self->num, (uint8_t *) passwd, len, &err);
switch (err) { switch (err) {
@ -360,7 +360,7 @@ void cmd_set_peerlimit(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (
int maxpeers = 0; int maxpeers = 0;
if (argc < 1) { if (argc < 1) {
TOX_ERR_GROUP_STATE_QUERIES err; Tox_Err_Group_State_Queries err;
uint32_t maxpeers = tox_group_get_peer_limit(m, self->num, &err); uint32_t maxpeers = tox_group_get_peer_limit(m, self->num, &err);
if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) { if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
@ -379,7 +379,7 @@ void cmd_set_peerlimit(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (
return; return;
} }
TOX_ERR_GROUP_FOUNDER_SET_PEER_LIMIT err; Tox_Err_Group_Founder_Set_Peer_Limit err;
tox_group_founder_set_peer_limit(m, self->num, maxpeers, &err); tox_group_founder_set_peer_limit(m, self->num, maxpeers, &err);
switch (err) { switch (err) {
@ -403,10 +403,10 @@ void cmd_set_peerlimit(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (
void cmd_set_privacy(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) void cmd_set_privacy(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{ {
const char *pstate_str = NULL; const char *pstate_str = NULL;
TOX_GROUP_PRIVACY_STATE privacy_state; Tox_Group_Privacy_State privacy_state;
if (argc < 1) { if (argc < 1) {
TOX_ERR_GROUP_STATE_QUERIES err; Tox_Err_Group_State_Queries err;
privacy_state = tox_group_get_privacy_state(m, self->num, &err); privacy_state = tox_group_get_privacy_state(m, self->num, &err);
if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) { if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
@ -429,7 +429,7 @@ void cmd_set_privacy(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*a
privacy_state = strcasecmp(pstate_str, privacy_state = strcasecmp(pstate_str,
"private") == 0 ? TOX_GROUP_PRIVACY_STATE_PRIVATE : TOX_GROUP_PRIVACY_STATE_PUBLIC; "private") == 0 ? TOX_GROUP_PRIVACY_STATE_PRIVATE : TOX_GROUP_PRIVACY_STATE_PUBLIC;
TOX_ERR_GROUP_FOUNDER_SET_PRIVACY_STATE err; Tox_Err_Group_Founder_Set_Privacy_State err;
tox_group_founder_set_privacy_state(m, self->num, privacy_state, &err); tox_group_founder_set_privacy_state(m, self->num, privacy_state, &err);
switch (err) { switch (err) {
@ -452,11 +452,11 @@ void cmd_set_privacy(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*a
void cmd_set_topic_lock(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) void cmd_set_topic_lock(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{ {
TOX_GROUP_TOPIC_LOCK topic_lock; Tox_Group_Topic_Lock topic_lock;
const char *tlock_str = NULL; const char *tlock_str = NULL;
if (argc < 1) { if (argc < 1) {
TOX_ERR_GROUP_STATE_QUERIES err; Tox_Err_Group_State_Queries err;
topic_lock = tox_group_get_topic_lock(m, self->num, &err); topic_lock = tox_group_get_topic_lock(m, self->num, &err);
if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) { if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
@ -479,7 +479,7 @@ void cmd_set_topic_lock(WINDOW *window, ToxWindow *self, Tox *m, int argc, char
topic_lock = strcasecmp(tlock_str, "on") == 0 ? TOX_GROUP_TOPIC_LOCK_ENABLED : TOX_GROUP_TOPIC_LOCK_DISABLED; topic_lock = strcasecmp(tlock_str, "on") == 0 ? TOX_GROUP_TOPIC_LOCK_ENABLED : TOX_GROUP_TOPIC_LOCK_DISABLED;
const char *display_str = (topic_lock == TOX_GROUP_TOPIC_LOCK_ENABLED) ? "enabled" : "disabled"; const char *display_str = (topic_lock == TOX_GROUP_TOPIC_LOCK_ENABLED) ? "enabled" : "disabled";
TOX_ERR_GROUP_FOUNDER_SET_TOPIC_LOCK err; Tox_Err_Group_Founder_Set_Topic_Lock err;
tox_group_founder_set_topic_lock(m, self->num, topic_lock, &err); tox_group_founder_set_topic_lock(m, self->num, topic_lock, &err);
switch (err) { switch (err) {
@ -514,7 +514,7 @@ void cmd_silence(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)
return; return;
} }
TOX_ERR_GROUP_SELF_QUERY s_err; Tox_Err_Group_Self_Query s_err;
uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err); uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err);
if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) { if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) {
@ -522,7 +522,7 @@ void cmd_silence(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)
return; return;
} }
TOX_ERR_GROUP_MOD_SET_ROLE err; Tox_Err_Group_Mod_Set_Role err;
tox_group_mod_set_role(m, self->num, target_peer_id, TOX_GROUP_ROLE_OBSERVER, &err); tox_group_mod_set_role(m, self->num, target_peer_id, TOX_GROUP_ROLE_OBSERVER, &err);
switch (err) { switch (err) {
@ -577,7 +577,7 @@ void cmd_unsilence(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
return; return;
} }
TOX_ERR_GROUP_SELF_QUERY s_err; Tox_Err_Group_Self_Query s_err;
uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err); uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err);
if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) { if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) {
@ -585,7 +585,7 @@ void cmd_unsilence(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
return; return;
} }
TOX_ERR_GROUP_MOD_SET_ROLE err; Tox_Err_Group_Mod_Set_Role err;
tox_group_mod_set_role(m, self->num, target_peer_id, TOX_GROUP_ROLE_USER, &err); tox_group_mod_set_role(m, self->num, target_peer_id, TOX_GROUP_ROLE_USER, &err);
switch (err) { switch (err) {
@ -623,7 +623,7 @@ void cmd_unsilence(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
void cmd_rejoin(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) void cmd_rejoin(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{ {
TOX_ERR_GROUP_RECONNECT err; Tox_Err_Group_Reconnect err;
if (!tox_group_reconnect(m, self->num, &err)) { if (!tox_group_reconnect(m, self->num, &err)) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to rejoin group (error %d).", err); line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to rejoin group (error %d).", err);
@ -638,7 +638,7 @@ void cmd_rejoin(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[
void cmd_set_topic(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) void cmd_set_topic(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{ {
if (argc < 1) { if (argc < 1) {
TOX_ERR_GROUP_STATE_QUERIES err; Tox_Err_Group_State_Queries err;
size_t tlen = tox_group_get_topic_size(m, self->num, &err); size_t tlen = tox_group_get_topic_size(m, self->num, &err);
if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) { if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
@ -665,7 +665,7 @@ void cmd_set_topic(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
const char *topic = argv[1]; const char *topic = argv[1];
TOX_ERR_GROUP_TOPIC_SET err; Tox_Err_Group_Topic_Set err;
tox_group_set_topic(m, self->num, (uint8_t *) topic, strlen(topic), &err); tox_group_set_topic(m, self->num, (uint8_t *) topic, strlen(topic), &err);
switch (err) { switch (err) {
@ -719,7 +719,7 @@ void cmd_unignore(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv
return; return;
} }
TOX_ERR_GROUP_TOGGLE_IGNORE err; Tox_Err_Group_Toggle_Ignore err;
tox_group_toggle_ignore(m, self->num, peer_id, false, &err); tox_group_toggle_ignore(m, self->num, peer_id, false, &err);
switch (err) { switch (err) {
@ -820,7 +820,7 @@ void cmd_whois(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
strcat(pk_string, d); strcat(pk_string, d);
} }
TOX_ERR_GROUP_PEER_QUERY conn_err; Tox_Err_Group_Peer_Query conn_err;
Tox_Connection connection_type = tox_group_peer_get_connection_status(m, self->num, peer_id, &conn_err); Tox_Connection connection_type = tox_group_peer_get_connection_status(m, self->num, peer_id, &conn_err);
const char *connection_type_str = "Unknown"; const char *connection_type_str = "Unknown";

View File

@ -196,7 +196,7 @@ void groupchat_rejoin(ToxWindow *self, Tox *m)
return; return;
} }
TOX_ERR_GROUP_SELF_QUERY s_err; Tox_Err_Group_Self_Query s_err;
uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err); uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err);
if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) { if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) {
@ -290,7 +290,7 @@ static void init_groupchat_log(ToxWindow *self, Tox *m, uint32_t groupnumber)
char chat_id[TOX_GROUP_CHAT_ID_SIZE]; char chat_id[TOX_GROUP_CHAT_ID_SIZE];
TOX_ERR_GROUP_STATE_QUERIES err; Tox_Err_Group_State_Queries err;
if (!tox_group_get_chat_id(m, groupnumber, (uint8_t *)chat_id, &err)) { if (!tox_group_get_chat_id(m, groupnumber, (uint8_t *)chat_id, &err)) {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to fetch chat id. Logging disabled. (error: %d)", err); line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to fetch chat id. Logging disabled. (error: %d)", err);
@ -341,7 +341,7 @@ int init_groupchat_win(Tox *m, uint32_t groupnumber, const char *groupname, size
set_active_window_index(groupchats[i].chatwin); set_active_window_index(groupchats[i].chatwin);
store_data(m, DATA_FILE); store_data(m, DATA_FILE);
TOX_ERR_GROUP_SELF_QUERY err; Tox_Err_Group_Self_Query err;
uint32_t peer_id = tox_group_self_get_peer_id(m, groupnumber, &err); uint32_t peer_id = tox_group_self_get_peer_id(m, groupnumber, &err);
if (err != TOX_ERR_GROUP_SELF_QUERY_OK) { if (err != TOX_ERR_GROUP_SELF_QUERY_OK) {
@ -375,7 +375,7 @@ void set_nick_all_groups(Tox *m, const char *new_nick, size_t length)
char old_nick[TOX_MAX_NAME_LENGTH + 1]; char old_nick[TOX_MAX_NAME_LENGTH + 1];
size_t old_length = get_group_self_nick_truncate(m, old_nick, self->num); size_t old_length = get_group_self_nick_truncate(m, old_nick, self->num);
TOX_ERR_GROUP_SELF_NAME_SET err; Tox_Err_Group_Self_Name_Set err;
tox_group_self_set_name(m, groupchats[i].groupnumber, (uint8_t *) new_nick, length, &err); tox_group_self_set_name(m, groupchats[i].groupnumber, (uint8_t *) new_nick, length, &err);
switch (err) { switch (err) {
@ -411,7 +411,7 @@ void set_status_all_groups(Tox *m, uint8_t status)
continue; continue;
} }
TOX_ERR_GROUP_SELF_QUERY s_err; Tox_Err_Group_Self_Query s_err;
uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err); uint32_t self_peer_id = tox_group_self_get_peer_id(m, self->num, &s_err);
if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) { if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) {
@ -823,7 +823,7 @@ static void groupchat_onGroupPeerLimit(ToxWindow *self, Tox *m, uint32_t groupnu
write_to_log(tmp_event, "The founder", ctx->log, true); write_to_log(tmp_event, "The founder", ctx->log, true);
} }
static void groupchat_onGroupPrivacyState(ToxWindow *self, Tox *m, uint32_t groupnumber, TOX_GROUP_PRIVACY_STATE state) static void groupchat_onGroupPrivacyState(ToxWindow *self, Tox *m, uint32_t groupnumber, Tox_Group_Privacy_State state)
{ {
ChatContext *ctx = self->chatwin; ChatContext *ctx = self->chatwin;
@ -841,7 +841,7 @@ static void groupchat_onGroupPrivacyState(ToxWindow *self, Tox *m, uint32_t grou
write_to_log(tmp_event, "The founder", ctx->log, true); write_to_log(tmp_event, "The founder", ctx->log, true);
} }
static void groupchat_onGroupTopicLock(ToxWindow *self, Tox *m, uint32_t groupnumber, TOX_GROUP_TOPIC_LOCK topic_lock) static void groupchat_onGroupTopicLock(ToxWindow *self, Tox *m, uint32_t groupnumber, Tox_Group_Topic_Lock topic_lock)
{ {
ChatContext *ctx = self->chatwin; ChatContext *ctx = self->chatwin;
@ -1030,7 +1030,7 @@ static void groupchat_set_group_name(ToxWindow *self, Tox *m, uint32_t groupnumb
return; return;
} }
TOX_ERR_GROUP_STATE_QUERIES err; Tox_Err_Group_State_Queries err;
size_t len = tox_group_get_name_size(m, groupnumber, &err); size_t len = tox_group_get_name_size(m, groupnumber, &err);
if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) { if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
@ -1070,7 +1070,7 @@ static void groupchat_onGroupSelfJoin(ToxWindow *self, Tox *m, uint32_t groupnum
char topic[TOX_GROUP_MAX_TOPIC_LENGTH + 1]; char topic[TOX_GROUP_MAX_TOPIC_LENGTH + 1];
TOX_ERR_GROUP_STATE_QUERIES err; Tox_Err_Group_State_Queries err;
size_t topic_length = tox_group_get_topic_size(m, groupnumber, &err); size_t topic_length = tox_group_get_topic_size(m, groupnumber, &err);
if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) { if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
@ -1093,8 +1093,8 @@ static void groupchat_onGroupSelfJoin(ToxWindow *self, Tox *m, uint32_t groupnum
} }
/* Update own role since it may have changed while we were offline */ /* Update own role since it may have changed while we were offline */
TOX_ERR_GROUP_SELF_QUERY s_err; Tox_Err_Group_Self_Query s_err;
TOX_GROUP_ROLE role = tox_group_self_get_role(m, groupnumber, &s_err); Tox_Group_Role role = tox_group_self_get_role(m, groupnumber, &s_err);
if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) { if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) {
return; return;
@ -1117,7 +1117,7 @@ static void groupchat_onGroupSelfJoin(ToxWindow *self, Tox *m, uint32_t groupnum
sort_peerlist(groupnumber); sort_peerlist(groupnumber);
} }
static void groupchat_onGroupRejected(ToxWindow *self, Tox *m, uint32_t groupnumber, TOX_GROUP_JOIN_FAIL type) static void groupchat_onGroupRejected(ToxWindow *self, Tox *m, uint32_t groupnumber, Tox_Group_Join_Fail type)
{ {
if (self->num != groupnumber || !get_groupchat(groupnumber)) { if (self->num != groupnumber || !get_groupchat(groupnumber)) {
return; return;
@ -1157,8 +1157,8 @@ static void groupchat_update_roles(Tox *m, uint32_t groupnumber)
continue; continue;
} }
TOX_ERR_GROUP_PEER_QUERY err; Tox_Err_Group_Peer_Query err;
TOX_GROUP_ROLE role = tox_group_peer_get_role(m, groupnumber, peer->peer_id, &err); Tox_Group_Role role = tox_group_peer_get_role(m, groupnumber, peer->peer_id, &err);
if (err == TOX_ERR_GROUP_PEER_QUERY_OK) { if (err == TOX_ERR_GROUP_PEER_QUERY_OK) {
peer->role = role; peer->role = role;
@ -1167,7 +1167,7 @@ static void groupchat_update_roles(Tox *m, uint32_t groupnumber)
} }
void groupchat_onGroupModeration(ToxWindow *self, Tox *m, uint32_t groupnumber, uint32_t src_peer_id, void groupchat_onGroupModeration(ToxWindow *self, Tox *m, uint32_t groupnumber, uint32_t src_peer_id,
uint32_t tgt_peer_id, TOX_GROUP_MOD_EVENT type) uint32_t tgt_peer_id, Tox_Group_Mod_Event type)
{ {
if (self->num != groupnumber) { if (self->num != groupnumber) {
return; return;
@ -1238,7 +1238,7 @@ static void groupchat_onGroupSelfNickChange(ToxWindow *self, Tox *m, uint32_t gr
return; return;
} }
TOX_ERR_GROUP_SELF_QUERY s_err; Tox_Err_Group_Self_Query s_err;
uint32_t peer_id = tox_group_self_get_peer_id(m, self->num, &s_err); uint32_t peer_id = tox_group_self_get_peer_id(m, self->num, &s_err);
if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) { if (s_err != TOX_ERR_GROUP_SELF_QUERY_OK) {
@ -1328,7 +1328,7 @@ static void send_group_message(ToxWindow *self, Tox *m, uint32_t groupnumber, co
return; return;
} }
TOX_ERR_GROUP_SEND_MESSAGE err; Tox_Err_Group_Send_Message err;
if (!tox_group_send_message(m, groupnumber, type, (uint8_t *) msg, strlen(msg), &err)) { if (!tox_group_send_message(m, groupnumber, type, (uint8_t *) msg, strlen(msg), &err)) {
if (err == TOX_ERR_GROUP_SEND_MESSAGE_PERMISSIONS) { if (err == TOX_ERR_GROUP_SEND_MESSAGE_PERMISSIONS) {
@ -1405,7 +1405,7 @@ static void send_group_prvt_message(ToxWindow *self, Tox *m, uint32_t groupnumbe
const char *msg = data + name_length + 1; const char *msg = data + name_length + 1;
TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE err; Tox_Err_Group_Send_Private_Message err;
if (!tox_group_send_private_message(m, groupnumber, peer_id, TOX_MESSAGE_TYPE_NORMAL, (uint8_t *) msg, msg_len, &err)) { if (!tox_group_send_private_message(m, groupnumber, peer_id, TOX_MESSAGE_TYPE_NORMAL, (uint8_t *) msg, msg_len, &err)) {
if (err == TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE_PERMISSIONS) { if (err == TOX_ERR_GROUP_SEND_PRIVATE_MESSAGE_PERMISSIONS) {

View File

@ -45,7 +45,7 @@ typedef struct GroupPeer {
uint32_t peer_id; uint32_t peer_id;
uint8_t public_key[TOX_GROUP_PEER_PUBLIC_KEY_SIZE]; uint8_t public_key[TOX_GROUP_PEER_PUBLIC_KEY_SIZE];
TOX_USER_STATUS status; TOX_USER_STATUS status;
TOX_GROUP_ROLE role; Tox_Group_Role role;
uint64_t last_active; uint64_t last_active;
} GroupPeer; } GroupPeer;
@ -74,7 +74,7 @@ void groupchat_onGroupPeerExit(ToxWindow *self, Tox *m, uint32_t groupnumber, ui
Tox_Group_Exit_Type exit_type, Tox_Group_Exit_Type exit_type,
const char *name, size_t name_len, const char *partmessage, size_t len); const char *name, size_t name_len, const char *partmessage, size_t len);
void groupchat_onGroupModeration(ToxWindow *self, Tox *m, uint32_t groupnumber, uint32_t src_peer_id, void groupchat_onGroupModeration(ToxWindow *self, Tox *m, uint32_t groupnumber, uint32_t src_peer_id,
uint32_t tgt_peer_id, TOX_GROUP_MOD_EVENT type); uint32_t tgt_peer_id, Tox_Group_Mod_Event type);
void groupchat_rejoin(ToxWindow *self, Tox *m); void groupchat_rejoin(ToxWindow *self, Tox *m);

View File

@ -497,7 +497,7 @@ on_error:
/* same as get_nick_truncate but for groupchats */ /* same as get_nick_truncate but for groupchats */
size_t get_group_nick_truncate(Tox *m, char *buf, uint32_t peer_id, uint32_t groupnum) size_t get_group_nick_truncate(Tox *m, char *buf, uint32_t peer_id, uint32_t groupnum)
{ {
TOX_ERR_GROUP_PEER_QUERY err; Tox_Err_Group_Peer_Query err;
size_t len = tox_group_peer_get_name_size(m, groupnum, peer_id, &err); size_t len = tox_group_peer_get_name_size(m, groupnum, peer_id, &err);
if (err != TOX_ERR_GROUP_PEER_QUERY_OK || len == 0) { if (err != TOX_ERR_GROUP_PEER_QUERY_OK || len == 0) {
@ -523,7 +523,7 @@ size_t get_group_nick_truncate(Tox *m, char *buf, uint32_t peer_id, uint32_t gro
/* same as get_group_nick_truncate() but for self. */ /* same as get_group_nick_truncate() but for self. */
size_t get_group_self_nick_truncate(Tox *m, char *buf, uint32_t groupnum) size_t get_group_self_nick_truncate(Tox *m, char *buf, uint32_t groupnum)
{ {
TOX_ERR_GROUP_SELF_QUERY err; Tox_Err_Group_Self_Query err;
size_t len = tox_group_self_get_name_size(m, groupnum, &err); size_t len = tox_group_self_get_name_size(m, groupnum, &err);
if (err != TOX_ERR_GROUP_SELF_QUERY_OK) { if (err != TOX_ERR_GROUP_SELF_QUERY_OK) {

View File

@ -163,16 +163,16 @@ void on_group_peer_exit(Tox *m, uint32_t groupnumber, uint32_t peer_id, Tox_Grou
void on_group_topic_change(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *topic, size_t length, void on_group_topic_change(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *topic, size_t length,
void *userdata); void *userdata);
void on_group_peer_limit(Tox *m, uint32_t groupnumber, uint32_t peer_limit, void *userdata); void on_group_peer_limit(Tox *m, uint32_t groupnumber, uint32_t peer_limit, void *userdata);
void on_group_privacy_state(Tox *m, uint32_t groupnumber, TOX_GROUP_PRIVACY_STATE privacy_state, void *userdata); void on_group_privacy_state(Tox *m, uint32_t groupnumber, Tox_Group_Privacy_State privacy_state, void *userdata);
void on_group_topic_lock(Tox *m, uint32_t groupnumber, TOX_GROUP_TOPIC_LOCK topic_lock, void *userdata); void on_group_topic_lock(Tox *m, uint32_t groupnumber, Tox_Group_Topic_Lock topic_lock, void *userdata);
void on_group_password(Tox *m, uint32_t groupnumber, const uint8_t *password, size_t length, void *userdata); void on_group_password(Tox *m, uint32_t groupnumber, const uint8_t *password, size_t length, void *userdata);
void on_group_nick_change(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *newname, size_t length, void on_group_nick_change(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *newname, size_t length,
void *userdata); void *userdata);
void on_group_status_change(Tox *m, uint32_t groupnumber, uint32_t peernumber, TOX_USER_STATUS status, void *userdata); void on_group_status_change(Tox *m, uint32_t groupnumber, uint32_t peernumber, TOX_USER_STATUS status, void *userdata);
void on_group_self_join(Tox *m, uint32_t groupnumber, void *userdata); void on_group_self_join(Tox *m, uint32_t groupnumber, void *userdata);
void on_group_rejected(Tox *m, uint32_t groupnumber, TOX_GROUP_JOIN_FAIL type, void *userdata); void on_group_rejected(Tox *m, uint32_t groupnumber, Tox_Group_Join_Fail type, void *userdata);
void on_group_moderation(Tox *m, uint32_t groupnumber, uint32_t source_peernum, uint32_t target_peernum, void on_group_moderation(Tox *m, uint32_t groupnumber, uint32_t source_peernum, uint32_t target_peernum,
TOX_GROUP_MOD_EVENT type, void *userdata); Tox_Group_Mod_Event type, void *userdata);
extern char *DATA_FILE; extern char *DATA_FILE;
extern char *BLOCK_FILE; extern char *BLOCK_FILE;

View File

@ -486,7 +486,7 @@ void on_group_peer_limit(Tox *m, uint32_t groupnumber, uint32_t peer_limit, void
} }
} }
void on_group_privacy_state(Tox *m, uint32_t groupnumber, TOX_GROUP_PRIVACY_STATE privacy_state, void *userdata) void on_group_privacy_state(Tox *m, uint32_t groupnumber, Tox_Group_Privacy_State privacy_state, void *userdata)
{ {
for (size_t i = 0; i < MAX_WINDOWS_NUM; ++i) { for (size_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
if (windows[i] != NULL && windows[i]->onGroupPrivacyState != NULL) { if (windows[i] != NULL && windows[i]->onGroupPrivacyState != NULL) {
@ -495,7 +495,7 @@ void on_group_privacy_state(Tox *m, uint32_t groupnumber, TOX_GROUP_PRIVACY_STAT
} }
} }
void on_group_topic_lock(Tox *m, uint32_t groupnumber, TOX_GROUP_TOPIC_LOCK topic_lock, void *userdata) void on_group_topic_lock(Tox *m, uint32_t groupnumber, Tox_Group_Topic_Lock topic_lock, void *userdata)
{ {
for (size_t i = 0; i < MAX_WINDOWS_NUM; ++i) { for (size_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
if (windows[i] != NULL && windows[i]->onGroupTopicLock != NULL) { if (windows[i] != NULL && windows[i]->onGroupTopicLock != NULL) {
@ -536,7 +536,7 @@ void on_group_self_join(Tox *m, uint32_t groupnumber, void *userdata)
} }
} }
void on_group_rejected(Tox *m, uint32_t groupnumber, TOX_GROUP_JOIN_FAIL type, void *userdata) void on_group_rejected(Tox *m, uint32_t groupnumber, Tox_Group_Join_Fail type, void *userdata)
{ {
for (size_t i = 0; i < MAX_WINDOWS_NUM; ++i) { for (size_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
if (windows[i] != NULL && windows[i]->onGroupRejected != NULL) { if (windows[i] != NULL && windows[i]->onGroupRejected != NULL) {
@ -546,7 +546,7 @@ void on_group_rejected(Tox *m, uint32_t groupnumber, TOX_GROUP_JOIN_FAIL type, v
} }
void on_group_moderation(Tox *m, uint32_t groupnumber, uint32_t source_peer_id, uint32_t target_peer_id, void on_group_moderation(Tox *m, uint32_t groupnumber, uint32_t source_peer_id, uint32_t target_peer_id,
TOX_GROUP_MOD_EVENT type, void *userdata) Tox_Group_Mod_Event type, void *userdata)
{ {
for (size_t i = 0; i < MAX_WINDOWS_NUM; ++i) { for (size_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
if (windows[i] != NULL && windows[i]->onGroupModeration != NULL) { if (windows[i] != NULL && windows[i]->onGroupModeration != NULL) {

View File

@ -197,18 +197,18 @@ struct ToxWindow {
void(*onGroupMessage)(ToxWindow *, Tox *, uint32_t, uint32_t, TOX_MESSAGE_TYPE, const char *, size_t); void(*onGroupMessage)(ToxWindow *, Tox *, uint32_t, uint32_t, TOX_MESSAGE_TYPE, const char *, size_t);
void(*onGroupPrivateMessage)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t); void(*onGroupPrivateMessage)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t);
void(*onGroupPeerJoin)(ToxWindow *, Tox *, uint32_t, uint32_t); void(*onGroupPeerJoin)(ToxWindow *, Tox *, uint32_t, uint32_t);
void(*onGroupPeerExit)(ToxWindow *, Tox *, uint32_t, uint32_t, TOX_GROUP_EXIT_TYPE, const char *, size_t, const char *, void(*onGroupPeerExit)(ToxWindow *, Tox *, uint32_t, uint32_t, Tox_Group_Exit_Type, const char *, size_t, const char *,
size_t); size_t);
void(*onGroupNickChange)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t); void(*onGroupNickChange)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t);
void(*onGroupStatusChange)(ToxWindow *, Tox *, uint32_t, uint32_t, TOX_USER_STATUS); void(*onGroupStatusChange)(ToxWindow *, Tox *, uint32_t, uint32_t, TOX_USER_STATUS);
void(*onGroupTopicChange)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t); void(*onGroupTopicChange)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t);
void(*onGroupPeerLimit)(ToxWindow *, Tox *, uint32_t, uint32_t); void(*onGroupPeerLimit)(ToxWindow *, Tox *, uint32_t, uint32_t);
void(*onGroupPrivacyState)(ToxWindow *, Tox *, uint32_t, TOX_GROUP_PRIVACY_STATE); void(*onGroupPrivacyState)(ToxWindow *, Tox *, uint32_t, Tox_Group_Privacy_State);
void(*onGroupTopicLock)(ToxWindow *, Tox *, uint32_t, TOX_GROUP_TOPIC_LOCK); void(*onGroupTopicLock)(ToxWindow *, Tox *, uint32_t, Tox_Group_Topic_Lock);
void(*onGroupPassword)(ToxWindow *, Tox *, uint32_t, const char *, size_t); void(*onGroupPassword)(ToxWindow *, Tox *, uint32_t, const char *, size_t);
void(*onGroupSelfJoin)(ToxWindow *, Tox *, uint32_t); void(*onGroupSelfJoin)(ToxWindow *, Tox *, uint32_t);
void(*onGroupRejected)(ToxWindow *, Tox *, uint32_t, TOX_GROUP_JOIN_FAIL); void(*onGroupRejected)(ToxWindow *, Tox *, uint32_t, Tox_Group_Join_Fail);
void(*onGroupModeration)(ToxWindow *, Tox *, uint32_t, uint32_t, uint32_t, TOX_GROUP_MOD_EVENT); void(*onGroupModeration)(ToxWindow *, Tox *, uint32_t, uint32_t, uint32_t, Tox_Group_Mod_Event);
#ifdef AUDIO #ifdef AUDIO