Skip to content

Commit

Permalink
chore: Fix recent groupchat API breakage
Browse files Browse the repository at this point in the history
  • Loading branch information
JFreegman committed Feb 22, 2024
1 parent 6e933b2 commit 6fbcdc0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
5 changes: 3 additions & 2 deletions script/build-minimal-static-toxic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"

# The git hash of the c-toxcore version we're using
TOXCORE_VERSION="c71567dc18515f69111c5af7902bc0357f0cd9ea"
TOXCORE_VERSION="e1fa5cae964c9f98ea0d35340d4014bfdd759882"

# The sha256sum of the c-toxcore tarball for TOXCORE_VERSION
TOXCORE_HASH="31c211385db8022f498dc6f81702908729dc770549787050d4e77b0c23d8971f"
TOXCORE_HASH="72803d1f9ff59a4cd6e7eec206bf452d96317c22080060a2313b5d542db82f57"

TOXCORE_FILENAME="c-toxcore-$TOXCORE_VERSION.tar.gz"

Expand Down Expand Up @@ -167,6 +167,7 @@ cmake -B_build -H. \
-DBUILD_TOXAV=OFF \
-DBOOTSTRAP_DAEMON=OFF \
-DDHT_BOOTSTRAP=OFF \
-DEXPERIMENTAL_API=ON \
-DCMAKE_INSTALL_PREFIX="$BUILD_DIR/prefix-toxcore"
cmake --build _build --target install

Expand Down
22 changes: 11 additions & 11 deletions src/groupchat_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void cmd_chatid(WINDOW *window, ToxWindow *self, Toxic *toxic, int argc, char (*
char id_string[TOX_GROUP_CHAT_ID_SIZE * 2 + 1] = {0};
char chat_id[TOX_GROUP_CHAT_ID_SIZE];

Tox_Err_Group_State_Queries err;
Tox_Err_Group_State_Query err;

if (!tox_group_get_chat_id(toxic->tox, self->num, (uint8_t *) chat_id, &err)) {
line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to retrieve the Chat ID (error %d).", err);
Expand Down Expand Up @@ -484,10 +484,10 @@ void cmd_set_peerlimit(WINDOW *window, ToxWindow *self, Toxic *toxic, int argc,
int maxpeers = 0;

if (argc < 1) {
Tox_Err_Group_State_Queries err;
Tox_Err_Group_State_Query err;
maxpeers = tox_group_get_peer_limit(tox, self->num, &err);

if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
if (err != TOX_ERR_GROUP_STATE_QUERY_OK) {
line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to retrieve peer limit (error %d).",
err);
return;
Expand Down Expand Up @@ -540,10 +540,10 @@ void cmd_set_voice(WINDOW *window, ToxWindow *self, Toxic *toxic, int argc, char
Tox_Group_Voice_State voice_state;

if (argc < 1) {
Tox_Err_Group_State_Queries err;
Tox_Err_Group_State_Query err;
voice_state = tox_group_get_voice_state(tox, self->num, &err);

if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
if (err != TOX_ERR_GROUP_STATE_QUERY_OK) {
line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to retrieve voice state (error %d).",
err);
return;
Expand Down Expand Up @@ -624,10 +624,10 @@ void cmd_set_privacy(WINDOW *window, ToxWindow *self, Toxic *toxic, int argc, ch
Tox_Group_Privacy_State privacy_state;

if (argc < 1) {
Tox_Err_Group_State_Queries err;
Tox_Err_Group_State_Query err;
privacy_state = tox_group_get_privacy_state(tox, self->num, &err);

if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
if (err != TOX_ERR_GROUP_STATE_QUERY_OK) {
line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to retrieve privacy state (error %d).",
err);
return;
Expand Down Expand Up @@ -686,10 +686,10 @@ void cmd_set_topic_lock(WINDOW *window, ToxWindow *self, Toxic *toxic, int argc,
const char *tlock_str = NULL;

if (argc < 1) {
Tox_Err_Group_State_Queries err;
Tox_Err_Group_State_Query err;
topic_lock = tox_group_get_topic_lock(tox, self->num, &err);

if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
if (err != TOX_ERR_GROUP_STATE_QUERY_OK) {
line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to retrieve topic lock (error %d).",
err);
return;
Expand Down Expand Up @@ -907,10 +907,10 @@ void cmd_set_topic(WINDOW *window, ToxWindow *self, Toxic *toxic, int argc, char
const Client_Config *c_config = toxic->c_config;

if (argc < 1) {
Tox_Err_Group_State_Queries err;
Tox_Err_Group_State_Query err;
size_t tlen = tox_group_get_topic_size(tox, self->num, &err);

if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
if (err != TOX_ERR_GROUP_STATE_QUERY_OK) {
line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to retrieve topic length (error %d).",
err);
return;
Expand Down
12 changes: 6 additions & 6 deletions src/groupchats.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ static void init_groupchat_log(ToxWindow *self, Toxic *toxic, uint32_t groupnumb

char chat_id[TOX_GROUP_CHAT_ID_SIZE];

Tox_Err_Group_State_Queries err;
Tox_Err_Group_State_Query err;

if (!tox_group_get_chat_id(tox, groupnumber, (uint8_t *)chat_id, &err)) {
line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0,
Expand Down Expand Up @@ -1420,10 +1420,10 @@ static void groupchat_set_group_name(ToxWindow *self, Toxic *toxic, uint32_t gro
return;
}

Tox_Err_Group_State_Queries err;
Tox_Err_Group_State_Query err;
size_t len = tox_group_get_name_size(tox, groupnumber, &err);

if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
if (err != TOX_ERR_GROUP_STATE_QUERY_OK) {
line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0,
"Failed to retrieve group name length (error %d)", err);
return;
Expand Down Expand Up @@ -1468,10 +1468,10 @@ static void groupchat_onGroupSelfJoin(ToxWindow *self, Toxic *toxic, uint32_t gr

char topic[TOX_GROUP_MAX_TOPIC_LENGTH + 1];

Tox_Err_Group_State_Queries err;
Tox_Err_Group_State_Query err;
const size_t topic_length = tox_group_get_topic_size(tox, groupnumber, &err);

if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
if (err != TOX_ERR_GROUP_STATE_QUERY_OK) {
line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0,
"Failed to retrieve group topic length (error %d)", err);
return;
Expand All @@ -1480,7 +1480,7 @@ static void groupchat_onGroupSelfJoin(ToxWindow *self, Toxic *toxic, uint32_t gr
tox_group_get_topic(tox, groupnumber, (uint8_t *) topic, &err);
topic[topic_length] = 0;

if (err != TOX_ERR_GROUP_STATE_QUERIES_OK) {
if (err != TOX_ERR_GROUP_STATE_QUERY_OK) {
line_info_add(self, c_config, false, NULL, NULL, SYS_MSG, 0, 0, "Failed to retrieve group topic (error %d)",
err);
return;
Expand Down

0 comments on commit 6fbcdc0

Please sign in to comment.