Squashed 'external/toxcore/c-toxcore/' changes from 73d9b845a3..e2c01e457b

e2c01e457b refactor: Use enum-specific pack functions for enum values.
afc472402b refactor: Factor out union pack switch from event packer.
6caa7ce4b1 cleanup: Move the 2-element array pack out of individual events.
687af81f20 cleanup: Remove empty test doing nothing.
fcf5882428 test: Add printf log statement to group_moderation_test.
b4d8826228 cleanup: Remove old type-ordered event getters.
8c35e0fefb feat: add ngc events
97bdd83937 refactor: Make event dispatch ordered by receive time.
001d00ab30 fix: dont resolve to ipv6 addresses when its disabled
d3b935f63f fix(test): tests use ipv6 by default, even with USE_IPV6 set to 0
29fc5ea1f7 chore: add clangd files to .gitignore
d30c81acbc refactor: Move file streaming test to its own file.
acdc67387b fix(ci): window builds now build in parallel
REVERT: 73d9b845a3 cleanup: Remove old type-ordered event getters.
REVERT: b0840cc02d feat: add ngc events
REVERT: 7df9a51349 refactor: Make event dispatch ordered by receive time.

git-subtree-dir: external/toxcore/c-toxcore
git-subtree-split: e2c01e457bfb8a59537175c8fe17ca9ab1c9e3e1
This commit is contained in:
2024-01-15 23:32:23 +01:00
parent b1fe064484
commit 61accfe184
63 changed files with 632 additions and 344 deletions

View File

@ -54,10 +54,7 @@ static void tox_event_conference_connected_destruct(Tox_Event_Conference_Connect
bool tox_event_conference_connected_pack(
const Tox_Event_Conference_Connected *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_CONFERENCE_CONNECTED)
&& bin_pack_u32(bp, event->conference_number);
return bin_pack_u32(bp, event->conference_number);
}
non_null()

View File

@ -14,6 +14,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -107,12 +108,9 @@ static void tox_event_conference_invite_destruct(Tox_Event_Conference_Invite *co
bool tox_event_conference_invite_pack(
const Tox_Event_Conference_Invite *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_CONFERENCE_INVITE)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_u32(bp, event->type)
&& tox_conference_type_pack(event->type, bp)
&& bin_pack_bin(bp, event->cookie, event->cookie_length);
}
@ -126,7 +124,7 @@ static bool tox_event_conference_invite_unpack_into(
}
return bin_unpack_u32(bu, &event->friend_number)
&& tox_conference_type_unpack(bu, &event->type)
&& tox_conference_type_unpack(&event->type, bu)
&& bin_unpack_bin(bu, &event->cookie, &event->cookie_length);
}

View File

@ -14,6 +14,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -121,13 +122,10 @@ static void tox_event_conference_message_destruct(Tox_Event_Conference_Message *
bool tox_event_conference_message_pack(
const Tox_Event_Conference_Message *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_CONFERENCE_MESSAGE)
&& bin_pack_array(bp, 4)
return bin_pack_array(bp, 4)
&& bin_pack_u32(bp, event->conference_number)
&& bin_pack_u32(bp, event->peer_number)
&& bin_pack_u32(bp, event->type)
&& tox_message_type_pack(event->type, bp)
&& bin_pack_bin(bp, event->message, event->message_length);
}
@ -142,7 +140,7 @@ static bool tox_event_conference_message_unpack_into(
return bin_unpack_u32(bu, &event->conference_number)
&& bin_unpack_u32(bu, &event->peer_number)
&& tox_message_type_unpack(bu, &event->type)
&& tox_message_type_unpack(&event->type, bu)
&& bin_unpack_bin(bu, &event->message, &event->message_length);
}

View File

