Skip to content

Commit

Permalink
cleanup: use typedef for private message ID's in callback
Browse files Browse the repository at this point in the history
  • Loading branch information
JFreegman committed Mar 7, 2024
1 parent 7b1db6a commit 32e67ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions auto_tests/group_message_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef struct State {
bool peer_joined;
bool message_sent;
bool message_received;
uint32_t pseudo_msg_id;
Tox_Group_Message_Id pseudo_msg_id;
bool private_message_received;
size_t custom_packets_received;
size_t custom_private_packets_received;
Expand Down Expand Up @@ -287,7 +287,7 @@ static void group_private_message_handler(const Tox_Event_Group_Private_Message
const Tox_Message_Type type = tox_event_group_private_message_get_type(event);
const uint8_t *message = tox_event_group_private_message_get_message(event);
const size_t length = tox_event_group_private_message_get_message_length(event);
const uint32_t pseudo_msg_id = tox_event_group_private_message_get_message_id(event);
const Tox_Group_Message_Id pseudo_msg_id = tox_event_group_private_message_get_message_id(event);

ck_assert_msg(length == TEST_PRIVATE_MESSAGE_LEN, "Failed to receive message. Invalid length: %zu\n", length);

Expand Down
4 changes: 2 additions & 2 deletions toxcore/tox.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ static void tox_group_password_handler(const Messenger *m, uint32_t group_number

non_null(1, 5) nullable(8)
static void tox_group_message_handler(const Messenger *m, uint32_t group_number, GC_Peer_Id peer_id, unsigned int type,
const uint8_t *message, size_t length, uint32_t message_id, void *user_data)
const uint8_t *message, size_t length, Tox_Group_Message_Id message_id, void *user_data)
{
struct Tox_Userdata *tox_data = (struct Tox_Userdata *)user_data;

Expand All @@ -538,7 +538,7 @@ static void tox_group_message_handler(const Messenger *m, uint32_t group_number,

non_null(1, 5) nullable(8)
static void tox_group_private_message_handler(const Messenger *m, uint32_t group_number, GC_Peer_Id peer_id,
unsigned int type, const uint8_t *message, size_t length, uint32_t message_id, void *user_data)
unsigned int type, const uint8_t *message, size_t length, Tox_Group_Message_Id message_id, void *user_data)
{
struct Tox_Userdata *tox_data = (struct Tox_Userdata *)user_data;

Expand Down
2 changes: 1 addition & 1 deletion toxcore/tox.h
Original file line number Diff line number Diff line change
Expand Up @@ -4753,7 +4753,7 @@ void tox_callback_group_message(Tox *tox, tox_group_message_cb *callback);
*/
typedef void tox_group_private_message_cb(
Tox *tox, Tox_Group_Number group_number, Tox_Group_Peer_Number peer_id, Tox_Message_Type type,
const uint8_t message[], size_t length, uint32_t message_id, void *user_data);
const uint8_t message[], size_t length, Tox_Group_Message_Id message_id, void *user_data);

/**
* Set the callback for the `group_private_message` event. Pass NULL to unset.
Expand Down

0 comments on commit 32e67ab

Please sign in to comment.