forked from Green-Sky/tomato
Squashed 'external/toxcore/c-toxcore/' changes from e29e185c03..f1df709b87
f1df709b87 feat: add ngc events 1b6c907235 refactor: Make event dispatch ordered by receive time. b7f9367f6f test: Upgrade cppcheck, fix some warnings. 766e62bc89 chore: Use `pkg_search_module` directly in cmake. 00ff078f91 cleanup: Use target_link_libraries directly in cmake. c58928cc89 chore: Add `IMPORTED_TARGET` to pkg-config packages. 895a6af122 cleanup: Remove NaCl support. 41dfb1c1c0 fix: unpack enum function names in event impl generator 447666d1a1 chore: Disable targets for cross-compilation. 572924e924 chore: Build a docker image with coverage info in it. 415cb78f5e cleanup: Some portability/warning fixes for Windows builds. 425216d9ec fix: Correct a use-after-free and fix some memory leaks. 4b1cfa3e08 refactor: Change all enum-like `#define` sequences into enums. d3c2704fa9 chore: Fix make_single_file to support core-only. 0ce46b644e refactor: Change the `TCP_PACKET_*` defines into an enum. 22cd38ad50 adopt event impl generation tool to #2392 f31ea1088a add the event impl generation tool 4e603bb613 refactor: Use `enum-from-int` rule from tokstyle. 19d8f180d6 chore: Update github actions `uses`. 6a895be0c7 test: Make esp32 build actually try to instantiate tox. 65d09c9bfb cleanup: Remove test net support. REVERT: e29e185c03 feat: add ngc events git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: f1df709b8792da4c0e946d826b11df77d565064d
This commit is contained in:
@ -11,9 +11,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef VANILLA_NACL
|
||||
#include <sodium.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -30,8 +28,6 @@
|
||||
#include "network.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifndef VANILLA_NACL
|
||||
|
||||
/* The minimum size of a plaintext group handshake packet */
|
||||
#define GC_MIN_HS_PACKET_PAYLOAD_SIZE (1 + ENC_PUBLIC_KEY_SIZE + SIG_PUBLIC_KEY_SIZE + 1 + 1)
|
||||
|
||||
@ -160,7 +156,7 @@ non_null() static bool self_gc_is_founder(const GC_Chat *chat);
|
||||
non_null() static bool group_number_valid(const GC_Session *c, int group_number);
|
||||
non_null() static int peer_update(const GC_Chat *chat, const GC_Peer *peer, uint32_t peer_number);
|
||||
non_null() static void group_delete(GC_Session *c, GC_Chat *chat);
|
||||
non_null() static void group_cleanup(GC_Session *c, GC_Chat *chat);
|
||||
non_null() static void group_cleanup(const GC_Session *c, GC_Chat *chat);
|
||||
non_null() static bool group_exists(const GC_Session *c, const uint8_t *chat_id);
|
||||
non_null() static void add_tcp_relays_to_chat(const GC_Session *c, GC_Chat *chat);
|
||||
non_null(1, 2) nullable(4)
|
||||
@ -1280,8 +1276,8 @@ static uint16_t unpack_gc_shared_state(GC_SharedState *shared_state, const uint8
|
||||
memcpy(&voice_state, data + len_processed, sizeof(uint8_t));
|
||||
len_processed += sizeof(uint8_t);
|
||||
|
||||
shared_state->voice_state = group_voice_state_from_int(voice_state);
|
||||
shared_state->privacy_state = group_privacy_state_from_int(privacy_state);
|
||||
group_voice_state_from_int(voice_state, &shared_state->voice_state);
|
||||
group_privacy_state_from_int(privacy_state, &shared_state->privacy_state);
|
||||
|
||||
return len_processed;
|
||||
}
|
||||
@ -7434,6 +7430,9 @@ static int create_new_group(GC_Session *c, const uint8_t *nick, size_t nick_leng
|
||||
return -1;
|
||||
}
|
||||
|
||||
init_gc_shared_state(chat, privacy_state);
|
||||
init_gc_moderation(chat);
|
||||
|
||||
if (!init_gc_tcp_connection(c, chat)) {
|
||||
group_delete(c, chat);
|
||||
return -1;
|
||||
@ -7454,9 +7453,6 @@ static int create_new_group(GC_Session *c, const uint8_t *nick, size_t nick_leng
|
||||
self_gc_set_confirmed(chat, true);
|
||||
self_gc_set_ext_public_key(chat, chat->self_public_key);
|
||||
|
||||
init_gc_shared_state(chat, privacy_state);
|
||||
init_gc_moderation(chat);
|
||||
|
||||
return group_number;
|
||||
}
|
||||
|
||||
@ -8182,7 +8178,7 @@ GC_Session *new_dht_groupchats(Messenger *m)
|
||||
return c;
|
||||
}
|
||||
|
||||
static void group_cleanup(GC_Session *c, GC_Chat *chat)
|
||||
static void group_cleanup(const GC_Session *c, GC_Chat *chat)
|
||||
{
|
||||
kill_group_friend_connection(c, chat);
|
||||
|
||||
@ -8496,4 +8492,3 @@ int gc_add_peers_from_announces(GC_Chat *chat, const GC_Announce *announces, uin
|
||||
|
||||
return added_peers;
|
||||
}
|
||||
#endif // VANILLA_NACL
|
||||
|
Reference in New Issue
Block a user