mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge branch 'newer_api' of https://github.com/dubslow/toxcore into new_api
This commit is contained in:
commit
8e2957ec50
|
@ -123,10 +123,10 @@ void tox_file_receive(Tox *tox, uint32_t friend_number, uint32_t file_number, TO
|
||||||
|
|
||||||
TOX_ERR_FILE_CONTROL error;
|
TOX_ERR_FILE_CONTROL error;
|
||||||
|
|
||||||
if (tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, &error)) {
|
if (tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, &error)) {
|
||||||
++file_accepted;
|
++file_accepted;
|
||||||
} else {
|
} else {
|
||||||
ck_abort_msg("tox_file_control failed. %i", error);
|
ck_abort_msg("tox_file_send_control failed. %i", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ START_TEST(test_one)
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
ck_assert_msg(tox_self_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,19 +308,19 @@ START_TEST(test_few_clients)
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
ck_assert_msg(tox_self_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_get_udp_port(tox2, &error) == 33446, "Second Tox instance did not bind to udp port 33446.\n");
|
ck_assert_msg(tox_self_get_udp_port(tox2, &error) == 33446, "Second Tox instance did not bind to udp port 33446.\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_get_udp_port(tox3, &error) == 33447, "Third Tox instance did not bind to udp port 33447.\n");
|
ck_assert_msg(tox_self_get_udp_port(tox3, &error) == 33447, "Third Tox instance did not bind to udp port 33447.\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,9 +336,9 @@ START_TEST(test_few_clients)
|
||||||
uint8_t off = 1;
|
uint8_t off = 1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
tox_iteration(tox1);
|
tox_iterate(tox1);
|
||||||
tox_iteration(tox2);
|
tox_iterate(tox2);
|
||||||
tox_iteration(tox3);
|
tox_iterate(tox3);
|
||||||
|
|
||||||
if (tox_get_connection_status(tox1) && tox_get_connection_status(tox2) && tox_get_connection_status(tox3)) {
|
if (tox_get_connection_status(tox1) && tox_get_connection_status(tox2) && tox_get_connection_status(tox3)) {
|
||||||
if (off) {
|
if (off) {
|
||||||
|
@ -361,17 +361,17 @@ START_TEST(test_few_clients)
|
||||||
tox_callback_friend_message(tox3, print_message, &to_compare);
|
tox_callback_friend_message(tox3, print_message, &to_compare);
|
||||||
uint8_t msgs[TOX_MAX_MESSAGE_LENGTH + 1];
|
uint8_t msgs[TOX_MAX_MESSAGE_LENGTH + 1];
|
||||||
memset(msgs, 'G', sizeof(msgs));
|
memset(msgs, 'G', sizeof(msgs));
|
||||||
TOX_ERR_SEND_MESSAGE errm;
|
TOX_ERR_FRIEND_SEND_MESSAGE errm;
|
||||||
tox_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH + 1, &errm);
|
tox_friend_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH + 1, &errm);
|
||||||
ck_assert_msg(errm == TOX_ERR_SEND_MESSAGE_TOO_LONG, "TOX_MAX_MESSAGE_LENGTH is too small\n");
|
ck_assert_msg(errm == TOX_ERR_FRIEND_SEND_MESSAGE_TOO_LONG, "TOX_MAX_MESSAGE_LENGTH is too small\n");
|
||||||
tox_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH, &errm);
|
tox_friend_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH, &errm);
|
||||||
ck_assert_msg(errm == TOX_ERR_SEND_MESSAGE_OK, "TOX_MAX_MESSAGE_LENGTH is too big\n");
|
ck_assert_msg(errm == TOX_ERR_FRIEND_SEND_MESSAGE_OK, "TOX_MAX_MESSAGE_LENGTH is too big\n");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
messages_received = 0;
|
messages_received = 0;
|
||||||
tox_iteration(tox1);
|
tox_iterate(tox1);
|
||||||
tox_iteration(tox2);
|
tox_iterate(tox2);
|
||||||
tox_iteration(tox3);
|
tox_iterate(tox3);
|
||||||
|
|
||||||
if (messages_received)
|
if (messages_received)
|
||||||
break;
|
break;
|
||||||
|
@ -388,9 +388,9 @@ START_TEST(test_few_clients)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
name_changes = 0;
|
name_changes = 0;
|
||||||
tox_iteration(tox1);
|
tox_iterate(tox1);
|
||||||
tox_iteration(tox2);
|
tox_iterate(tox2);
|
||||||
tox_iteration(tox3);
|
tox_iterate(tox3);
|
||||||
|
|
||||||
if (name_changes)
|
if (name_changes)
|
||||||
break;
|
break;
|
||||||
|
@ -409,9 +409,9 @@ START_TEST(test_few_clients)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
status_m_changes = 0;
|
status_m_changes = 0;
|
||||||
tox_iteration(tox1);
|
tox_iterate(tox1);
|
||||||
tox_iteration(tox2);
|
tox_iterate(tox2);
|
||||||
tox_iteration(tox3);
|
tox_iterate(tox3);
|
||||||
|
|
||||||
if (status_m_changes)
|
if (status_m_changes)
|
||||||
break;
|
break;
|
||||||
|
@ -431,9 +431,9 @@ START_TEST(test_few_clients)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
typing_changes = 0;
|
typing_changes = 0;
|
||||||
tox_iteration(tox1);
|
tox_iterate(tox1);
|
||||||
tox_iteration(tox2);
|
tox_iterate(tox2);
|
||||||
tox_iteration(tox3);
|
tox_iterate(tox3);
|
||||||
|
|
||||||
|
|
||||||
if (typing_changes == 2)
|
if (typing_changes == 2)
|
||||||
|
@ -449,9 +449,9 @@ START_TEST(test_few_clients)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
typing_changes = 0;
|
typing_changes = 0;
|
||||||
tox_iteration(tox1);
|
tox_iterate(tox1);
|
||||||
tox_iteration(tox2);
|
tox_iterate(tox2);
|
||||||
tox_iteration(tox3);
|
tox_iterate(tox3);
|
||||||
|
|
||||||
if (typing_changes == 1)
|
if (typing_changes == 1)
|
||||||
break;
|
break;
|
||||||
|
@ -469,16 +469,16 @@ START_TEST(test_few_clients)
|
||||||
tox_callback_friend_lossless_packet(tox3, &handle_custom_packet, &packet_number);
|
tox_callback_friend_lossless_packet(tox3, &handle_custom_packet, &packet_number);
|
||||||
uint8_t data_c[TOX_MAX_CUSTOM_PACKET_SIZE + 1];
|
uint8_t data_c[TOX_MAX_CUSTOM_PACKET_SIZE + 1];
|
||||||
memset(data_c, ((uint8_t)packet_number), sizeof(data_c));
|
memset(data_c, ((uint8_t)packet_number), sizeof(data_c));
|
||||||
int ret = tox_send_lossless_packet(tox2, 0, data_c, sizeof(data_c), 0);
|
int ret = tox_friend_send_lossless_packet(tox2, 0, data_c, sizeof(data_c), 0);
|
||||||
ck_assert_msg(ret == 0, "tox_send_lossless_packet bigger fail %i", ret);
|
ck_assert_msg(ret == 0, "tox_friend_send_lossless_packet bigger fail %i", ret);
|
||||||
ret = tox_send_lossless_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0);
|
ret = tox_friend_send_lossless_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0);
|
||||||
ck_assert_msg(ret == 1, "tox_send_lossless_packet fail %i", ret);
|
ck_assert_msg(ret == 1, "tox_friend_send_lossless_packet fail %i", ret);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
custom_packet = 0;
|
custom_packet = 0;
|
||||||
tox_iteration(tox1);
|
tox_iterate(tox1);
|
||||||
tox_iteration(tox2);
|
tox_iterate(tox2);
|
||||||
tox_iteration(tox3);
|
tox_iterate(tox3);
|
||||||
|
|
||||||
if (custom_packet == 1)
|
if (custom_packet == 1)
|
||||||
break;
|
break;
|
||||||
|
@ -491,16 +491,16 @@ START_TEST(test_few_clients)
|
||||||
packet_number = 200;
|
packet_number = 200;
|
||||||
tox_callback_friend_lossy_packet(tox3, &handle_custom_packet, &packet_number);
|
tox_callback_friend_lossy_packet(tox3, &handle_custom_packet, &packet_number);
|
||||||
memset(data_c, ((uint8_t)packet_number), sizeof(data_c));
|
memset(data_c, ((uint8_t)packet_number), sizeof(data_c));
|
||||||
ret = tox_send_lossy_packet(tox2, 0, data_c, sizeof(data_c), 0);
|
ret = tox_friend_send_lossy_packet(tox2, 0, data_c, sizeof(data_c), 0);
|
||||||
ck_assert_msg(ret == 0, "tox_send_lossy_packet bigger fail %i", ret);
|
ck_assert_msg(ret == 0, "tox_friend_send_lossy_packet bigger fail %i", ret);
|
||||||
ret = tox_send_lossy_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0);
|
ret = tox_friend_send_lossy_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0);
|
||||||
ck_assert_msg(ret == 1, "tox_send_lossy_packet fail %i", ret);
|
ck_assert_msg(ret == 1, "tox_friend_send_lossy_packet fail %i", ret);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
custom_packet = 0;
|
custom_packet = 0;
|
||||||
tox_iteration(tox1);
|
tox_iterate(tox1);
|
||||||
tox_iteration(tox2);
|
tox_iterate(tox2);
|
||||||
tox_iteration(tox3);
|
tox_iterate(tox3);
|
||||||
|
|
||||||
if (custom_packet == 1)
|
if (custom_packet == 1)
|
||||||
break;
|
break;
|
||||||
|
@ -515,9 +515,9 @@ START_TEST(test_few_clients)
|
||||||
file_accepted = file_size = file_recv = sendf_ok = size_recv = 0;
|
file_accepted = file_size = file_recv = sendf_ok = size_recv = 0;
|
||||||
long long unsigned int f_time = time(NULL);
|
long long unsigned int f_time = time(NULL);
|
||||||
tox_callback_file_receive_chunk(tox3, write_file, &to_compare);
|
tox_callback_file_receive_chunk(tox3, write_file, &to_compare);
|
||||||
tox_callback_file_control(tox2, file_print_control, &to_compare);
|
tox_callback_file_recv_control(tox2, file_print_control, &to_compare);
|
||||||
tox_callback_file_request_chunk(tox2, tox_file_request_chunk, &to_compare);
|
tox_callback_file_request_chunk(tox2, tox_file_request_chunk, &to_compare);
|
||||||
tox_callback_file_control(tox3, file_print_control, &to_compare);
|
tox_callback_file_recv_control(tox3, file_print_control, &to_compare);
|
||||||
tox_callback_file_receive(tox3, tox_file_receive, &to_compare);
|
tox_callback_file_receive(tox3, tox_file_receive, &to_compare);
|
||||||
uint64_t totalf_size = 100 * 1024 * 1024;
|
uint64_t totalf_size = 100 * 1024 * 1024;
|
||||||
uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, (uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"),
|
uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, (uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"),
|
||||||
|
@ -526,9 +526,9 @@ START_TEST(test_few_clients)
|
||||||
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
tox_iteration(tox1);
|
tox_iterate(tox1);
|
||||||
tox_iteration(tox2);
|
tox_iterate(tox2);
|
||||||
tox_iteration(tox3);
|
tox_iterate(tox3);
|
||||||
|
|
||||||
if (file_sending_done) {
|
if (file_sending_done) {
|
||||||
if (sendf_ok && file_recv && totalf_size == file_size && size_recv == file_size && sending_pos == size_recv) {
|
if (sendf_ok && file_recv && totalf_size == file_size && size_recv == file_size && sending_pos == size_recv) {
|
||||||
|
@ -578,7 +578,7 @@ START_TEST(test_many_clients)
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
ck_assert_msg(tox_self_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ loop_top:
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUM_TOXES; ++i) {
|
for (i = 0; i < NUM_TOXES; ++i) {
|
||||||
tox_iteration(toxes[i]);
|
tox_iterate(toxes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
c_sleep(50);
|
c_sleep(50);
|
||||||
|
@ -706,7 +706,7 @@ START_TEST(test_many_group)
|
||||||
|
|
||||||
{
|
{
|
||||||
TOX_ERR_GET_PORT error;
|
TOX_ERR_GET_PORT error;
|
||||||
ck_assert_msg(tox_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
ck_assert_msg(tox_self_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
|
||||||
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,7 +730,7 @@ START_TEST(test_many_group)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (i = 0; i < NUM_GROUP_TOX; ++i) {
|
for (i = 0; i < NUM_GROUP_TOX; ++i) {
|
||||||
tox_iteration(toxes[i]);
|
tox_iterate(toxes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
c_sleep(50);
|
c_sleep(50);
|
||||||
|
@ -748,7 +748,7 @@ START_TEST(test_many_group)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
for (i = 0; i < NUM_GROUP_TOX; ++i) {
|
for (i = 0; i < NUM_GROUP_TOX; ++i) {
|
||||||
tox_iteration(toxes[i]);
|
tox_iterate(toxes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!invite_counter) {
|
if (!invite_counter) {
|
||||||
|
@ -786,7 +786,7 @@ START_TEST(test_many_group)
|
||||||
|
|
||||||
for (j = 0; j < 20; ++j) {
|
for (j = 0; j < 20; ++j) {
|
||||||
for (i = 0; i < NUM_GROUP_TOX; ++i) {
|
for (i = 0; i < NUM_GROUP_TOX; ++i) {
|
||||||
tox_iteration(toxes[i]);
|
tox_iterate(toxes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
c_sleep(50);
|
c_sleep(50);
|
||||||
|
@ -799,7 +799,7 @@ START_TEST(test_many_group)
|
||||||
|
|
||||||
for (j = 0; j < 10; ++j) {
|
for (j = 0; j < 10; ++j) {
|
||||||
for (i = 0; i < NUM_GROUP_TOX; ++i) {
|
for (i = 0; i < NUM_GROUP_TOX; ++i) {
|
||||||
tox_iteration(toxes[i]);
|
tox_iterate(toxes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
c_sleep(50);
|
c_sleep(50);
|
||||||
|
|
|
@ -232,7 +232,7 @@ void register_callbacks(ToxAv *av, void *data)
|
||||||
*/
|
*/
|
||||||
#define CALL_AND_START_LOOP(AliceCallType, BobCallType) \
|
#define CALL_AND_START_LOOP(AliceCallType, BobCallType) \
|
||||||
{ int step = 0, running = 1; while (running) {\
|
{ int step = 0, running = 1; while (running) {\
|
||||||
tox_iteration(bootstrap_node); tox_iteration(Alice); tox_iteration(Bob); \
|
tox_iterate(bootstrap_node); tox_iterate(Alice); tox_iterate(Bob); \
|
||||||
toxav_do(status_control.Bob.av); toxav_do(status_control.Alice.av); \
|
toxav_do(status_control.Bob.av); toxav_do(status_control.Alice.av); \
|
||||||
switch ( step ) {\
|
switch ( step ) {\
|
||||||
case 0: /* Alice */ printf("Alice is calling...\n");\
|
case 0: /* Alice */ printf("Alice is calling...\n");\
|
||||||
|
@ -267,9 +267,9 @@ START_TEST(test_AV_flows)
|
||||||
uint8_t off = 1;
|
uint8_t off = 1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
tox_iteration(bootstrap_node);
|
tox_iterate(bootstrap_node);
|
||||||
tox_iteration(Alice);
|
tox_iterate(Alice);
|
||||||
tox_iteration(Bob);
|
tox_iterate(Bob);
|
||||||
|
|
||||||
if (tox_get_connection_status(bootstrap_node) && tox_get_connection_status(Alice) && tox_get_connection_status(Bob)
|
if (tox_get_connection_status(bootstrap_node) && tox_get_connection_status(Alice) && tox_get_connection_status(Bob)
|
||||||
&& off) {
|
&& off) {
|
||||||
|
@ -484,9 +484,9 @@ START_TEST(test_AV_flows)
|
||||||
int running = 1;
|
int running = 1;
|
||||||
|
|
||||||
while (running) {
|
while (running) {
|
||||||
tox_iteration(bootstrap_node);
|
tox_iterate(bootstrap_node);
|
||||||
tox_iteration(Alice);
|
tox_iterate(Alice);
|
||||||
tox_iteration(Bob);
|
tox_iterate(Bob);
|
||||||
|
|
||||||
switch ( step ) {
|
switch ( step ) {
|
||||||
case 0: /* Alice */
|
case 0: /* Alice */
|
||||||
|
@ -525,9 +525,9 @@ START_TEST(test_AV_flows)
|
||||||
int running = 1;
|
int running = 1;
|
||||||
|
|
||||||
while (running) {
|
while (running) {
|
||||||
tox_iteration(bootstrap_node);
|
tox_iterate(bootstrap_node);
|
||||||
tox_iteration(Alice);
|
tox_iterate(Alice);
|
||||||
tox_iteration(Bob);
|
tox_iterate(Bob);
|
||||||
|
|
||||||
toxav_do(status_control.Alice.av);
|
toxav_do(status_control.Alice.av);
|
||||||
toxav_do(status_control.Bob.av);
|
toxav_do(status_control.Bob.av);
|
||||||
|
@ -570,9 +570,9 @@ START_TEST(test_AV_flows)
|
||||||
int running = 1;
|
int running = 1;
|
||||||
|
|
||||||
while (running) {
|
while (running) {
|
||||||
tox_iteration(bootstrap_node);
|
tox_iterate(bootstrap_node);
|
||||||
tox_iteration(Alice);
|
tox_iterate(Alice);
|
||||||
tox_iteration(Bob);
|
tox_iterate(Bob);
|
||||||
|
|
||||||
toxav_do(status_control.Alice.av);
|
toxav_do(status_control.Alice.av);
|
||||||
toxav_do(status_control.Bob.av);
|
toxav_do(status_control.Bob.av);
|
||||||
|
|
|
@ -294,11 +294,11 @@ START_TEST(test_AV_three_calls)
|
||||||
uint8_t off = 1;
|
uint8_t off = 1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
tox_iteration(bootstrap_node);
|
tox_iterate(bootstrap_node);
|
||||||
tox_iteration(caller);
|
tox_iterate(caller);
|
||||||
|
|
||||||
for (i = 0; i < 3; i ++) {
|
for (i = 0; i < 3; i ++) {
|
||||||
tox_iteration(callees[i]);
|
tox_iterate(callees[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -351,11 +351,11 @@ START_TEST(test_AV_three_calls)
|
||||||
while (call_running[0] || call_running[1] || call_running[2]) {
|
while (call_running[0] || call_running[1] || call_running[2]) {
|
||||||
pthread_mutex_lock(&muhmutex);
|
pthread_mutex_lock(&muhmutex);
|
||||||
|
|
||||||
tox_iteration(bootstrap_node);
|
tox_iterate(bootstrap_node);
|
||||||
tox_iteration(caller);
|
tox_iterate(caller);
|
||||||
tox_iteration(callees[0]);
|
tox_iterate(callees[0]);
|
||||||
tox_iteration(callees[1]);
|
tox_iterate(callees[1]);
|
||||||
tox_iteration(callees[2]);
|
tox_iterate(callees[2]);
|
||||||
|
|
||||||
for ( i = 0; i < 3; i++ )
|
for ( i = 0; i < 3; i++ )
|
||||||
toxav_do(status_control.calls[0].Caller.av);
|
toxav_do(status_control.calls[0].Caller.av);
|
||||||
|
|
|
@ -342,7 +342,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tox_iteration(tox);
|
tox_iterate(tox);
|
||||||
usleep(1000 * 50);
|
usleep(1000 * 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -389,13 +389,13 @@ void line_eval(Tox *m, char *line)
|
||||||
|
|
||||||
new_lines(numstring);
|
new_lines(numstring);
|
||||||
} else if (inpt_command == 'd') {
|
} else if (inpt_command == 'd') {
|
||||||
tox_iteration(m);
|
tox_iterate(m);
|
||||||
} else if (inpt_command == 'm') { //message command: /m friendnumber messsage
|
} else if (inpt_command == 'm') { //message command: /m friendnumber messsage
|
||||||
char *posi[1];
|
char *posi[1];
|
||||||
int num = strtoul(line + prompt_offset, posi, 0);
|
int num = strtoul(line + prompt_offset, posi, 0);
|
||||||
|
|
||||||
if (**posi != 0) {
|
if (**posi != 0) {
|
||||||
if (tox_send_message(m, num, (uint8_t *) *posi + 1, strlen(*posi + 1), NULL) < 1) {
|
if (tox_friend_send_message(m, num, (uint8_t *) *posi + 1, strlen(*posi + 1), NULL) < 1) {
|
||||||
char sss[256];
|
char sss[256];
|
||||||
sprintf(sss, "[i] could not send message to friend num %u", num);
|
sprintf(sss, "[i] could not send message to friend num %u", num);
|
||||||
new_lines(sss);
|
new_lines(sss);
|
||||||
|
@ -607,7 +607,7 @@ void line_eval(Tox *m, char *line)
|
||||||
if (conversation_default != 0) {
|
if (conversation_default != 0) {
|
||||||
if (conversation_default > 0) {
|
if (conversation_default > 0) {
|
||||||
int friendnumber = conversation_default - 1;
|
int friendnumber = conversation_default - 1;
|
||||||
uint32_t res = tox_send_message(m, friendnumber, (uint8_t *)line, strlen(line), NULL);
|
uint32_t res = tox_friend_send_message(m, friendnumber, (uint8_t *)line, strlen(line), NULL);
|
||||||
|
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
char sss[128];
|
char sss[128];
|
||||||
|
@ -1132,7 +1132,7 @@ void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number,
|
||||||
{
|
{
|
||||||
if (type != TOX_FILE_KIND_DATA) {
|
if (type != TOX_FILE_KIND_DATA) {
|
||||||
new_lines("Refused invalid file type.");
|
new_lines("Refused invalid file type.");
|
||||||
tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
|
tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1140,7 +1140,7 @@ void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number,
|
||||||
sprintf(msg, "[t] %u is sending us: %s of size %llu", friend_number, filename, (long long unsigned int)file_size);
|
sprintf(msg, "[t] %u is sending us: %s of size %llu", friend_number, filename, (long long unsigned int)file_size);
|
||||||
new_lines(msg);
|
new_lines(msg);
|
||||||
|
|
||||||
if (tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, 0)) {
|
if (tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, 0)) {
|
||||||
sprintf(msg, "Accepted file transfer. (saving file as: %u.%u.bin)", friend_number, file_number);
|
sprintf(msg, "Accepted file transfer. (saving file as: %u.%u.bin)", friend_number, file_number);
|
||||||
new_lines(msg);
|
new_lines(msg);
|
||||||
} else
|
} else
|
||||||
|
@ -1270,7 +1270,7 @@ int main(int argc, char *argv[])
|
||||||
tox_callback_group_invite(m, print_invite, NULL);
|
tox_callback_group_invite(m, print_invite, NULL);
|
||||||
tox_callback_group_message(m, print_groupmessage, NULL);
|
tox_callback_group_message(m, print_groupmessage, NULL);
|
||||||
tox_callback_file_receive_chunk(m, write_file, NULL);
|
tox_callback_file_receive_chunk(m, write_file, NULL);
|
||||||
tox_callback_file_control(m, file_print_control, NULL);
|
tox_callback_file_recv_control(m, file_print_control, NULL);
|
||||||
tox_callback_file_receive(m, file_request_accept, NULL);
|
tox_callback_file_receive(m, file_request_accept, NULL);
|
||||||
tox_callback_file_request_chunk(m, tox_file_request_chunk, NULL);
|
tox_callback_file_request_chunk(m, tox_file_request_chunk, NULL);
|
||||||
tox_callback_group_namelist_change(m, print_groupnamelistchange, NULL);
|
tox_callback_group_namelist_change(m, print_groupnamelistchange, NULL);
|
||||||
|
@ -1326,7 +1326,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tox_iteration(m);
|
tox_iterate(m);
|
||||||
do_refresh();
|
do_refresh();
|
||||||
|
|
||||||
int c = timeout_getch(m);
|
int c = timeout_getch(m);
|
||||||
|
|
|
@ -148,10 +148,10 @@ int main(int argc, char *argv[])
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
tox_send_message(tox, num, buf, ret, 0);
|
tox_friend_send_message(tox, num, buf, ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
tox_iteration(tox);
|
tox_iterate(tox);
|
||||||
c_sleep(1);
|
c_sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number,
|
||||||
{
|
{
|
||||||
if (type != TOX_FILE_KIND_DATA) {
|
if (type != TOX_FILE_KIND_DATA) {
|
||||||
printf("Refused invalid file type.");
|
printf("Refused invalid file type.");
|
||||||
tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
|
tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number,
|
||||||
|
|
||||||
if (tempfile != 0) {
|
if (tempfile != 0) {
|
||||||
fclose(tempfile);
|
fclose(tempfile);
|
||||||
tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
|
tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,11 +159,11 @@ void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number,
|
||||||
file_recv[file_index].file = fopen(fullpath, "wb");
|
file_recv[file_index].file = fopen(fullpath, "wb");
|
||||||
|
|
||||||
if (file_recv[file_index].file == 0) {
|
if (file_recv[file_index].file == 0) {
|
||||||
tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
|
tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, 0)) {
|
if (tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, 0)) {
|
||||||
printf("Accepted file transfer. (file: %s)\n", fullpath);
|
printf("Accepted file transfer. (file: %s)\n", fullpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
Tox *tox = tox_new(0, 0, 0, 0);
|
Tox *tox = tox_new(0, 0, 0, 0);
|
||||||
tox_callback_file_receive_chunk(tox, write_file, NULL);
|
tox_callback_file_receive_chunk(tox, write_file, NULL);
|
||||||
tox_callback_file_control(tox, file_print_control, NULL);
|
tox_callback_file_recv_control(tox, file_print_control, NULL);
|
||||||
tox_callback_file_receive(tox, file_request_accept, NULL);
|
tox_callback_file_receive(tox, file_request_accept, NULL);
|
||||||
tox_callback_file_request_chunk(tox, tox_file_request_chunk, NULL);
|
tox_callback_file_request_chunk(tox, tox_file_request_chunk, NULL);
|
||||||
tox_callback_friend_connection_status(tox, print_online, NULL);
|
tox_callback_friend_connection_status(tox, print_online, NULL);
|
||||||
|
@ -306,7 +306,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tox_iteration(tox);
|
tox_iterate(tox);
|
||||||
c_sleep(1);
|
c_sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,7 +314,7 @@ uint32_t tox_iteration_interval(const Tox *tox)
|
||||||
return messenger_run_interval(m);
|
return messenger_run_interval(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tox_iteration(Tox *tox)
|
void tox_iterate(Tox *tox)
|
||||||
{
|
{
|
||||||
Messenger *m = tox;
|
Messenger *m = tox;
|
||||||
do_messenger(m);
|
do_messenger(m);
|
||||||
|
@ -423,13 +423,13 @@ void tox_self_get_status_message(const Tox *tox, uint8_t *status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tox_self_set_status(Tox *tox, TOX_STATUS user_status)
|
void tox_self_set_status(Tox *tox, TOX_USER_STATUS user_status)
|
||||||
{
|
{
|
||||||
Messenger *m = tox;
|
Messenger *m = tox;
|
||||||
m_set_userstatus(m, user_status);
|
m_set_userstatus(m, user_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_STATUS tox_self_get_status(const Tox *tox)
|
TOX_USER_STATUS tox_self_get_status(const Tox *tox)
|
||||||
{
|
{
|
||||||
const Messenger *m = tox;
|
const Messenger *m = tox;
|
||||||
return m_get_self_userstatus(m);
|
return m_get_self_userstatus(m);
|
||||||
|
@ -572,7 +572,7 @@ size_t tox_friend_list_size(const Tox *tox)
|
||||||
return count_friendlist(m);
|
return count_friendlist(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tox_friend_list(const Tox *tox, uint32_t *list)
|
void tox_friend_get_list(const Tox *tox, uint32_t *list)
|
||||||
{
|
{
|
||||||
if (list) {
|
if (list) {
|
||||||
const Messenger *m = tox;
|
const Messenger *m = tox;
|
||||||
|
@ -661,7 +661,7 @@ void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *
|
||||||
m_callback_statusmessage(m, function, user_data);
|
m_callback_statusmessage(m, function, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
TOX_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error)
|
TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error)
|
||||||
{
|
{
|
||||||
const Messenger *m = tox;
|
const Messenger *m = tox;
|
||||||
|
|
||||||
|
@ -669,7 +669,7 @@ TOX_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR
|
||||||
|
|
||||||
if (ret == USERSTATUS_INVALID) {
|
if (ret == USERSTATUS_INVALID) {
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_FRIEND_NOT_FOUND);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_FRIEND_NOT_FOUND);
|
||||||
return TOX_STATUS_INVALID;
|
return TOX_USER_STATUS_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_OK);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_OK);
|
||||||
|
@ -736,41 +736,41 @@ bool tox_self_set_typing(Tox *tox, uint32_t friend_number, bool is_typing, TOX_E
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_message_error(int ret, TOX_ERR_SEND_MESSAGE *error)
|
static void set_message_error(int ret, TOX_ERR_FRIEND_SEND_MESSAGE *error)
|
||||||
{
|
{
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case 0:
|
case 0:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_MESSAGE_OK);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_SEND_MESSAGE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_MESSAGE_FRIEND_NOT_FOUND);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_FOUND);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -2:
|
case -2:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_MESSAGE_TOO_LONG);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_SEND_MESSAGE_TOO_LONG);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -3:
|
case -3:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_MESSAGE_FRIEND_NOT_CONNECTED);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_CONNECTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -4:
|
case -4:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_MESSAGE_SENDQ);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_SEND_MESSAGE_SENDQ);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t tox_send_message(Tox *tox, uint32_t friend_number, const uint8_t *message, size_t length,
|
uint32_t tox_friend_send_message(Tox *tox, uint32_t friend_number, const uint8_t *message, size_t length,
|
||||||
TOX_ERR_SEND_MESSAGE *error)
|
TOX_ERR_FRIEND_SEND_MESSAGE *error)
|
||||||
{
|
{
|
||||||
if (!message) {
|
if (!message) {
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_MESSAGE_NULL);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_SEND_MESSAGE_NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!length) {
|
if (!length) {
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_MESSAGE_EMPTY);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_SEND_MESSAGE_EMPTY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,16 +780,16 @@ uint32_t tox_send_message(Tox *tox, uint32_t friend_number, const uint8_t *messa
|
||||||
return message_id;
|
return message_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t tox_send_action(Tox *tox, uint32_t friend_number, const uint8_t *action, size_t length,
|
uint32_t tox_friend_send_action(Tox *tox, uint32_t friend_number, const uint8_t *action, size_t length,
|
||||||
TOX_ERR_SEND_MESSAGE *error)
|
TOX_ERR_FRIEND_SEND_MESSAGE *error)
|
||||||
{
|
{
|
||||||
if (!action) {
|
if (!action) {
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_MESSAGE_NULL);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_SEND_MESSAGE_NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!length) {
|
if (!length) {
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_MESSAGE_EMPTY);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_SEND_MESSAGE_EMPTY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -799,7 +799,7 @@ uint32_t tox_send_action(Tox *tox, uint32_t friend_number, const uint8_t *action
|
||||||
return message_id;
|
return message_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tox_callback_read_receipt(Tox *tox, tox_read_receipt_cb *function, void *user_data)
|
void tox_callback_friend_read_receipt(Tox *tox, tox_friend_read_receipt_cb *function, void *user_data)
|
||||||
{
|
{
|
||||||
Messenger *m = tox;
|
Messenger *m = tox;
|
||||||
m_callback_read_receipt(m, function, user_data);
|
m_callback_read_receipt(m, function, user_data);
|
||||||
|
@ -833,8 +833,8 @@ bool tox_hash(uint8_t *hash, const uint8_t *data, size_t length)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tox_file_control(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_CONTROL control,
|
bool tox_file_send_control(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_CONTROL control,
|
||||||
TOX_ERR_FILE_CONTROL *error)
|
TOX_ERR_FILE_CONTROL *error)
|
||||||
{
|
{
|
||||||
Messenger *m = tox;
|
Messenger *m = tox;
|
||||||
int ret = file_control(m, friend_number, file_number, control);
|
int ret = file_control(m, friend_number, file_number, control);
|
||||||
|
@ -882,7 +882,7 @@ bool tox_file_control(Tox *tox, uint32_t friend_number, uint32_t file_number, TO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tox_callback_file_control(Tox *tox, tox_file_control_cb *function, void *user_data)
|
void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function, void *user_data)
|
||||||
{
|
{
|
||||||
Messenger *m = tox;
|
Messenger *m = tox;
|
||||||
callback_file_control(m, function, user_data);
|
callback_file_control(m, function, user_data);
|
||||||
|
@ -994,52 +994,52 @@ void tox_callback_file_receive_chunk(Tox *tox, tox_file_receive_chunk_cb *functi
|
||||||
callback_file_data(m, function, user_data);
|
callback_file_data(m, function, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_custom_packet_error(int ret, TOX_ERR_SEND_CUSTOM_PACKET *error)
|
static void set_custom_packet_error(int ret, TOX_ERR_FRIEND_CUSTOM_PACKET *error)
|
||||||
{
|
{
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case 0:
|
case 0:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_OK);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -1:
|
case -1:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_FRIEND_NOT_FOUND);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_FRIEND_NOT_FOUND);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -2:
|
case -2:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_TOO_LONG);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_TOO_LONG);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -3:
|
case -3:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_INVALID);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_INVALID);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -4:
|
case -4:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_FRIEND_NOT_CONNECTED);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_FRIEND_NOT_CONNECTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -5:
|
case -5:
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_SENDQ);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_SENDQ);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tox_send_lossy_packet(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length,
|
bool tox_friend_send_lossy_packet(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length,
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET *error)
|
TOX_ERR_FRIEND_CUSTOM_PACKET *error)
|
||||||
{
|
{
|
||||||
if (!data) {
|
if (!data) {
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_NULL);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Messenger *m = tox;
|
Messenger *m = tox;
|
||||||
|
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_EMPTY);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_EMPTY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data[0] < (PACKET_ID_LOSSY_RANGE_START + PACKET_LOSSY_AV_RESERVED)) {
|
if (data[0] < (PACKET_ID_LOSSY_RANGE_START + PACKET_LOSSY_AV_RESERVED)) {
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_INVALID);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_INVALID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1060,18 +1060,18 @@ void tox_callback_friend_lossy_packet(Tox *tox, tox_friend_lossy_packet_cb *func
|
||||||
custom_lossy_packet_registerhandler(m, function, user_data);
|
custom_lossy_packet_registerhandler(m, function, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tox_send_lossless_packet(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length,
|
bool tox_friend_send_lossless_packet(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length,
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET *error)
|
TOX_ERR_FRIEND_CUSTOM_PACKET *error)
|
||||||
{
|
{
|
||||||
if (!data) {
|
if (!data) {
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_NULL);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Messenger *m = tox;
|
Messenger *m = tox;
|
||||||
|
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_SEND_CUSTOM_PACKET_EMPTY);
|
SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_CUSTOM_PACKET_EMPTY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1092,7 +1092,7 @@ void tox_callback_friend_lossless_packet(Tox *tox, tox_friend_lossless_packet_cb
|
||||||
custom_lossless_packet_registerhandler(m, function, user_data);
|
custom_lossless_packet_registerhandler(m, function, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tox_get_dht_id(const Tox *tox, uint8_t *dht_id)
|
void tox_self_get_dht_id(const Tox *tox, uint8_t *dht_id)
|
||||||
{
|
{
|
||||||
if (dht_id) {
|
if (dht_id) {
|
||||||
const Messenger *m = tox;
|
const Messenger *m = tox;
|
||||||
|
@ -1100,7 +1100,7 @@ void tox_get_dht_id(const Tox *tox, uint8_t *dht_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t tox_get_udp_port(const Tox *tox, TOX_ERR_GET_PORT *error)
|
uint16_t tox_self_get_udp_port(const Tox *tox, TOX_ERR_GET_PORT *error)
|
||||||
{
|
{
|
||||||
const Messenger *m = tox;
|
const Messenger *m = tox;
|
||||||
uint16_t port = htons(m->net->port);
|
uint16_t port = htons(m->net->port);
|
||||||
|
@ -1114,7 +1114,7 @@ uint16_t tox_get_udp_port(const Tox *tox, TOX_ERR_GET_PORT *error)
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t tox_get_tcp_port(const Tox *tox, TOX_ERR_GET_PORT *error)
|
uint16_t tox_self_get_tcp_port(const Tox *tox, TOX_ERR_GET_PORT *error)
|
||||||
{
|
{
|
||||||
/* TCP server not yet implemented in clients. */
|
/* TCP server not yet implemented in clients. */
|
||||||
SET_ERROR_PARAMETER(error, TOX_ERR_GET_PORT_NOT_BOUND);
|
SET_ERROR_PARAMETER(error, TOX_ERR_GET_PORT_NOT_BOUND);
|
||||||
|
|
106
toxcore/tox.h
106
toxcore/tox.h
|
@ -260,26 +260,26 @@ bool tox_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch);
|
||||||
/**
|
/**
|
||||||
* Represents the possible statuses a client can have.
|
* Represents the possible statuses a client can have.
|
||||||
*/
|
*/
|
||||||
typedef enum TOX_STATUS {
|
typedef enum TOX_USER_STATUS {
|
||||||
/**
|
/**
|
||||||
* User is online and available.
|
* User is online and available.
|
||||||
*/
|
*/
|
||||||
TOX_STATUS_NONE,
|
TOX_USER_STATUS_NONE,
|
||||||
/**
|
/**
|
||||||
* User is away. Clients can set this e.g. after a user defined
|
* User is away. Clients can set this e.g. after a user defined
|
||||||
* inactivity time.
|
* inactivity time.
|
||||||
*/
|
*/
|
||||||
TOX_STATUS_AWAY,
|
TOX_USER_STATUS_AWAY,
|
||||||
/**
|
/**
|
||||||
* User is busy. Signals to other clients that this client does not
|
* User is busy. Signals to other clients that this client does not
|
||||||
* currently wish to communicate.
|
* currently wish to communicate.
|
||||||
*/
|
*/
|
||||||
TOX_STATUS_BUSY,
|
TOX_USER_STATUS_BUSY,
|
||||||
/**
|
/**
|
||||||
* Invalid status used when function returns an error.
|
* Invalid status used when function returns an error.
|
||||||
*/
|
*/
|
||||||
TOX_STATUS_INVALID
|
TOX_USER_STATUS_INVALID
|
||||||
} TOX_STATUS;
|
} TOX_USER_STATUS;
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -652,7 +652,7 @@ uint32_t tox_iteration_interval(const Tox *tox);
|
||||||
* The main loop that needs to be run in intervals of tox_iteration_interval()
|
* The main loop that needs to be run in intervals of tox_iteration_interval()
|
||||||
* milliseconds.
|
* milliseconds.
|
||||||
*/
|
*/
|
||||||
void tox_iteration(Tox *tox);
|
void tox_iterate(Tox *tox);
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -695,12 +695,12 @@ uint32_t tox_self_get_nospam(const Tox *tox);
|
||||||
void tox_self_get_public_key(const Tox *tox, uint8_t *public_key);
|
void tox_self_get_public_key(const Tox *tox, uint8_t *public_key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the private key from the Tox object.
|
* Copy the secret key from the Tox object.
|
||||||
*
|
*
|
||||||
* @param private_key A memory region of at least TOX_PUBLIC_KEY_SIZE bytes. If
|
* @param secret_key A memory region of at least TOX_PUBLIC_KEY_SIZE bytes. If
|
||||||
* this parameter is NULL, this function has no effect.
|
* this parameter is NULL, this function has no effect.
|
||||||
*/
|
*/
|
||||||
void tox_self_get_private_key(const Tox *tox, uint8_t *private_key);
|
void tox_self_get_secret_key(const Tox *tox, uint8_t *secret_key);
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -801,12 +801,12 @@ void tox_self_get_status_message(const Tox *tox, uint8_t *status);
|
||||||
*
|
*
|
||||||
* @param user_status One of the user statuses listed in the enumeration above.
|
* @param user_status One of the user statuses listed in the enumeration above.
|
||||||
*/
|
*/
|
||||||
void tox_self_set_status(Tox *tox, TOX_STATUS user_status);
|
void tox_self_set_status(Tox *tox, TOX_USER_STATUS user_status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the client's user status.
|
* Returns the client's user status.
|
||||||
*/
|
*/
|
||||||
TOX_STATUS tox_self_get_status(const Tox *tox);
|
TOX_USER_STATUS tox_self_get_status(const Tox *tox);
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -991,7 +991,7 @@ size_t tox_friend_list_size(const Tox *tox);
|
||||||
* @param list A memory region with enough space to hold the friend list. If
|
* @param list A memory region with enough space to hold the friend list. If
|
||||||
* this parameter is NULL, this function has no effect.
|
* this parameter is NULL, this function has no effect.
|
||||||
*/
|
*/
|
||||||
void tox_friend_list(const Tox *tox, uint32_t *list);
|
void tox_friend_get_list(const Tox *tox, uint32_t *list);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1113,7 +1113,7 @@ void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *
|
||||||
* The status returned is equal to the last status received through the
|
* The status returned is equal to the last status received through the
|
||||||
* `friend_status` callback.
|
* `friend_status` callback.
|
||||||
*/
|
*/
|
||||||
TOX_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error);
|
TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function type for the `friend_status` callback.
|
* The function type for the `friend_status` callback.
|
||||||
|
@ -1122,7 +1122,7 @@ TOX_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR
|
||||||
* changed.
|
* changed.
|
||||||
* @param status The new user status.
|
* @param status The new user status.
|
||||||
*/
|
*/
|
||||||
typedef void tox_friend_status_cb(Tox *tox, uint32_t friend_number, TOX_STATUS status, void *user_data);
|
typedef void tox_friend_status_cb(Tox *tox, uint32_t friend_number, TOX_USER_STATUS status, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the callback for the `friend_status` event. Pass NULL to unset.
|
* Set the callback for the `friend_status` event. Pass NULL to unset.
|
||||||
|
@ -1227,30 +1227,30 @@ typedef enum TOX_ERR_SET_TYPING {
|
||||||
bool tox_self_set_typing(Tox *tox, uint32_t friend_number, bool is_typing, TOX_ERR_SET_TYPING *error);
|
bool tox_self_set_typing(Tox *tox, uint32_t friend_number, bool is_typing, TOX_ERR_SET_TYPING *error);
|
||||||
|
|
||||||
|
|
||||||
typedef enum TOX_ERR_SEND_MESSAGE {
|
typedef enum TOX_ERR_FRIEND_SEND_MESSAGE {
|
||||||
TOX_ERR_SEND_MESSAGE_OK,
|
TOX_ERR_FRIEND_SEND_MESSAGE_OK,
|
||||||
TOX_ERR_SEND_MESSAGE_NULL,
|
TOX_ERR_FRIEND_SEND_MESSAGE_NULL,
|
||||||
/**
|
/**
|
||||||
* The friend number did not designate a valid friend.
|
* The friend number did not designate a valid friend.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_MESSAGE_FRIEND_NOT_FOUND,
|
TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_FOUND,
|
||||||
/**
|
/**
|
||||||
* This client is currently not connected to the friend.
|
* This client is currently not connected to the friend.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_MESSAGE_FRIEND_NOT_CONNECTED,
|
TOX_ERR_FRIEND_SEND_MESSAGE_FRIEND_NOT_CONNECTED,
|
||||||
/**
|
/**
|
||||||
* An allocation error occurred while increasing the send queue size.
|
* An allocation error occurred while increasing the send queue size.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_MESSAGE_SENDQ,
|
TOX_ERR_FRIEND_SEND_MESSAGE_SENDQ,
|
||||||
/**
|
/**
|
||||||
* Message length exceeded TOX_MAX_MESSAGE_LENGTH.
|
* Message length exceeded TOX_MAX_MESSAGE_LENGTH.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_MESSAGE_TOO_LONG,
|
TOX_ERR_FRIEND_SEND_MESSAGE_TOO_LONG,
|
||||||
/**
|
/**
|
||||||
* Attempted to send a zero-length message.
|
* Attempted to send a zero-length message.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_MESSAGE_EMPTY
|
TOX_ERR_FRIEND_SEND_MESSAGE_EMPTY
|
||||||
} TOX_ERR_SEND_MESSAGE;
|
} TOX_ERR_FRIEND_SEND_MESSAGE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a text chat message to an online friend.
|
* Send a text chat message to an online friend.
|
||||||
|
@ -1269,8 +1269,8 @@ typedef enum TOX_ERR_SEND_MESSAGE {
|
||||||
* incremented by 1 each time a message is sent. If UINT32_MAX messages were
|
* incremented by 1 each time a message is sent. If UINT32_MAX messages were
|
||||||
* sent, the next message ID is 0.
|
* sent, the next message ID is 0.
|
||||||
*/
|
*/
|
||||||
uint32_t tox_send_message(Tox *tox, uint32_t friend_number, const uint8_t *message, size_t length,
|
uint32_t tox_friend_send_message(Tox *tox, uint32_t friend_number, const uint8_t *message, size_t length,
|
||||||
TOX_ERR_SEND_MESSAGE *error);
|
TOX_ERR_FRIEND_SEND_MESSAGE *error);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1282,10 +1282,10 @@ uint32_t tox_send_message(Tox *tox, uint32_t friend_number, const uint8_t *messa
|
||||||
* means that sending a message will cause the next message ID from sending an
|
* means that sending a message will cause the next message ID from sending an
|
||||||
* action will be incremented.
|
* action will be incremented.
|
||||||
*
|
*
|
||||||
* @see tox_send_message for more details.
|
* @see tox_friend_send_message for more details.
|
||||||
*/
|
*/
|
||||||
uint32_t tox_send_action(Tox *tox, uint32_t friend_number, const uint8_t *action, size_t length,
|
uint32_t tox_friend_send_action(Tox *tox, uint32_t friend_number, const uint8_t *action, size_t length,
|
||||||
TOX_ERR_SEND_MESSAGE *error);
|
TOX_ERR_FRIEND_SEND_MESSAGE *error);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1295,7 +1295,7 @@ uint32_t tox_send_action(Tox *tox, uint32_t friend_number, const uint8_t *action
|
||||||
* @param message_id The message ID as returned from tox_send_message or
|
* @param message_id The message ID as returned from tox_send_message or
|
||||||
* tox_send_action corresponding to the message sent.
|
* tox_send_action corresponding to the message sent.
|
||||||
*/
|
*/
|
||||||
typedef void tox_read_receipt_cb(Tox *tox, uint32_t friend_number, uint32_t message_id, void *user_data);
|
typedef void tox_friend_read_receipt_cb(Tox *tox, uint32_t friend_number, uint32_t message_id, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the callback for the `read_receipt` event. Pass NULL to unset.
|
* Set the callback for the `read_receipt` event. Pass NULL to unset.
|
||||||
|
@ -1306,7 +1306,7 @@ typedef void tox_read_receipt_cb(Tox *tox, uint32_t friend_number, uint32_t mess
|
||||||
* received here may not correspond to any message sent through tox_send_message
|
* received here may not correspond to any message sent through tox_send_message
|
||||||
* or tox_send_action. In that case, the receipt should be discarded.
|
* or tox_send_action. In that case, the receipt should be discarded.
|
||||||
*/
|
*/
|
||||||
void tox_callback_read_receipt(Tox *tox, tox_read_receipt_cb *function, void *user_data);
|
void tox_callback_friend_read_receipt(Tox *tox, tox_friend_read_receipt_cb *function, void *user_data);
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -1501,8 +1501,8 @@ typedef enum TOX_ERR_FILE_CONTROL {
|
||||||
*
|
*
|
||||||
* @return true on success.
|
* @return true on success.
|
||||||
*/
|
*/
|
||||||
bool tox_file_control(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_CONTROL control,
|
bool tox_file_send_control(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_CONTROL control,
|
||||||
TOX_ERR_FILE_CONTROL *error);
|
TOX_ERR_FILE_CONTROL *error);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1516,8 +1516,8 @@ bool tox_file_control(Tox *tox, uint32_t friend_number, uint32_t file_number, TO
|
||||||
* associated with.
|
* associated with.
|
||||||
* @param control The file control command received.
|
* @param control The file control command received.
|
||||||
*/
|
*/
|
||||||
typedef void tox_file_control_cb(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_CONTROL control,
|
typedef void tox_file_recv_control_cb(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_CONTROL control,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the callback for the `file_control` event. Pass NULL to unset.
|
* Set the callback for the `file_control` event. Pass NULL to unset.
|
||||||
|
@ -1525,7 +1525,7 @@ typedef void tox_file_control_cb(Tox *tox, uint32_t friend_number, uint32_t file
|
||||||
* This event is triggered when a file control command is received from a
|
* This event is triggered when a file control command is received from a
|
||||||
* friend.
|
* friend.
|
||||||
*/
|
*/
|
||||||
void tox_callback_file_control(Tox *tox, tox_file_control_cb *function, void *user_data);
|
void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function, void *user_data);
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -1794,35 +1794,35 @@ void tox_callback_file_receive_chunk(Tox *tox, tox_file_receive_chunk_cb *functi
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
typedef enum TOX_ERR_SEND_CUSTOM_PACKET {
|
typedef enum TOX_ERR_FRIEND_CUSTOM_PACKET {
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET_OK,
|
TOX_ERR_FRIEND_CUSTOM_PACKET_OK,
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET_NULL,
|
TOX_ERR_FRIEND_CUSTOM_PACKET_NULL,
|
||||||
/**
|
/**
|
||||||
* The friend number did not designate a valid friend.
|
* The friend number did not designate a valid friend.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET_FRIEND_NOT_FOUND,
|
TOX_ERR_FRIEND_CUSTOM_PACKET_FRIEND_NOT_FOUND,
|
||||||
/**
|
/**
|
||||||
* This client is currently not connected to the friend.
|
* This client is currently not connected to the friend.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET_FRIEND_NOT_CONNECTED,
|
TOX_ERR_FRIEND_CUSTOM_PACKET_FRIEND_NOT_CONNECTED,
|
||||||
/**
|
/**
|
||||||
* The first byte of data was not in the specified range for the packet type.
|
* The first byte of data was not in the specified range for the packet type.
|
||||||
* This range is 200-254 for lossy, and 160-191 for lossless packets.
|
* This range is 200-254 for lossy, and 160-191 for lossless packets.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET_INVALID,
|
TOX_ERR_FRIEND_CUSTOM_PACKET_INVALID,
|
||||||
/**
|
/**
|
||||||
* Attempted to send an empty packet.
|
* Attempted to send an empty packet.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET_EMPTY,
|
TOX_ERR_FRIEND_CUSTOM_PACKET_EMPTY,
|
||||||
/**
|
/**
|
||||||
* Packet data length exceeded TOX_MAX_CUSTOM_PACKET_SIZE.
|
* Packet data length exceeded TOX_MAX_CUSTOM_PACKET_SIZE.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET_TOO_LONG,
|
TOX_ERR_FRIEND_CUSTOM_PACKET_TOO_LONG,
|
||||||
/**
|
/**
|
||||||
* Send queue size exceeded.
|
* Send queue size exceeded.
|
||||||
*/
|
*/
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET_SENDQ
|
TOX_ERR_FRIEND_CUSTOM_PACKET_SENDQ
|
||||||
} TOX_ERR_SEND_CUSTOM_PACKET;
|
} TOX_ERR_FRIEND_CUSTOM_PACKET;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1845,8 +1845,8 @@ typedef enum TOX_ERR_SEND_CUSTOM_PACKET {
|
||||||
*
|
*
|
||||||
* @return true on success.
|
* @return true on success.
|
||||||
*/
|
*/
|
||||||
bool tox_send_lossy_packet(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length,
|
bool tox_friend_send_lossy_packet(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length,
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET *error);
|
TOX_ERR_FRIEND_CUSTOM_PACKET *error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function type for the `friend_lossy_packet` callback.
|
* The function type for the `friend_lossy_packet` callback.
|
||||||
|
@ -1880,8 +1880,8 @@ void tox_callback_friend_lossy_packet(Tox *tox, tox_friend_lossy_packet_cb *func
|
||||||
*
|
*
|
||||||
* @return true on success.
|
* @return true on success.
|
||||||
*/
|
*/
|
||||||
bool tox_send_lossless_packet(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length,
|
bool tox_friend_send_lossless_packet(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length,
|
||||||
TOX_ERR_SEND_CUSTOM_PACKET *error);
|
TOX_ERR_FRIEND_CUSTOM_PACKET *error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function type for the `friend_lossless_packet` callback.
|
* The function type for the `friend_lossless_packet` callback.
|
||||||
|
@ -1919,7 +1919,7 @@ void tox_callback_friend_lossless_packet(Tox *tox, tox_friend_lossless_packet_cb
|
||||||
* @param dht_id A memory region of at least TOX_PUBLIC_KEY_SIZE bytes. If this
|
* @param dht_id A memory region of at least TOX_PUBLIC_KEY_SIZE bytes. If this
|
||||||
* parameter is NULL, this function has no effect.
|
* parameter is NULL, this function has no effect.
|
||||||
*/
|
*/
|
||||||
void tox_get_dht_id(const Tox *tox, uint8_t *dht_id);
|
void tox_self_get_dht_id(const Tox *tox, uint8_t *dht_id);
|
||||||
|
|
||||||
|
|
||||||
typedef enum TOX_ERR_GET_PORT {
|
typedef enum TOX_ERR_GET_PORT {
|
||||||
|
@ -1933,13 +1933,13 @@ typedef enum TOX_ERR_GET_PORT {
|
||||||
/**
|
/**
|
||||||
* Return the UDP port this Tox instance is bound to.
|
* Return the UDP port this Tox instance is bound to.
|
||||||
*/
|
*/
|
||||||
uint16_t tox_get_udp_port(const Tox *tox, TOX_ERR_GET_PORT *error);
|
uint16_t tox_self_get_udp_port(const Tox *tox, TOX_ERR_GET_PORT *error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the TCP port this Tox instance is bound to. This is only relevant if
|
* Return the TCP port this Tox instance is bound to. This is only relevant if
|
||||||
* the instance is acting as a TCP relay.
|
* the instance is acting as a TCP relay.
|
||||||
*/
|
*/
|
||||||
uint16_t tox_get_tcp_port(const Tox *tox, TOX_ERR_GET_PORT *error);
|
uint16_t tox_self_get_tcp_port(const Tox *tox, TOX_ERR_GET_PORT *error);
|
||||||
|
|
||||||
#include "tox_old.h"
|
#include "tox_old.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user