@ -54,10 +54,7 @@ static void tox_event_conference_peer_list_changed_destruct(Tox_Event_Conference
bool tox_event_conference_peer_list_changed_pack(
const Tox_Event_Conference_Peer_List_Changed *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_CONFERENCE_PEER_LIST_CHANGED)
&& bin_pack_u32(bp, event->conference_number);
return bin_pack_u32(bp, event->conference_number);
}
non_null()

View File

@ -106,10 +106,7 @@ static void tox_event_conference_peer_name_destruct(Tox_Event_Conference_Peer_Na
bool tox_event_conference_peer_name_pack(
const Tox_Event_Conference_Peer_Name *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_CONFERENCE_PEER_NAME)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->conference_number)
&& bin_pack_u32(bp, event->peer_number)
&& bin_pack_bin(bp, event->name, event->name_length);

View File

@ -106,10 +106,7 @@ static void tox_event_conference_title_destruct(Tox_Event_Conference_Title *conf
bool tox_event_conference_title_pack(
const Tox_Event_Conference_Title *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_CONFERENCE_TITLE)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->conference_number)
&& bin_pack_u32(bp, event->peer_number)
&& bin_pack_bin(bp, event->title, event->title_length);

View File

@ -96,10 +96,7 @@ static void tox_event_file_chunk_request_destruct(Tox_Event_File_Chunk_Request *
bool tox_event_file_chunk_request_pack(
const Tox_Event_File_Chunk_Request *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FILE_CHUNK_REQUEST)
&& bin_pack_array(bp, 4)
return bin_pack_array(bp, 4)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_u32(bp, event->file_number)
&& bin_pack_u64(bp, event->position)

View File

@ -134,10 +134,7 @@ static void tox_event_file_recv_destruct(Tox_Event_File_Recv *file_recv, const M
bool tox_event_file_recv_pack(
const Tox_Event_File_Recv *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FILE_RECV)
&& bin_pack_array(bp, 5)
return bin_pack_array(bp, 5)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_u32(bp, event->file_number)
&& bin_pack_u32(bp, event->kind)

View File

@ -120,10 +120,7 @@ static void tox_event_file_recv_chunk_destruct(Tox_Event_File_Recv_Chunk *file_r
bool tox_event_file_recv_chunk_pack(
const Tox_Event_File_Recv_Chunk *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FILE_RECV_CHUNK)
&& bin_pack_array(bp, 4)
return bin_pack_array(bp, 4)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_u32(bp, event->file_number)
&& bin_pack_u64(bp, event->position)

View File

@ -12,6 +12,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -83,13 +84,10 @@ static void tox_event_file_recv_control_destruct(Tox_Event_File_Recv_Control *fi
bool tox_event_file_recv_control_pack(
const Tox_Event_File_Recv_Control *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FILE_RECV_CONTROL)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_u32(bp, event->file_number)
&& bin_pack_u32(bp, event->control);
&& tox_file_control_pack(event->control, bp);
}
non_null()
@ -103,7 +101,7 @@ static bool tox_event_file_recv_control_unpack_into(
return bin_unpack_u32(bu, &event->friend_number)
&& bin_unpack_u32(bu, &event->file_number)
&& tox_file_control_unpack(bu, &event->control);
&& tox_file_control_unpack(&event->control, bu);
}

View File

@ -12,6 +12,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -69,12 +70,9 @@ static void tox_event_friend_connection_status_destruct(Tox_Event_Friend_Connect
bool tox_event_friend_connection_status_pack(
const Tox_Event_Friend_Connection_Status *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FRIEND_CONNECTION_STATUS)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_u32(bp, event->connection_status);
&& tox_connection_pack(event->connection_status, bp);
}
non_null()
@ -87,7 +85,7 @@ static bool tox_event_friend_connection_status_unpack_into(
}
return bin_unpack_u32(bu, &event->friend_number)
&& tox_connection_unpack(bu, &event->connection_status);
&& tox_connection_unpack(&event->connection_status, bu);
}

View File

@ -92,10 +92,7 @@ static void tox_event_friend_lossless_packet_destruct(Tox_Event_Friend_Lossless_
bool tox_event_friend_lossless_packet_pack(
const Tox_Event_Friend_Lossless_Packet *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FRIEND_LOSSLESS_PACKET)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_bin(bp, event->data, event->data_length);
}

View File

@ -92,10 +92,7 @@ static void tox_event_friend_lossy_packet_destruct(Tox_Event_Friend_Lossy_Packet
bool tox_event_friend_lossy_packet_pack(
const Tox_Event_Friend_Lossy_Packet *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FRIEND_LOSSY_PACKET)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_bin(bp, event->data, event->data_length);
}

View File

@ -14,6 +14,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -107,12 +108,9 @@ static void tox_event_friend_message_destruct(Tox_Event_Friend_Message *friend_m
bool tox_event_friend_message_pack(
const Tox_Event_Friend_Message *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FRIEND_MESSAGE)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_u32(bp, event->type)
&& tox_message_type_pack(event->type, bp)
&& bin_pack_bin(bp, event->message, event->message_length);
}
@ -126,7 +124,7 @@ static bool tox_event_friend_message_unpack_into(
}
return bin_unpack_u32(bu, &event->friend_number)
&& tox_message_type_unpack(bu, &event->type)
&& tox_message_type_unpack(&event->type, bu)
&& bin_unpack_bin(bu, &event->message, &event->message_length);
}

View File

@ -92,10 +92,7 @@ static void tox_event_friend_name_destruct(Tox_Event_Friend_Name *friend_name, c
bool tox_event_friend_name_pack(
const Tox_Event_Friend_Name *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FRIEND_NAME)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_bin(bp, event->name, event->name_length);
}

View File

@ -68,10 +68,7 @@ static void tox_event_friend_read_receipt_destruct(Tox_Event_Friend_Read_Receipt
bool tox_event_friend_read_receipt_pack(
const Tox_Event_Friend_Read_Receipt *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FRIEND_READ_RECEIPT)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_u32(bp, event->message_id);
}

View File

@ -93,10 +93,7 @@ static void tox_event_friend_request_destruct(Tox_Event_Friend_Request *friend_r
bool tox_event_friend_request_pack(
const Tox_Event_Friend_Request *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FRIEND_REQUEST)
&& bin_pack_array(bp, 2)
&& bin_pack_bin(bp, event->public_key, TOX_PUBLIC_KEY_SIZE)
&& bin_pack_bin(bp, event->message, event->message_length);
}

View File

@ -12,6 +12,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -69,12 +70,9 @@ static void tox_event_friend_status_destruct(Tox_Event_Friend_Status *friend_sta
bool tox_event_friend_status_pack(
const Tox_Event_Friend_Status *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FRIEND_STATUS)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_u32(bp, event->status);
&& tox_user_status_pack(event->status, bp);
}
non_null()
@ -87,7 +85,7 @@ static bool tox_event_friend_status_unpack_into(
}
return bin_unpack_u32(bu, &event->friend_number)
&& tox_user_status_unpack(bu, &event->status);
&& tox_user_status_unpack(&event->status, bu);
}

