summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auto_tests/tox_test.c106
-rw-r--r--auto_tests/toxav_basic_test.c26
-rw-r--r--auto_tests/toxav_many_test.c16
-rw-r--r--testing/irc_syncbot.c2
-rw-r--r--testing/nTox.c20
-rw-r--r--testing/tox_shell.c4
-rw-r--r--testing/tox_sync.c18
-rw-r--r--toxcore/tox.c10
-rw-r--r--toxcore/tox.h2
9 files changed, 102 insertions, 102 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c
index 7cae9da6..8df6316f 100644
--- a/auto_tests/tox_test.c
+++ b/auto_tests/tox_test.c
@@ -93,13 +93,13 @@ void handle_custom_packet(Tox *m, uint32_t friend_num, const uint8_t *data, size
93uint8_t filenum; 93uint8_t filenum;
94uint32_t file_accepted; 94uint32_t file_accepted;
95uint64_t file_size; 95uint64_t file_size;
96void tox_file_receive(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_KIND kind, uint64_t filesize, 96void tox_file_receive(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_TYPE kind, uint64_t filesize,
97 const uint8_t *filename, size_t filename_length, void *userdata) 97 const uint8_t *filename, size_t filename_length, void *userdata)
98{ 98{
99 if (*((uint32_t *)userdata) != 974536) 99 if (*((uint32_t *)userdata) != 974536)
100 return; 100 return;
101 101
102 if (kind != TOX_FILE_KIND_DATA) { 102 if (kind != TOX_FILE_TYPE_DATA) {
103 ck_abort_msg("Bad kind"); 103 ck_abort_msg("Bad kind");
104 return; 104 return;
105 } 105 }
@@ -113,10 +113,10 @@ void tox_file_receive(Tox *tox, uint32_t friend_number, uint32_t file_number, TO
113 113
114 TOX_ERR_FILE_CONTROL error; 114 TOX_ERR_FILE_CONTROL error;
115 115
116 if (tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, &error)) { 116 if (tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, &error)) {
117 ++file_accepted; 117 ++file_accepted;
118 } else { 118 } else {
119 ck_abort_msg("tox_file_control failed. %i", error); 119 ck_abort_msg("tox_file_send_control failed. %i", error);
120 } 120 }
121} 121}
122 122
@@ -221,7 +221,7 @@ START_TEST(test_one)
221 221
222 { 222 {
223 TOX_ERR_GET_PORT error; 223 TOX_ERR_GET_PORT error;
224 ck_assert_msg(tox_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); 224 ck_assert_msg(tox_self_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
225 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); 225 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
226 } 226 }
227 227
@@ -293,7 +293,7 @@ START_TEST(test_few_clients)
293 293
294 { 294 {
295 TOX_ERR_GET_PORT error; 295 TOX_ERR_GET_PORT error;
296 ck_assert_msg(tox_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); 296 ck_assert_msg(tox_self_get_udp_port(tox1, &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
297 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); 297 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
298 } 298 }
299 299
@@ -309,9 +309,9 @@ START_TEST(test_few_clients)
309 uint8_t off = 1; 309 uint8_t off = 1;
310 310
311 while (1) { 311 while (1) {
312 tox_iteration(tox1); 312 tox_iterate(tox1);
313 tox_iteration(tox2); 313 tox_iterate(tox2);
314 tox_iteration(tox3); 314 tox_iterate(tox3);
315 315
316 if (tox_get_connection_status(tox1) && tox_get_connection_status(tox2) && tox_get_connection_status(tox3)) { 316 if (tox_get_connection_status(tox1) && tox_get_connection_status(tox2) && tox_get_connection_status(tox3)) {
317 if (off) { 317 if (off) {
@@ -334,17 +334,17 @@ START_TEST(test_few_clients)
334 tox_callback_friend_message(tox3, print_message, &to_compare); 334 tox_callback_friend_message(tox3, print_message, &to_compare);
335 uint8_t msgs[TOX_MAX_MESSAGE_LENGTH + 1]; 335 uint8_t msgs[TOX_MAX_MESSAGE_LENGTH + 1];
336 memset(msgs, 'G', sizeof(msgs)); 336 memset(msgs, 'G', sizeof(msgs));
337 TOX_ERR_SEND_MESSAGE errm; 337 TOX_ERR_FRIEND_SEND_MESSAGE errm;
338 tox_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH + 1, &errm); 338 tox_friend_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH + 1, &errm);
339 ck_assert_msg(errm == TOX_ERR_SEND_MESSAGE_TOO_LONG, "TOX_MAX_MESSAGE_LENGTH is too small\n"); 339 ck_assert_msg(errm == TOX_ERR_FRIEND_SEND_MESSAGE_TOO_LONG, "TOX_MAX_MESSAGE_LENGTH is too small\n");
340 tox_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH, &errm); 340 tox_friend_send_message(tox2, 0, msgs, TOX_MAX_MESSAGE_LENGTH, &errm);
341 ck_assert_msg(errm == TOX_ERR_SEND_MESSAGE_OK, "TOX_MAX_MESSAGE_LENGTH is too big\n"); 341 ck_assert_msg(errm == TOX_ERR_FRIEND_SEND_MESSAGE_OK, "TOX_MAX_MESSAGE_LENGTH is too big\n");
342 342
343 while (1) { 343 while (1) {
344 messages_received = 0; 344 messages_received = 0;
345 tox_iteration(tox1); 345 tox_iterate(tox1);
346 tox_iteration(tox2); 346 tox_iterate(tox2);
347 tox_iteration(tox3); 347 tox_iterate(tox3);
348 348
349 if (messages_received) 349 if (messages_received)
350 break; 350 break;
@@ -361,9 +361,9 @@ START_TEST(test_few_clients)
361 361
362 while (1) { 362 while (1) {
363 name_changes = 0; 363 name_changes = 0;
364 tox_iteration(tox1); 364 tox_iterate(tox1);
365 tox_iteration(tox2); 365 tox_iterate(tox2);
366 tox_iteration(tox3); 366 tox_iterate(tox3);
367 367
368 if (name_changes) 368 if (name_changes)
369 break; 369 break;
@@ -381,9 +381,9 @@ START_TEST(test_few_clients)
381 381
382 while (1) { 382 while (1) {
383 typing_changes = 0; 383 typing_changes = 0;
384 tox_iteration(tox1); 384 tox_iterate(tox1);
385 tox_iteration(tox2); 385 tox_iterate(tox2);
386 tox_iteration(tox3); 386 tox_iterate(tox3);
387 387
388 388
389 if (typing_changes == 2) 389 if (typing_changes == 2)
@@ -399,9 +399,9 @@ START_TEST(test_few_clients)
399 399
400 while (1) { 400 while (1) {
401 typing_changes = 0; 401 typing_changes = 0;
402 tox_iteration(tox1); 402 tox_iterate(tox1);
403 tox_iteration(tox2); 403 tox_iterate(tox2);
404 tox_iteration(tox3); 404 tox_iterate(tox3);
405 405
406 if (typing_changes == 1) 406 if (typing_changes == 1)
407 break; 407 break;
@@ -419,16 +419,16 @@ START_TEST(test_few_clients)
419 tox_callback_friend_lossless_packet(tox3, &handle_custom_packet, &packet_number); 419 tox_callback_friend_lossless_packet(tox3, &handle_custom_packet, &packet_number);
420 uint8_t data_c[TOX_MAX_CUSTOM_PACKET_SIZE + 1]; 420 uint8_t data_c[TOX_MAX_CUSTOM_PACKET_SIZE + 1];
421 memset(data_c, ((uint8_t)packet_number), sizeof(data_c)); 421 memset(data_c, ((uint8_t)packet_number), sizeof(data_c));
422 int ret = tox_send_lossless_packet(tox2, 0, data_c, sizeof(data_c), 0); 422 int ret = tox_friend_send_lossless_packet(tox2, 0, data_c, sizeof(data_c), 0);
423 ck_assert_msg(ret == 0, "tox_send_lossless_packet bigger fail %i", ret); 423 ck_assert_msg(ret == 0, "tox_friend_send_lossless_packet bigger fail %i", ret);
424 ret = tox_send_lossless_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0); 424 ret = tox_friend_send_lossless_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0);
425 ck_assert_msg(ret == 1, "tox_send_lossless_packet fail %i", ret); 425 ck_assert_msg(ret == 1, "tox_friend_send_lossless_packet fail %i", ret);
426 426
427 while (1) { 427 while (1) {
428 custom_packet = 0; 428 custom_packet = 0;
429 tox_iteration(tox1); 429 tox_iterate(tox1);
430 tox_iteration(tox2); 430 tox_iterate(tox2);
431 tox_iteration(tox3); 431 tox_iterate(tox3);
432 432
433 if (custom_packet == 1) 433 if (custom_packet == 1)
434 break; 434 break;
@@ -441,16 +441,16 @@ START_TEST(test_few_clients)
441 packet_number = 200; 441 packet_number = 200;
442 tox_callback_friend_lossy_packet(tox3, &handle_custom_packet, &packet_number); 442 tox_callback_friend_lossy_packet(tox3, &handle_custom_packet, &packet_number);
443 memset(data_c, ((uint8_t)packet_number), sizeof(data_c)); 443 memset(data_c, ((uint8_t)packet_number), sizeof(data_c));
444 ret = tox_send_lossy_packet(tox2, 0, data_c, sizeof(data_c), 0); 444 ret = tox_friend_send_lossy_packet(tox2, 0, data_c, sizeof(data_c), 0);
445 ck_assert_msg(ret == 0, "tox_send_lossy_packet bigger fail %i", ret); 445 ck_assert_msg(ret == 0, "tox_friend_send_lossy_packet bigger fail %i", ret);
446 ret = tox_send_lossy_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0); 446 ret = tox_friend_send_lossy_packet(tox2, 0, data_c, TOX_MAX_CUSTOM_PACKET_SIZE, 0);
447 ck_assert_msg(ret == 1, "tox_send_lossy_packet fail %i", ret); 447 ck_assert_msg(ret == 1, "tox_friend_send_lossy_packet fail %i", ret);
448 448
449 while (1) { 449 while (1) {
450 custom_packet = 0; 450 custom_packet = 0;
451 tox_iteration(tox1); 451 tox_iterate(tox1);
452 tox_iteration(tox2); 452 tox_iterate(tox2);
453 tox_iteration(tox3); 453 tox_iterate(tox3);
454 454
455 if (custom_packet == 1) 455 if (custom_packet == 1)
456 break; 456 break;
@@ -463,20 +463,20 @@ START_TEST(test_few_clients)
463 file_accepted = file_size = file_recv = sendf_ok = size_recv = 0; 463 file_accepted = file_size = file_recv = sendf_ok = size_recv = 0;
464 long long unsigned int f_time = time(NULL); 464 long long unsigned int f_time = time(NULL);
465 tox_callback_file_receive_chunk(tox3, write_file, &to_compare); 465 tox_callback_file_receive_chunk(tox3, write_file, &to_compare);
466 tox_callback_file_control(tox2, file_print_control, &to_compare); 466 tox_callback_file_recv_control(tox2, file_print_control, &to_compare);
467 tox_callback_file_request_chunk(tox2, tox_file_request_chunk, &to_compare); 467 tox_callback_file_request_chunk(tox2, tox_file_request_chunk, &to_compare);
468 tox_callback_file_control(tox3, file_print_control, &to_compare); 468 tox_callback_file_recv_control(tox3, file_print_control, &to_compare);
469 tox_callback_file_receive(tox3, tox_file_receive, &to_compare); 469 tox_callback_file_receive(tox3, tox_file_receive, &to_compare);
470 uint64_t totalf_size = 100 * 1024 * 1024; 470 uint64_t totalf_size = 100 * 1024 * 1024;
471 uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_KIND_DATA, totalf_size, (uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"), 471 uint32_t fnum = tox_file_send(tox2, 0, TOX_FILE_TYPE_DATA, totalf_size, (uint8_t *)"Gentoo.exe", sizeof("Gentoo.exe"),
472 0); 472 0);
473 ck_assert_msg(fnum != UINT32_MAX, "tox_new_file_sender fail"); 473 ck_assert_msg(fnum != UINT32_MAX, "tox_new_file_sender fail");
474 474
475 475
476 while (1) { 476 while (1) {
477 tox_iteration(tox1); 477 tox_iterate(tox1);
478 tox_iteration(tox2); 478 tox_iterate(tox2);
479 tox_iteration(tox3); 479 tox_iterate(tox3);
480 480
481 if (file_sending_done) { 481 if (file_sending_done) {
482 if (sendf_ok && file_recv && totalf_size == file_size && size_recv == file_size && sending_pos == size_recv) { 482 if (sendf_ok && file_recv && totalf_size == file_size && size_recv == file_size && sending_pos == size_recv) {
@@ -526,7 +526,7 @@ START_TEST(test_many_clients)
526 526
527 { 527 {
528 TOX_ERR_GET_PORT error; 528 TOX_ERR_GET_PORT error;
529 ck_assert_msg(tox_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); 529 ck_assert_msg(tox_self_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
530 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); 530 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
531 } 531 }
532 532
@@ -573,7 +573,7 @@ loop_top:
573 } 573 }
574 574
575 for (i = 0; i < NUM_TOXES; ++i) { 575 for (i = 0; i < NUM_TOXES; ++i) {
576 tox_iteration(toxes[i]); 576 tox_iterate(toxes[i]);
577 } 577 }
578 578
579 c_sleep(50); 579 c_sleep(50);
@@ -654,7 +654,7 @@ START_TEST(test_many_group)
654 654
655 { 655 {
656 TOX_ERR_GET_PORT error; 656 TOX_ERR_GET_PORT error;
657 ck_assert_msg(tox_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n"); 657 ck_assert_msg(tox_self_get_udp_port(toxes[0], &error) == 33445, "First Tox instance did not bind to udp port 33445.\n");
658 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error"); 658 ck_assert_msg(error == TOX_ERR_GET_PORT_OK, "wrong error");
659 } 659 }
660 660
@@ -678,7 +678,7 @@ START_TEST(test_many_group)
678 break; 678 break;
679 679
680 for (i = 0; i < NUM_GROUP_TOX; ++i) { 680 for (i = 0; i < NUM_GROUP_TOX; ++i) {
681 tox_iteration(toxes[i]); 681 tox_iterate(toxes[i]);
682 } 682 }
683 683
684 c_sleep(50); 684 c_sleep(50);
@@ -696,7 +696,7 @@ START_TEST(test_many_group)
696 696
697 while (1) { 697 while (1) {
698 for (i = 0; i < NUM_GROUP_TOX; ++i) { 698 for (i = 0; i < NUM_GROUP_TOX; ++i) {
699 tox_iteration(toxes[i]); 699 tox_iterate(toxes[i]);
700 } 700 }
701 701
702 if (!invite_counter) { 702 if (!invite_counter) {
@@ -734,7 +734,7 @@ START_TEST(test_many_group)
734 734
735 for (j = 0; j < 20; ++j) { 735 for (j = 0; j < 20; ++j) {
736 for (i = 0; i < NUM_GROUP_TOX; ++i) { 736 for (i = 0; i < NUM_GROUP_TOX; ++i) {
737 tox_iteration(toxes[i]); 737 tox_iterate(toxes[i]);
738 } 738 }
739 739
740 c_sleep(50); 740 c_sleep(50);
@@ -747,7 +747,7 @@ START_TEST(test_many_group)
747 747
748 for (j = 0; j < 10; ++j) { 748 for (j = 0; j < 10; ++j) {
749 for (i = 0; i < NUM_GROUP_TOX; ++i) { 749 for (i = 0; i < NUM_GROUP_TOX; ++i) {
750 tox_iteration(toxes[i]); 750 tox_iterate(toxes[i]);
751 } 751 }
752 752
753 c_sleep(50); 753 c_sleep(50);
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c
index 59730edf..3f4a3b8d 100644
--- a/auto_tests/toxav_basic_test.c
+++ b/auto_tests/toxav_basic_test.c
@@ -232,7 +232,7 @@ void register_callbacks(ToxAv *av, void *data)
232 */ 232 */
233#define CALL_AND_START_LOOP(AliceCallType, BobCallType) \ 233#define CALL_AND_START_LOOP(AliceCallType, BobCallType) \
234{ int step = 0, running = 1; while (running) {\ 234{ int step = 0, running = 1; while (running) {\
235 tox_iteration(bootstrap_node); tox_iteration(Alice); tox_iteration(Bob); \ 235 tox_iterate(bootstrap_node); tox_iterate(Alice); tox_iterate(Bob); \
236 toxav_do(status_control.Bob.av); toxav_do(status_control.Alice.av); \ 236 toxav_do(status_control.Bob.av); toxav_do(status_control.Alice.av); \
237 switch ( step ) {\ 237 switch ( step ) {\
238 case 0: /* Alice */ printf("Alice is calling...\n");\ 238 case 0: /* Alice */ printf("Alice is calling...\n");\
@@ -267,9 +267,9 @@ START_TEST(test_AV_flows)
267 uint8_t off = 1; 267 uint8_t off = 1;
268 268
269 while (1) { 269 while (1) {
270 tox_iteration(bootstrap_node); 270 tox_iterate(bootstrap_node);
271 tox_iteration(Alice); 271 tox_iterate(Alice);
272 tox_iteration(Bob); 272 tox_iterate(Bob);
273 273
274 if (tox_get_connection_status(bootstrap_node) && tox_get_connection_status(Alice) && tox_get_connection_status(Bob) 274 if (tox_get_connection_status(bootstrap_node) && tox_get_connection_status(Alice) && tox_get_connection_status(Bob)
275 && off) { 275 && off) {
@@ -484,9 +484,9 @@ START_TEST(test_AV_flows)
484 int running = 1; 484 int running = 1;
485 485
486 while (running) { 486 while (running) {
487 tox_iteration(bootstrap_node); 487 tox_iterate(bootstrap_node);
488 tox_iteration(Alice); 488 tox_iterate(Alice);
489 tox_iteration(Bob); 489 tox_iterate(Bob);
490 490
491 switch ( step ) { 491 switch ( step ) {
492 case 0: /* Alice */ 492 case 0: /* Alice */
@@ -525,9 +525,9 @@ START_TEST(test_AV_flows)
525 int running = 1; 525 int running = 1;
526 526
527 while (running) { 527 while (running) {
528 tox_iteration(bootstrap_node); 528 tox_iterate(bootstrap_node);
529 tox_iteration(Alice); 529 tox_iterate(Alice);
530 tox_iteration(Bob); 530 tox_iterate(Bob);
531 531
532 toxav_do(status_control.Alice.av); 532 toxav_do(status_control.Alice.av);
533 toxav_do(status_control.Bob.av); 533 toxav_do(status_control.Bob.av);
@@ -570,9 +570,9 @@ START_TEST(test_AV_flows)
570 int running = 1; 570 int running = 1;
571 571
572 while (running) { 572 while (running) {
573 tox_iteration(bootstrap_node); 573 tox_iterate(bootstrap_node);
574 tox_iteration(Alice); 574 tox_iterate(Alice);
575 tox_iteration(Bob); 575 tox_iterate(Bob);
576 576
577 toxav_do(status_control.Alice.av); 577 toxav_do(status_control.Alice.av);
578 toxav_do(status_control.Bob.av); 578 toxav_do(status_control.Bob.av);
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c
index 4002c4e7..f22043e1 100644
--- a/auto_tests/toxav_many_test.c
+++ b/auto_tests/toxav_many_test.c
@@ -294,11 +294,11 @@ START_TEST(test_AV_three_calls)
294 uint8_t off = 1; 294 uint8_t off = 1;
295 295
296 while (1) { 296 while (1) {
297 tox_iteration(bootstrap_node); 297 tox_iterate(bootstrap_node);
298 tox_iteration(caller); 298 tox_iterate(caller);
299 299
300 for (i = 0; i < 3; i ++) { 300 for (i = 0; i < 3; i ++) {
301 tox_iteration(callees[i]); 301 tox_iterate(callees[i]);
302 } 302 }
303 303
304 304
@@ -351,11 +351,11 @@ START_TEST(test_AV_three_calls)
351 while (call_running[0] || call_running[1] || call_running[2]) { 351 while (call_running[0] || call_running[1] || call_running[2]) {
352 pthread_mutex_lock(&muhmutex); 352 pthread_mutex_lock(&muhmutex);
353 353
354 tox_iteration(bootstrap_node); 354 tox_iterate(bootstrap_node);
355 tox_iteration(caller); 355 tox_iterate(caller);
356 tox_iteration(callees[0]); 356 tox_iterate(callees[0]);
357 tox_iteration(callees[1]); 357 tox_iterate(callees[1]);
358 tox_iteration(callees[2]); 358 tox_iterate(callees[2]);
359 359
360 for ( i = 0; i < 3; i++ ) 360 for ( i = 0; i < 3; i++ )
361 toxav_do(status_control.calls[0].Caller.av); 361 toxav_do(status_control.calls[0].Caller.av);
diff --git a/testing/irc_syncbot.c b/testing/irc_syncbot.c
index df9e964c..ee49e160 100644
--- a/testing/irc_syncbot.c
+++ b/testing/irc_syncbot.c
@@ -342,7 +342,7 @@ int main(int argc, char *argv[])
342 } 342 }
343 } 343 }
344 344
345 tox_iteration(tox); 345 tox_iterate(tox);
346 usleep(1000 * 50); 346 usleep(1000 * 50);
347 } 347 }
348 348
diff --git a/testing/nTox.c b/testing/nTox.c
index 708397f9..d373c683 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -158,7 +158,7 @@ uint32_t add_filesender(Tox *m, uint16_t friendnum, char *filename)
158 fseek(tempfile, 0, SEEK_END); 158 fseek(tempfile, 0, SEEK_END);
159 uint64_t filesize = ftell(tempfile); 159 uint64_t filesize = ftell(tempfile);
160 fseek(tempfile, 0, SEEK_SET); 160 fseek(tempfile, 0, SEEK_SET);
161 uint32_t filenum = tox_file_send(m, friendnum, TOX_FILE_KIND_DATA, filesize, (uint8_t *)filename, strlen(filename) + 1, 161 uint32_t filenum = tox_file_send(m, friendnum, TOX_FILE_TYPE_DATA, filesize, (uint8_t *)filename, strlen(filename) + 1,
162 0); 162 0);
163 163
164 if (filenum == -1) 164 if (filenum == -1)
@@ -389,13 +389,13 @@ void line_eval(Tox *m, char *line)
389 389
390 new_lines(numstring); 390 new_lines(numstring);
391 } else if (inpt_command == 'd') { 391 } else if (inpt_command == 'd') {
392 tox_iteration(m); 392 tox_iterate(m);
393 } else if (inpt_command == 'm') { //message command: /m friendnumber messsage 393 } else if (inpt_command == 'm') { //message command: /m friendnumber messsage
394 char *posi[1]; 394 char *posi[1];
395 int num = strtoul(line + prompt_offset, posi, 0); 395 int num = strtoul(line + prompt_offset, posi, 0);
396 396
397 if (**posi != 0) { 397 if (**posi != 0) {
398 if (tox_send_message(m, num, (uint8_t *) *posi + 1, strlen(*posi + 1), NULL) < 1) { 398 if (tox_friend_send_message(m, num, (uint8_t *) *posi + 1, strlen(*posi + 1), NULL) < 1) {
399 char sss[256]; 399 char sss[256];
400 sprintf(sss, "[i] could not send message to friend num %u", num); 400 sprintf(sss, "[i] could not send message to friend num %u", num);
401 new_lines(sss); 401 new_lines(sss);
@@ -607,7 +607,7 @@ void line_eval(Tox *m, char *line)
607 if (conversation_default != 0) { 607 if (conversation_default != 0) {
608 if (conversation_default > 0) { 608 if (conversation_default > 0) {
609 int friendnumber = conversation_default - 1; 609 int friendnumber = conversation_default - 1;
610 uint32_t res = tox_send_message(m, friendnumber, (uint8_t *)line, strlen(line), NULL); 610 uint32_t res = tox_friend_send_message(m, friendnumber, (uint8_t *)line, strlen(line), NULL);
611 611
612 if (res == 0) { 612 if (res == 0) {
613 char sss[128]; 613 char sss[128];
@@ -1127,12 +1127,12 @@ void print_groupnamelistchange(Tox *m, int groupnumber, int peernumber, uint8_t
1127 print_groupchatpeers(m, groupnumber); 1127 print_groupchatpeers(m, groupnumber);
1128 } 1128 }
1129} 1129}
1130void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_KIND type, 1130void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_TYPE type,
1131 uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data) 1131 uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data)
1132{ 1132{
1133 if (type != TOX_FILE_KIND_DATA) { 1133 if (type != TOX_FILE_TYPE_DATA) {
1134 new_lines("Refused invalid file type."); 1134 new_lines("Refused invalid file type.");
1135 tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0); 1135 tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
1136 return; 1136 return;
1137 } 1137 }
1138 1138
@@ -1140,7 +1140,7 @@ void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number,
1140 sprintf(msg, "[t] %u is sending us: %s of size %llu", friend_number, filename, (long long unsigned int)file_size); 1140 sprintf(msg, "[t] %u is sending us: %s of size %llu", friend_number, filename, (long long unsigned int)file_size);
1141 new_lines(msg); 1141 new_lines(msg);
1142 1142
1143 if (tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, 0)) { 1143 if (tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, 0)) {
1144 sprintf(msg, "Accepted file transfer. (saving file as: %u.%u.bin)", friend_number, file_number); 1144 sprintf(msg, "Accepted file transfer. (saving file as: %u.%u.bin)", friend_number, file_number);
1145 new_lines(msg); 1145 new_lines(msg);
1146 } else 1146 } else
@@ -1270,7 +1270,7 @@ int main(int argc, char *argv[])
1270 tox_callback_group_invite(m, print_invite, NULL); 1270 tox_callback_group_invite(m, print_invite, NULL);
1271 tox_callback_group_message(m, print_groupmessage, NULL); 1271 tox_callback_group_message(m, print_groupmessage, NULL);
1272 tox_callback_file_receive_chunk(m, write_file, NULL); 1272 tox_callback_file_receive_chunk(m, write_file, NULL);
1273 tox_callback_file_control(m, file_print_control, NULL); 1273 tox_callback_file_recv_control(m, file_print_control, NULL);
1274 tox_callback_file_receive(m, file_request_accept, NULL); 1274 tox_callback_file_receive(m, file_request_accept, NULL);
1275 tox_callback_file_request_chunk(m, tox_file_request_chunk, NULL); 1275 tox_callback_file_request_chunk(m, tox_file_request_chunk, NULL);
1276 tox_callback_group_namelist_change(m, print_groupnamelistchange, NULL); 1276 tox_callback_group_namelist_change(m, print_groupnamelistchange, NULL);
@@ -1326,7 +1326,7 @@ int main(int argc, char *argv[])
1326 } 1326 }
1327 } 1327 }
1328 1328
1329 tox_iteration(m); 1329 tox_iterate(m);
1330 do_refresh(); 1330 do_refresh();
1331 1331
1332 int c = timeout_getch(m); 1332 int c = timeout_getch(m);
diff --git a/testing/tox_shell.c b/testing/tox_shell.c
index c8dc9ff2..38fe6364 100644
--- a/testing/tox_shell.c
+++ b/testing/tox_shell.c
@@ -148,10 +148,10 @@ int main(int argc, char *argv[])
148 if (ret <= 0) 148 if (ret <= 0)
149 break; 149 break;
150 150
151 tox_send_message(tox, num, buf, ret, 0); 151 tox_friend_send_message(tox, num, buf, ret, 0);
152 } 152 }
153 153
154 tox_iteration(tox); 154 tox_iterate(tox);
155 c_sleep(1); 155 c_sleep(1);
156 } 156 }
157 157
diff --git a/testing/tox_sync.c b/testing/tox_sync.c
index bdbd2e3f..61f390fc 100644
--- a/testing/tox_sync.c
+++ b/testing/tox_sync.c
@@ -88,7 +88,7 @@ uint32_t add_filesender(Tox *m, uint16_t friendnum, char *filename)
88 fseek(tempfile, 0, SEEK_END); 88 fseek(tempfile, 0, SEEK_END);
89 uint64_t filesize = ftell(tempfile); 89 uint64_t filesize = ftell(tempfile);
90 fseek(tempfile, 0, SEEK_SET); 90 fseek(tempfile, 0, SEEK_SET);
91 uint32_t filenum = tox_file_send(m, friendnum, TOX_FILE_KIND_DATA, filesize, (uint8_t *)filename, strlen(filename) + 1, 91 uint32_t filenum = tox_file_send(m, friendnum, TOX_FILE_TYPE_DATA, filesize, (uint8_t *)filename, strlen(filename) + 1,
92 0); 92 0);
93 93
94 if (filenum == -1) 94 if (filenum == -1)
@@ -124,12 +124,12 @@ int not_sending()
124 124
125static char path[1024]; 125static char path[1024];
126 126
127void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_KIND type, 127void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_TYPE type,
128 uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data) 128 uint64_t file_size, const uint8_t *filename, size_t filename_length, void *user_data)
129{ 129{
130 if (type != TOX_FILE_KIND_DATA) { 130 if (type != TOX_FILE_TYPE_DATA) {
131 printf("Refused invalid file type."); 131 printf("Refused invalid file type.");
132 tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0); 132 tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
133 return; 133 return;
134 } 134 }
135 135
@@ -151,7 +151,7 @@ void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number,
151 151
152 if (tempfile != 0) { 152 if (tempfile != 0) {
153 fclose(tempfile); 153 fclose(tempfile);
154 tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0); 154 tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
155 return; 155 return;
156 } 156 }
157 157
@@ -159,11 +159,11 @@ void file_request_accept(Tox *tox, uint32_t friend_number, uint32_t file_number,
159 file_recv[file_index].file = fopen(fullpath, "wb"); 159 file_recv[file_index].file = fopen(fullpath, "wb");
160 160
161 if (file_recv[file_index].file == 0) { 161 if (file_recv[file_index].file == 0) {
162 tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0); 162 tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_CANCEL, 0);
163 return; 163 return;
164 } 164 }
165 165
166 if (tox_file_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, 0)) { 166 if (tox_file_send_control(tox, friend_number, file_number, TOX_FILE_CONTROL_RESUME, 0)) {
167 printf("Accepted file transfer. (file: %s)\n", fullpath); 167 printf("Accepted file transfer. (file: %s)\n", fullpath);
168 } 168 }
169 169
@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
231 231
232 Tox *tox = tox_new(0, 0, 0, 0); 232 Tox *tox = tox_new(0, 0, 0, 0);
233 tox_callback_file_receive_chunk(tox, write_file, NULL); 233 tox_callback_file_receive_chunk(tox, write_file, NULL);
234 tox_callback_file_control(tox, file_print_control, NULL); 234 tox_callback_file_recv_control(tox, file_print_control, NULL);
235 tox_callback_file_receive(tox, file_request_accept, NULL); 235 tox_callback_file_receive(tox, file_request_accept, NULL);
236 tox_callback_file_request_chunk(tox, tox_file_request_chunk, NULL); 236 tox_callback_file_request_chunk(tox, tox_file_request_chunk, NULL);
237 tox_callback_friend_connection_status(tox, print_online, NULL); 237 tox_callback_friend_connection_status(tox, print_online, NULL);
@@ -306,7 +306,7 @@ int main(int argc, char *argv[])
306 } 306 }
307 } 307 }
308 308
309 tox_iteration(tox); 309 tox_iterate(tox);
310 c_sleep(1); 310 c_sleep(1);
311 } 311 }
312 312
diff --git a/toxcore/tox.c b/toxcore/tox.c
index 9a821bfb..6340aee9 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -302,7 +302,7 @@ uint32_t tox_iteration_interval(const Tox *tox)
302 return messenger_run_interval(m); 302 return messenger_run_interval(m);
303} 303}
304 304
305void tox_iteration(Tox *tox) 305void tox_iterate(Tox *tox)
306{ 306{
307 Messenger *m = tox; 307 Messenger *m = tox;
308 do_messenger(m); 308 do_messenger(m);
@@ -822,7 +822,7 @@ bool tox_hash(uint8_t *hash, const uint8_t *data, size_t length)
822 return 1; 822 return 1;
823} 823}
824 824
825bool tox_file_control(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_CONTROL control, 825bool tox_file_send_control(Tox *tox, uint32_t friend_number, uint32_t file_number, TOX_FILE_CONTROL control,
826 TOX_ERR_FILE_CONTROL *error) 826 TOX_ERR_FILE_CONTROL *error)
827{ 827{
828 Messenger *m = tox; 828 Messenger *m = tox;
@@ -1077,7 +1077,7 @@ void tox_callback_friend_lossless_packet(Tox *tox, tox_friend_lossless_packet_cb
1077 custom_lossless_packet_registerhandler(m, function, user_data); 1077 custom_lossless_packet_registerhandler(m, function, user_data);
1078} 1078}
1079 1079
1080void tox_get_dht_id(const Tox *tox, uint8_t *dht_id) 1080void tox_self_get_dht_id(const Tox *tox, uint8_t *dht_id)
1081{ 1081{
1082 if (dht_id) { 1082 if (dht_id) {
1083 const Messenger *m = tox; 1083 const Messenger *m = tox;
@@ -1085,7 +1085,7 @@ void tox_get_dht_id(const Tox *tox, uint8_t *dht_id)
1085 } 1085 }
1086} 1086}
1087 1087
1088uint16_t tox_get_udp_port(const Tox *tox, TOX_ERR_GET_PORT *error) 1088uint16_t tox_self_get_udp_port(const Tox *tox, TOX_ERR_GET_PORT *error)
1089{ 1089{
1090 const Messenger *m = tox; 1090 const Messenger *m = tox;
1091 uint16_t port = htons(m->net->port); 1091 uint16_t port = htons(m->net->port);
@@ -1099,7 +1099,7 @@ uint16_t tox_get_udp_port(const Tox *tox, TOX_ERR_GET_PORT *error)
1099 return port; 1099 return port;
1100} 1100}
1101 1101
1102uint16_t tox_get_tcp_port(const Tox *tox, TOX_ERR_GET_PORT *error) 1102uint16_t tox_self_get_tcp_port(const Tox *tox, TOX_ERR_GET_PORT *error)
1103{ 1103{
1104 /* TCP server not yet implemented in clients. */ 1104 /* TCP server not yet implemented in clients. */
1105 SET_ERROR_PARAMETER(error, TOX_ERR_GET_PORT_NOT_BOUND); 1105 SET_ERROR_PARAMETER(error, TOX_ERR_GET_PORT_NOT_BOUND);
diff --git a/toxcore/tox.h b/toxcore/tox.h
index c4309e59..96969c43 100644
--- a/toxcore/tox.h
+++ b/toxcore/tox.h
@@ -652,7 +652,7 @@ uint32_t tox_iteration_interval(const Tox *tox);
652 * The main loop that needs to be run in intervals of tox_iteration_interval() 652 * The main loop that needs to be run in intervals of tox_iteration_interval()
653 * milliseconds. 653 * milliseconds.
654 */ 654 */
655void tox_do_iteration(Tox *tox); 655void tox_iterate(Tox *tox);
656 656
657 657
658/******************************************************************************* 658/*******************************************************************************