Skip to content

Commit

Permalink
Tox: toxcore updated to v0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
aunsane committed Aug 9, 2018
1 parent eab7305 commit 7258aff
Show file tree
Hide file tree
Showing 18 changed files with 783 additions and 397 deletions.
29 changes: 29 additions & 0 deletions protocols/Tox/libtox/docs/CHANGELOG.md
@@ -1,9 +1,38 @@


## v0.2.5

### Merged PRs:

- [#1048](https://github.com/TokTok/c-toxcore/pull/1048) Fix error message in m_send_generic_message
- [#1047](https://github.com/TokTok/c-toxcore/pull/1047) Remove unused `m_callback_log` function.
- [#1041](https://github.com/TokTok/c-toxcore/pull/1041) Avoid multiple for-next expressions.
- [#1037](https://github.com/TokTok/c-toxcore/pull/1037) Run all tests in the Autotools build
- [#1035](https://github.com/TokTok/c-toxcore/pull/1035) Fix problems with initial connections and name-setting in conferences
- [#1032](https://github.com/TokTok/c-toxcore/pull/1032) Use auto_test fixture in some tests and standardise filenames
- [#1030](https://github.com/TokTok/c-toxcore/pull/1030) Make a separate `struct Tox` containing the Messenger.
- [#1029](https://github.com/TokTok/c-toxcore/pull/1029) Add `by_id` and `get_id` functions, renaming from `*_uid`.
- [#1025](https://github.com/TokTok/c-toxcore/pull/1025) More fixed_width ints and incorporating file_saving_test.c
- [#1023](https://github.com/TokTok/c-toxcore/pull/1023) Run buildifier on c-toxcore BUILD files.
- [#1022](https://github.com/TokTok/c-toxcore/pull/1022) Make `resize` in `list.c` return bool instead of 0/1.
- [#1021](https://github.com/TokTok/c-toxcore/pull/1021) Remove redundant casts to the same type.
- [#1020](https://github.com/TokTok/c-toxcore/pull/1020) Add github usernames to TODOs.
- [#1019](https://github.com/TokTok/c-toxcore/pull/1019) Synchronise parameter names in headers with those in the implementation.
- [#1018](https://github.com/TokTok/c-toxcore/pull/1018) Reduce nesting by doing more early returns on error.
- [#1017](https://github.com/TokTok/c-toxcore/pull/1017) Add missing braces in dht_test.c.
- [#1011](https://github.com/TokTok/c-toxcore/pull/1011) Run Clang global static analysis on Travis.
- [#1010](https://github.com/TokTok/c-toxcore/pull/1010) Avoid implementations in .h files or #including .c files.

### Closed issues:

- [#1028](https://github.com/TokTok/c-toxcore/issues/1028) qTox crashes 1-2 times a day after update to 0.2.4
- [#1002](https://github.com/TokTok/c-toxcore/issues/1002) Implement an abstraction over pthread and windows thread synchronisation primitives

## v0.2.4

### Merged PRs:

- [#1024](https://github.com/TokTok/c-toxcore/pull/1024) Release v0.2.4
- [#1014](https://github.com/TokTok/c-toxcore/pull/1014) Use string comparison operator in configure.ac.
- [#1013](https://github.com/TokTok/c-toxcore/pull/1013) Link -lsocket and -lnsl for socket functions on Solaris.
- [#1012](https://github.com/TokTok/c-toxcore/pull/1012) Correct the max hostname length constant.
Expand Down
135 changes: 74 additions & 61 deletions protocols/Tox/libtox/src/libtox.def
Expand Up @@ -2,12 +2,81 @@ LIBRARY libtox.mir
DESCRIPTION

EXPORTS
tox_add_tcp_relay
tox_get_salt
tox_is_data_encrypted
tox_pass_decrypt
tox_pass_encrypt
tox_pass_encryption_extra_length
tox_pass_key_decrypt
tox_pass_key_derive
tox_pass_key_derive_with_salt
tox_pass_key_encrypt
tox_pass_key_free
tox_pass_key_length
tox_pass_salt_length
create_recursive_mutex
host_to_net
id_copy
id_equal
max_s32
min_u32
min_u64
net_to_host
tox_address_size
tox_file_id_length
tox_hash_length
tox_max_custom_packet_size
tox_max_filename_length
tox_max_friend_request_length
tox_max_hostname_length
tox_max_message_length
tox_max_name_length
tox_max_status_message_length
tox_nospam_size
tox_options_default
tox_options_free
tox_options_get_end_port
tox_options_get_hole_punching_enabled
tox_options_get_ipv6_enabled
tox_options_get_local_discovery_enabled
tox_options_get_log_callback
tox_options_get_log_user_data
tox_options_get_proxy_host
tox_options_get_proxy_port
tox_options_get_proxy_type
tox_options_get_savedata_data
tox_options_get_savedata_length
tox_options_get_savedata_type
tox_options_get_start_port
tox_options_get_tcp_port
tox_options_get_udp_enabled
tox_options_new
tox_options_set_end_port
tox_options_set_hole_punching_enabled
tox_options_set_ipv6_enabled
tox_options_set_local_discovery_enabled
tox_options_set_log_callback
tox_options_set_log_user_data
tox_options_set_proxy_host
tox_options_set_proxy_port
tox_options_set_proxy_type
tox_options_set_savedata_data
tox_options_set_savedata_length
tox_options_set_savedata_type
tox_options_set_start_port
tox_options_set_tcp_port
tox_options_set_udp_enabled
tox_public_key_size
tox_secret_key_size
tox_version_major
tox_version_minor
tox_version_patch
tox_add_tcp_relay
tox_bootstrap
tox_callback_conference_invite
tox_callback_conference_message
tox_callback_conference_peer_list_changed
tox_callback_conference_peer_name
tox_callback_conference_title
tox_callback_file_chunk_request
tox_callback_file_recv
Expand All @@ -24,12 +93,16 @@ tox_callback_friend_status
tox_callback_friend_status_message
tox_callback_friend_typing
tox_callback_self_connection_status
tox_conference_by_id
tox_conference_by_uid
tox_conference_delete
tox_conference_get_chatlist
tox_conference_get_chatlist_size
tox_conference_get_id
tox_conference_get_title
tox_conference_get_title_size
tox_conference_get_type
tox_conference_get_uid
tox_conference_invite
tox_conference_join
tox_conference_new
Expand All @@ -42,7 +115,6 @@ tox_conference_send_message
tox_conference_set_title
tox_file_control
tox_file_get_file_id
tox_file_id_length
tox_file_seek
tox_file_send
tox_file_send_chunk
Expand All @@ -63,67 +135,13 @@ tox_friend_get_typing
tox_friend_send_lossless_packet
tox_friend_send_lossy_packet
tox_friend_send_message
tox_get_salt
tox_get_savedata
tox_get_savedata_size
tox_hash
tox_hash_length
tox_is_data_encrypted
tox_iterate
tox_iteration_interval
tox_kill
tox_max_custom_packet_size
tox_max_filename_length
tox_max_friend_request_length
tox_max_message_length
tox_max_name_length
tox_max_status_message_length
tox_new
tox_options_default
tox_options_free
tox_options_get_end_port
tox_options_get_hole_punching_enabled
tox_options_get_ipv6_enabled
tox_options_get_local_discovery_enabled
tox_options_get_log_callback
tox_options_get_log_user_data
tox_options_get_proxy_host
tox_options_get_proxy_port
tox_options_get_proxy_type
tox_options_get_savedata_data
tox_options_get_savedata_length
tox_options_get_savedata_type
tox_options_get_start_port
tox_options_get_tcp_port
tox_options_get_udp_enabled
tox_options_new
tox_options_set_end_port
tox_options_set_hole_punching_enabled
tox_options_set_ipv6_enabled
tox_options_set_local_discovery_enabled
tox_options_set_log_callback
tox_options_set_log_user_data
tox_options_set_proxy_host
tox_options_set_proxy_port
tox_options_set_proxy_type
tox_options_set_savedata_data
tox_options_set_savedata_length
tox_options_set_savedata_type
tox_options_set_start_port
tox_options_set_tcp_port
tox_options_set_udp_enabled
tox_pass_decrypt
tox_pass_encrypt
tox_pass_encryption_extra_length
tox_pass_key_decrypt
tox_pass_key_derive
tox_pass_key_derive_with_salt
tox_pass_key_encrypt
tox_pass_key_free
tox_pass_key_length
tox_pass_salt_length
tox_public_key_size
tox_secret_key_size
tox_self_get_address
tox_self_get_connection_status
tox_self_get_dht_id
Expand All @@ -145,8 +163,3 @@ tox_self_set_status
tox_self_set_status_message
tox_self_set_typing
tox_version_is_compatible
tox_version_major
tox_version_minor
tox_version_patch
tox_conference_get_uid
tox_conference_by_uid
8 changes: 3 additions & 5 deletions protocols/Tox/libtox/src/toxcore/DHT.c
Expand Up @@ -1704,12 +1704,10 @@ static uint8_t do_ping_and_sendnode_requests(DHT *dht, uint64_t *lastgetnode, co
/* If node is not dead. */
Client_data *client = &list[i];

IPPTsPng *const assocs[] = { &client->assoc6, &client->assoc4, nullptr };

uint32_t j = 0;
IPPTsPng *const assocs[] = { &client->assoc6, &client->assoc4 };

for (IPPTsPng * const *it = assocs; *it; ++it, ++j) {
IPPTsPng *const assoc = *it;
for (uint32_t j = 0; j < sizeof(assocs) / sizeof(assocs[0]); ++j) {
IPPTsPng *const assoc = assocs[j];

if (!is_timeout(assoc->timestamp, KILL_NODE_TIMEOUT)) {
sort = 0;
Expand Down
16 changes: 6 additions & 10 deletions protocols/Tox/libtox/src/toxcore/Messenger.c
Expand Up @@ -505,7 +505,7 @@ int m_send_message_generic(Messenger *m, int32_t friendnumber, uint8_t type, con
}

if (length >= MAX_CRYPTO_DATA_SIZE) {
LOGGER_ERROR(m->log, "Message length %d is too large", friendnumber);
LOGGER_ERROR(m->log, "Message length %u is too large", length);
return -2;
}

Expand Down Expand Up @@ -842,11 +842,6 @@ static void set_friend_typing(const Messenger *m, int32_t friendnumber, uint8_t
m->friendlist[friendnumber].is_typing = is_typing;
}

void m_callback_log(Messenger *m, logger_cb *function, void *context, void *userdata)
{
logger_callback_log(m->log, function, context, userdata);
}

/* Set the function that will be executed when a friend request is received. */
void m_callback_friendrequest(Messenger *m, m_friend_request_cb *function)
{
Expand Down Expand Up @@ -1985,7 +1980,7 @@ Messenger *new_messenger(Messenger_Options *options, unsigned int *error)
return nullptr;
}

logger_callback_log(m->log, options->log_callback, m, options->log_user_data);
logger_callback_log(m->log, options->log_callback, options->log_context, options->log_user_data);

unsigned int net_err = 0;

Expand Down Expand Up @@ -2631,10 +2626,11 @@ void do_messenger(Messenger *m, void *userdata)

for (client = 0; client < LCLIENT_LIST; ++client) {
const Client_data *cptr = dht_get_close_client(m->dht, client);
const IPPTsPng *assoc = nullptr;
uint32_t a;
const IPPTsPng *const assocs[] = { &cptr->assoc4, &cptr->assoc4, nullptr };

for (const IPPTsPng * const *it = assocs; *it; ++it) {
const IPPTsPng *const assoc = *it;

for (a = 0, assoc = &cptr->assoc4; a < 2; ++a, assoc = &cptr->assoc6) {
if (ip_isset(&assoc->ip_port.ip)) {
last_pinged = m->lastdump - assoc->last_pinged;

Expand Down
11 changes: 4 additions & 7 deletions protocols/Tox/libtox/src/toxcore/Messenger.h
Expand Up @@ -61,6 +61,7 @@ typedef struct Messenger_Options {
bool local_discovery_enabled;

logger_cb *log_callback;
void *log_context;
void *log_user_data;
} Messenger_Options;

Expand Down Expand Up @@ -480,10 +481,6 @@ int m_set_usertyping(Messenger *m, int32_t friendnumber, uint8_t is_typing);
*/
int m_get_istyping(const Messenger *m, int32_t friendnumber);

/* Set the logger callback.
*/
void m_callback_log(Messenger *m, logger_cb *function, void *context, void *userdata);

/* Set the function that will be executed when a friend request is received.
* Function format is function(uint8_t * public_key, uint8_t * data, size_t length)
*/
Expand Down Expand Up @@ -689,14 +686,14 @@ int m_msi_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data,
* return 0 on success.
*/
int m_callback_rtp_packet(Messenger *m, int32_t friendnumber, uint8_t byte,
m_lossy_rtp_packet_cb *packet_handler_callback, void *object);
m_lossy_rtp_packet_cb *function, void *object);

/**********************************************/

/* Set handlers for custom lossy packets.
*
*/
void custom_lossy_packet_registerhandler(Messenger *m, m_friend_lossy_packet_cb *packet_handler_callback);
void custom_lossy_packet_registerhandler(Messenger *m, m_friend_lossy_packet_cb *lossy_packethandler);

/* High level function to send custom lossy packets.
*
Expand All @@ -713,7 +710,7 @@ int m_send_custom_lossy_packet(const Messenger *m, int32_t friendnumber, const u
/* Set handlers for custom lossless packets.
*
*/
void custom_lossless_packet_registerhandler(Messenger *m, m_friend_lossless_packet_cb *packet_handler_callback);
void custom_lossless_packet_registerhandler(Messenger *m, m_friend_lossless_packet_cb *lossless_packethandler);

/* High level function to send custom lossless packets.
*
Expand Down
2 changes: 1 addition & 1 deletion protocols/Tox/libtox/src/toxcore/TCP_client.h
Expand Up @@ -60,7 +60,7 @@ TCP_Client_Status tcp_con_status(const TCP_Client_Connection *con);
void *tcp_con_custom_object(const TCP_Client_Connection *con);
uint32_t tcp_con_custom_uint(const TCP_Client_Connection *con);
void tcp_con_set_custom_object(TCP_Client_Connection *con, void *object);
void tcp_con_set_custom_uint(TCP_Client_Connection *con, uint32_t uint);
void tcp_con_set_custom_uint(TCP_Client_Connection *con, uint32_t value);

/* Create new TCP connection to ip_port/public_key
*/
Expand Down

0 comments on commit 7258aff

Please sign in to comment.