View File

@ -92,10 +92,7 @@ static void tox_event_friend_status_message_destruct(Tox_Event_Friend_Status_Mes
bool tox_event_friend_status_message_pack(
const Tox_Event_Friend_Status_Message *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FRIEND_STATUS_MESSAGE)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_bin(bp, event->message, event->message_length);
}

View File

@ -68,10 +68,7 @@ static void tox_event_friend_typing_destruct(Tox_Event_Friend_Typing *friend_typ
bool tox_event_friend_typing_pack(
const Tox_Event_Friend_Typing *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_FRIEND_TYPING)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_bool(bp, event->typing);
}

View File

@ -106,10 +106,7 @@ static void tox_event_group_custom_packet_destruct(Tox_Event_Group_Custom_Packet
bool tox_event_group_custom_packet_pack(
const Tox_Event_Group_Custom_Packet *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_CUSTOM_PACKET)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->peer_id)
&& bin_pack_bin(bp, event->data, event->data_length);

View File

@ -106,10 +106,7 @@ static void tox_event_group_custom_private_packet_destruct(Tox_Event_Group_Custo
bool tox_event_group_custom_private_packet_pack(
const Tox_Event_Group_Custom_Private_Packet *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_CUSTOM_PRIVATE_PACKET)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->peer_id)
&& bin_pack_bin(bp, event->data, event->data_length);

View File

@ -129,10 +129,7 @@ static void tox_event_group_invite_destruct(Tox_Event_Group_Invite *group_invite
bool tox_event_group_invite_pack(
const Tox_Event_Group_Invite *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_INVITE)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->friend_number)
&& bin_pack_bin(bp, event->invite_data, event->invite_data_length)
&& bin_pack_bin(bp, event->group_name, event->group_name_length);

View File

@ -12,6 +12,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -69,12 +70,9 @@ static void tox_event_group_join_fail_destruct(Tox_Event_Group_Join_Fail *group_
bool tox_event_group_join_fail_pack(
const Tox_Event_Group_Join_Fail *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_JOIN_FAIL)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->fail_type);
&& tox_group_join_fail_pack(event->fail_type, bp);
}
non_null()
@ -87,7 +85,7 @@ static bool tox_event_group_join_fail_unpack_into(
}
return bin_unpack_u32(bu, &event->group_number)
&& tox_group_join_fail_unpack(bu, &event->fail_type);
&& tox_group_join_fail_unpack(&event->fail_type, bu);
}

View File

@ -14,6 +14,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -135,13 +136,10 @@ static void tox_event_group_message_destruct(Tox_Event_Group_Message *group_mess
bool tox_event_group_message_pack(
const Tox_Event_Group_Message *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_MESSAGE)
&& bin_pack_array(bp, 5)
return bin_pack_array(bp, 5)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->peer_id)
&& bin_pack_u32(bp, event->type)
&& tox_message_type_pack(event->type, bp)
&& bin_pack_bin(bp, event->message, event->message_length)
&& bin_pack_u32(bp, event->message_id);
}
@ -157,7 +155,7 @@ static bool tox_event_group_message_unpack_into(
return bin_unpack_u32(bu, &event->group_number)
&& bin_unpack_u32(bu, &event->peer_id)
&& tox_message_type_unpack(bu, &event->type)
&& tox_message_type_unpack(&event->type, bu)
&& bin_unpack_bin(bu, &event->message, &event->message_length)
&& bin_unpack_u32(bu, &event->message_id);
}

View File

@ -12,6 +12,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -97,14 +98,11 @@ static void tox_event_group_moderation_destruct(Tox_Event_Group_Moderation *grou
bool tox_event_group_moderation_pack(
const Tox_Event_Group_Moderation *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_MODERATION)
&& bin_pack_array(bp, 4)
return bin_pack_array(bp, 4)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->source_peer_id)
&& bin_pack_u32(bp, event->target_peer_id)
&& bin_pack_u32(bp, event->mod_type);
&& tox_group_mod_event_pack(event->mod_type, bp);
}
non_null()
@ -119,7 +117,7 @@ static bool tox_event_group_moderation_unpack_into(
return bin_unpack_u32(bu, &event->group_number)
&& bin_unpack_u32(bu, &event->source_peer_id)
&& bin_unpack_u32(bu, &event->target_peer_id)
&& tox_group_mod_event_unpack(bu, &event->mod_type);
&& tox_group_mod_event_unpack(&event->mod_type, bu);
}

View File

@ -92,10 +92,7 @@ static void tox_event_group_password_destruct(Tox_Event_Group_Password *group_pa
bool tox_event_group_password_pack(
const Tox_Event_Group_Password *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_PASSWORD)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_bin(bp, event->password, event->password_length);
}

View File

@ -14,6 +14,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -158,13 +159,10 @@ static void tox_event_group_peer_exit_destruct(Tox_Event_Group_Peer_Exit *group_
bool tox_event_group_peer_exit_pack(
const Tox_Event_Group_Peer_Exit *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_PEER_EXIT)
&& bin_pack_array(bp, 5)
return bin_pack_array(bp, 5)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->peer_id)
&& bin_pack_u32(bp, event->exit_type)
&& tox_group_exit_type_pack(event->exit_type, bp)
&& bin_pack_bin(bp, event->name, event->name_length)
&& bin_pack_bin(bp, event->part_message, event->part_message_length);
}
@ -180,7 +178,7 @@ static bool tox_event_group_peer_exit_unpack_into(
return bin_unpack_u32(bu, &event->group_number)
&& bin_unpack_u32(bu, &event->peer_id)
&& tox_group_exit_type_unpack(bu, &event->exit_type)
&& tox_group_exit_type_unpack(&event->exit_type, bu)
&& bin_unpack_bin(bu, &event->name, &event->name_length)
&& bin_unpack_bin(bu, &event->part_message, &event->part_message_length);
}

View File

@ -68,10 +68,7 @@ static void tox_event_group_peer_join_destruct(Tox_Event_Group_Peer_Join *group_
bool tox_event_group_peer_join_pack(
const Tox_Event_Group_Peer_Join *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_PEER_JOIN)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->peer_id);
}

View File

@ -68,10 +68,7 @@ static void tox_event_group_peer_limit_destruct(Tox_Event_Group_Peer_Limit *grou
bool tox_event_group_peer_limit_pack(
const Tox_Event_Group_Peer_Limit *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_PEER_LIMIT)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->peer_limit);
}

View File

@ -106,10 +106,7 @@ static void tox_event_group_peer_name_destruct(Tox_Event_Group_Peer_Name *group_
bool tox_event_group_peer_name_pack(
const Tox_Event_Group_Peer_Name *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_PEER_NAME)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->peer_id)
&& bin_pack_bin(bp, event->name, event->name_length);

View File

@ -12,6 +12,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -83,13 +84,10 @@ static void tox_event_group_peer_status_destruct(Tox_Event_Group_Peer_Status *gr
bool tox_event_group_peer_status_pack(
const Tox_Event_Group_Peer_Status *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_PEER_STATUS)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->peer_id)
&& bin_pack_u32(bp, event->status);
&& tox_user_status_pack(event->status, bp);
}
non_null()
@ -103,7 +101,7 @@ static bool tox_event_group_peer_status_unpack_into(
return bin_unpack_u32(bu, &event->group_number)
&& bin_unpack_u32(bu, &event->peer_id)
&& tox_user_status_unpack(bu, &event->status);
&& tox_user_status_unpack(&event->status, bu);
}

View File

@ -12,6 +12,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -69,12 +70,9 @@ static void tox_event_group_privacy_state_destruct(Tox_Event_Group_Privacy_State
bool tox_event_group_privacy_state_pack(
const Tox_Event_Group_Privacy_State *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_PRIVACY_STATE)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->privacy_state);
&& tox_group_privacy_state_pack(event->privacy_state, bp);
}
non_null()
@ -87,7 +85,7 @@ static bool tox_event_group_privacy_state_unpack_into(
}
return bin_unpack_u32(bu, &event->group_number)
&& tox_group_privacy_state_unpack(bu, &event->privacy_state);
&& tox_group_privacy_state_unpack(&event->privacy_state, bu);
}

View File

@ -14,6 +14,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -121,13 +122,10 @@ static void tox_event_group_private_message_destruct(Tox_Event_Group_Private_Mes
bool tox_event_group_private_message_pack(
const Tox_Event_Group_Private_Message *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_PRIVATE_MESSAGE)
&& bin_pack_array(bp, 4)
return bin_pack_array(bp, 4)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->peer_id)
&& bin_pack_u32(bp, event->type)
&& tox_message_type_pack(event->type, bp)
&& bin_pack_bin(bp, event->message, event->message_length);
}
@ -142,7 +140,7 @@ static bool tox_event_group_private_message_unpack_into(
return bin_unpack_u32(bu, &event->group_number)
&& bin_unpack_u32(bu, &event->peer_id)
&& tox_message_type_unpack(bu, &event->type)
&& tox_message_type_unpack(&event->type, bu)
&& bin_unpack_bin(bu, &event->message, &event->message_length);
}

View File

@ -54,10 +54,7 @@ static void tox_event_group_self_join_destruct(Tox_Event_Group_Self_Join *group_
bool tox_event_group_self_join_pack(
const Tox_Event_Group_Self_Join *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_SELF_JOIN)
&& bin_pack_u32(bp, event->group_number);
return bin_pack_u32(bp, event->group_number);
}
non_null()

View File

@ -106,10 +106,7 @@ static void tox_event_group_topic_destruct(Tox_Event_Group_Topic *group_topic, c
bool tox_event_group_topic_pack(
const Tox_Event_Group_Topic *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_TOPIC)
&& bin_pack_array(bp, 3)
return bin_pack_array(bp, 3)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->peer_id)
&& bin_pack_bin(bp, event->topic, event->topic_length);

View File

@ -12,6 +12,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -69,12 +70,9 @@ static void tox_event_group_topic_lock_destruct(Tox_Event_Group_Topic_Lock *grou
bool tox_event_group_topic_lock_pack(
const Tox_Event_Group_Topic_Lock *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_TOPIC_LOCK)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->topic_lock);
&& tox_group_topic_lock_pack(event->topic_lock, bp);
}
non_null()
@ -87,7 +85,7 @@ static bool tox_event_group_topic_lock_unpack_into(
}
return bin_unpack_u32(bu, &event->group_number)
&& tox_group_topic_lock_unpack(bu, &event->topic_lock);
&& tox_group_topic_lock_unpack(&event->topic_lock, bu);
}

View File

@ -12,6 +12,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -69,12 +70,9 @@ static void tox_event_group_voice_state_destruct(Tox_Event_Group_Voice_State *gr
bool tox_event_group_voice_state_pack(
const Tox_Event_Group_Voice_State *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_GROUP_VOICE_STATE)
&& bin_pack_array(bp, 2)
&& bin_pack_u32(bp, event->group_number)
&& bin_pack_u32(bp, event->voice_state);
&& tox_group_voice_state_pack(event->voice_state, bp);
}
non_null()
@ -87,7 +85,7 @@ static bool tox_event_group_voice_state_unpack_into(
}
return bin_unpack_u32(bu, &event->group_number)
&& tox_group_voice_state_unpack(bu, &event->voice_state);
&& tox_group_voice_state_unpack(&event->voice_state, bu);
}

View File

@ -12,6 +12,7 @@
#include "../mem.h"
#include "../tox.h"
#include "../tox_events.h"
#include "../tox_pack.h"
#include "../tox_unpack.h"
@ -55,10 +56,7 @@ static void tox_event_self_connection_status_destruct(Tox_Event_Self_Connection_
bool tox_event_self_connection_status_pack(
const Tox_Event_Self_Connection_Status *event, Bin_Pack *bp)
{
assert(event != nullptr);
return bin_pack_array(bp, 2)
&& bin_pack_u32(bp, TOX_EVENT_SELF_CONNECTION_STATUS)
&& bin_pack_u32(bp, event->connection_status);
return tox_connection_pack(event->connection_status, bp);
}
non_null()
@ -66,7 +64,7 @@ static bool tox_event_self_connection_status_unpack_into(
Tox_Event_Self_Connection_Status *event, Bin_Unpack *bu)
{
assert(event != nullptr);
return tox_connection_unpack(bu, &event->connection_status);
return tox_connection_unpack(&event->connection_status, bu);
}