diff options
-rw-r--r-- | auto_tests/messenger_test.c | 14 | ||||
-rw-r--r-- | auto_tests/tox_test.c | 69 | ||||
-rw-r--r-- | auto_tests/toxav_basic_test.c | 47 | ||||
-rw-r--r-- | auto_tests/toxav_many_test.c | 52 | ||||
-rw-r--r-- | toxcore/Messenger.c | 10 |
5 files changed, 96 insertions, 96 deletions
diff --git a/auto_tests/messenger_test.c b/auto_tests/messenger_test.c index f1a1ab9b..8c71d6e7 100644 --- a/auto_tests/messenger_test.c +++ b/auto_tests/messenger_test.c | |||
@@ -50,10 +50,10 @@ START_TEST(test_m_sendmesage) | |||
50 | int bad_len = MAX_CRYPTO_PACKET_SIZE; | 50 | int bad_len = MAX_CRYPTO_PACKET_SIZE; |
51 | 51 | ||
52 | 52 | ||
53 | ck_assert(m_sendmessage(m, -1, (uint8_t *)message, good_len) == 0); | 53 | ck_assert(m_sendmessage(m, -1, (uint8_t *)message, good_len, 0) == -1); |
54 | ck_assert(m_sendmessage(m, REALLY_BIG_NUMBER, (uint8_t *)message, good_len) == 0); | 54 | ck_assert(m_sendmessage(m, REALLY_BIG_NUMBER, (uint8_t *)message, good_len, 0) == -1); |
55 | ck_assert(m_sendmessage(m, 17, (uint8_t *)message, good_len) == 0); | 55 | ck_assert(m_sendmessage(m, 17, (uint8_t *)message, good_len, 0) == -1); |
56 | ck_assert(m_sendmessage(m, friend_id_num, (uint8_t *)message, bad_len) == 0); | 56 | ck_assert(m_sendmessage(m, friend_id_num, (uint8_t *)message, bad_len, 0) == -2); |
57 | } | 57 | } |
58 | END_TEST | 58 | END_TEST |
59 | 59 | ||
@@ -68,10 +68,10 @@ START_TEST(test_m_get_userstatus_size) | |||
68 | rc = m_get_statusmessage_size(m, friend_id_num); | 68 | rc = m_get_statusmessage_size(m, friend_id_num); |
69 | 69 | ||
70 | /* this WILL error if the original m_addfriend_norequest() failed */ | 70 | /* this WILL error if the original m_addfriend_norequest() failed */ |
71 | ck_assert_msg((rc > 0 && rc <= MAX_STATUSMESSAGE_LENGTH), | 71 | ck_assert_msg((rc >= 0 && rc <= MAX_STATUSMESSAGE_LENGTH), |
72 | "m_get_statusmessage_size is returning out of range values!\n" | 72 | "m_get_statusmessage_size is returning out of range values! (%i)\n" |
73 | "(this can be caused by the error of m_addfriend_norequest" | 73 | "(this can be caused by the error of m_addfriend_norequest" |
74 | " in the beginning of the suite)\n"); | 74 | " in the beginning of the suite)\n", rc); |
75 | } | 75 | } |
76 | END_TEST | 76 | END_TEST |
77 | 77 | ||
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 2c157b1c..7e375db0 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -21,18 +21,18 @@ | |||
21 | #define c_sleep(x) usleep(1000*x) | 21 | #define c_sleep(x) usleep(1000*x) |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata) | 24 | void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata) |
25 | { | 25 | { |
26 | if (*((uint32_t *)userdata) != 974536) | 26 | if (*((uint32_t *)userdata) != 974536) |
27 | return; | 27 | return; |
28 | 28 | ||
29 | if (length == 7 && memcmp("Gentoo", data, 7) == 0) { | 29 | if (length == 7 && memcmp("Gentoo", data, 7) == 0) { |
30 | tox_add_friend_norequest(m, public_key); | 30 | tox_friend_add_norequest(m, public_key, 0); |
31 | } | 31 | } |
32 | } | 32 | } |
33 | uint32_t messages_received; | 33 | uint32_t messages_received; |
34 | 34 | ||
35 | void print_message(Tox *m, int friendnumber, const uint8_t *string, uint16_t length, void *userdata) | 35 | void print_message(Tox *m, uint32_t friendnumber, const uint8_t *string, size_t length, void *userdata) |
36 | { | 36 | { |
37 | if (*((uint32_t *)userdata) != 974536) | 37 | if (*((uint32_t *)userdata) != 974536) |
38 | return; | 38 | return; |
@@ -46,7 +46,7 @@ void print_message(Tox *m, int friendnumber, const uint8_t *string, uint16_t len | |||
46 | 46 | ||
47 | uint32_t name_changes; | 47 | uint32_t name_changes; |
48 | 48 | ||
49 | void print_nickchange(Tox *m, int friendnumber, const uint8_t *string, uint16_t length, void *userdata) | 49 | void print_nickchange(Tox *m, uint32_t friendnumber, const uint8_t *string, size_t length, void *userdata) |
50 | { | 50 | { |
51 | if (*((uint32_t *)userdata) != 974536) | 51 | if (*((uint32_t *)userdata) != 974536) |
52 | return; | 52 | return; |
@@ -57,7 +57,7 @@ void print_nickchange(Tox *m, int friendnumber, const uint8_t *string, uint16_t | |||
57 | 57 | ||
58 | uint32_t typing_changes; | 58 | uint32_t typing_changes; |
59 | 59 | ||
60 | void print_typingchange(Tox *m, int friendnumber, uint8_t typing, void *userdata) | 60 | void print_typingchange(Tox *m, uint32_t friendnumber, bool typing, void *userdata) |
61 | { | 61 | { |
62 | if (*((uint32_t *)userdata) != 974536) | 62 | if (*((uint32_t *)userdata) != 974536) |
63 | return; | 63 | return; |
@@ -144,27 +144,35 @@ void write_file(Tox *m, int friendnumber, uint8_t filenumber, const uint8_t *dat | |||
144 | 144 | ||
145 | START_TEST(test_one) | 145 | START_TEST(test_one) |
146 | { | 146 | { |
147 | Tox *tox1 = tox_new(0); | 147 | Tox *tox1 = tox_new(0, 0, 0, 0); |
148 | Tox *tox2 = tox_new(0); | 148 | Tox *tox2 = tox_new(0, 0, 0, 0); |
149 | 149 | ||
150 | uint8_t address[TOX_FRIEND_ADDRESS_SIZE]; | 150 | uint8_t address[TOX_ADDRESS_SIZE]; |
151 | tox_get_address(tox1, address); | 151 | tox_self_get_address(tox1, address); |
152 | ck_assert_msg(tox_add_friend(tox1, address, (uint8_t *)"m", 1) == TOX_FAERR_OWNKEY, "Adding own address worked."); | 152 | TOX_ERR_FRIEND_ADD error; |
153 | 153 | uint32_t ret = tox_friend_add(tox1, address, (uint8_t *)"m", 1, &error); | |
154 | tox_get_address(tox2, address); | 154 | ck_assert_msg(ret == UINT32_MAX && error == TOX_ERR_FRIEND_ADD_OWN_KEY, "Adding own address worked."); |
155 | uint8_t message[TOX_MAX_FRIENDREQUEST_LENGTH + 1]; | 155 | |
156 | ck_assert_msg(tox_add_friend(tox1, address, NULL, 0) == TOX_FAERR_NOMESSAGE, "Sending request with no message worked."); | 156 | tox_self_get_address(tox2, address); |
157 | ck_assert_msg(tox_add_friend(tox1, address, message, sizeof(message)) == TOX_FAERR_TOOLONG, | 157 | uint8_t message[TOX_MAX_FRIEND_REQUEST_LENGTH + 1]; |
158 | "TOX_MAX_FRIENDREQUEST_LENGTH is too big."); | 158 | ret = tox_friend_add(tox1, address, NULL, 0, &error); |
159 | ck_assert_msg(ret == UINT32_MAX && error == TOX_ERR_FRIEND_ADD_NULL, "Sending request with no message worked."); | ||
160 | ret = tox_friend_add(tox1, address, message, 0, &error); | ||
161 | ck_assert_msg(ret == UINT32_MAX && error == TOX_ERR_FRIEND_ADD_NO_MESSAGE, "Sending request with no message worked."); | ||
162 | ret = tox_friend_add(tox1, address, message, sizeof(message), &error); | ||
163 | ck_assert_msg(ret == UINT32_MAX && error == TOX_ERR_FRIEND_ADD_TOO_LONG, | ||
164 | "TOX_MAX_FRIEND_REQUEST_LENGTH is too big."); | ||
159 | 165 | ||
160 | address[0]++; | 166 | address[0]++; |
161 | ck_assert_msg(tox_add_friend(tox1, address, (uint8_t *)"m", 1) == TOX_FAERR_BADCHECKSUM, | 167 | ret = tox_friend_add(tox1, address, (uint8_t *)"m", 1, &error); |
168 | ck_assert_msg(ret == UINT32_MAX && error == TOX_ERR_FRIEND_ADD_BAD_CHECKSUM, | ||
162 | "Adding address with bad checksum worked."); | 169 | "Adding address with bad checksum worked."); |
163 | 170 | ||
164 | tox_get_address(tox2, address); | 171 | tox_self_get_address(tox2, address); |
165 | ck_assert_msg(tox_add_friend(tox1, address, message, TOX_MAX_FRIENDREQUEST_LENGTH) == 0, "Failed to add friend."); | 172 | ret = tox_friend_add(tox1, address, message, TOX_MAX_FRIEND_REQUEST_LENGTH, &error); |
166 | ck_assert_msg(tox_add_friend(tox1, address, message, TOX_MAX_FRIENDREQUEST_LENGTH) == TOX_FAERR_ALREADYSENT, | 173 | ck_assert_msg(ret == 0 && error == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend."); |
167 | "Adding friend twice worked."); | 174 | ret = tox_friend_add(tox1, address, message, TOX_MAX_FRIEND_REQUEST_LENGTH, &error); |
175 | ck_assert_msg(ret == UINT32_MAX && error == TOX_ERR_FRIEND_ADD_ALREADY_SENT, "Adding friend twice worked."); | ||
168 | 176 | ||
169 | uint8_t name[TOX_MAX_NAME_LENGTH]; | 177 | uint8_t name[TOX_MAX_NAME_LENGTH]; |
170 | int i; | 178 | int i; |
@@ -173,22 +181,23 @@ START_TEST(test_one) | |||
173 | name[i] = rand(); | 181 | name[i] = rand(); |
174 | } | 182 | } |
175 | 183 | ||
176 | tox_set_name(tox1, name, sizeof(name)); | 184 | tox_self_set_name(tox1, name, sizeof(name), 0); |
177 | ck_assert_msg(tox_get_self_name_size(tox1) == sizeof(name), "Can't set name of TOX_MAX_NAME_LENGTH"); | 185 | ck_assert_msg(tox_self_get_name_size(tox1) == sizeof(name), "Can't set name of TOX_MAX_NAME_LENGTH"); |
178 | 186 | ||
179 | size_t save_size = tox_size(tox1); | 187 | size_t save_size = tox_save_size(tox1); |
180 | uint8_t data[save_size]; | 188 | uint8_t data[save_size]; |
181 | tox_save(tox1, data); | 189 | tox_save(tox1, data); |
182 | 190 | ||
183 | tox_kill(tox2); | 191 | tox_kill(tox2); |
184 | tox2 = tox_new(0); | 192 | TOX_ERR_NEW err_n; |
185 | ck_assert_msg(tox_load(tox2, data, save_size) == 0, "Load failed"); | 193 | |
194 | tox2 = tox_new(0, data, save_size, &err_n); | ||
195 | ck_assert_msg(err_n == TOX_ERR_NEW_OK, "Load failed"); | ||
186 | 196 | ||
187 | size_t length = tox_get_self_name_size(tox2); | 197 | ck_assert_msg(tox_self_get_name_size(tox2) == sizeof name, "Wrong name size."); |
188 | ck_assert_msg(tox_get_self_name_size(tox2) == sizeof name, "Wrong name size."); | ||
189 | 198 | ||
190 | uint8_t new_name[TOX_MAX_NAME_LENGTH] = { 0 }; | 199 | uint8_t new_name[TOX_MAX_NAME_LENGTH] = { 0 }; |
191 | ck_assert_msg(tox_get_self_name(tox2, new_name) == TOX_MAX_NAME_LENGTH, "Wrong name length"); | 200 | tox_self_get_name(tox2, new_name); |
192 | ck_assert_msg(memcmp(name, new_name, TOX_MAX_NAME_LENGTH) == 0, "Wrong name"); | 201 | ck_assert_msg(memcmp(name, new_name, TOX_MAX_NAME_LENGTH) == 0, "Wrong name"); |
193 | 202 | ||
194 | tox_kill(tox1); | 203 | tox_kill(tox1); |
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c index 3139c844..59730edf 100644 --- a/auto_tests/toxav_basic_test.c +++ b/auto_tests/toxav_basic_test.c | |||
@@ -55,10 +55,10 @@ typedef struct _Status { | |||
55 | /* My default settings */ | 55 | /* My default settings */ |
56 | static ToxAvCSettings muhcaps; | 56 | static ToxAvCSettings muhcaps; |
57 | 57 | ||
58 | void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata) | 58 | void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata) |
59 | { | 59 | { |
60 | if (length == 7 && memcmp("gentoo", data, 7) == 0) { | 60 | if (length == 7 && memcmp("gentoo", data, 7) == 0) { |
61 | tox_add_friend_norequest(m, public_key); | 61 | tox_friend_add_norequest(m, public_key, 0); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
@@ -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_do(bootstrap_node); tox_do(Alice); tox_do(Bob); \ | 235 | tox_iteration(bootstrap_node); tox_iteration(Alice); tox_iteration(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");\ |
@@ -250,33 +250,34 @@ if (status_control.Alice.status == Ended && status_control.Bob.status == Ended) | |||
250 | START_TEST(test_AV_flows) | 250 | START_TEST(test_AV_flows) |
251 | { | 251 | { |
252 | long long unsigned int cur_time = time(NULL); | 252 | long long unsigned int cur_time = time(NULL); |
253 | Tox *bootstrap_node = tox_new(0); | 253 | Tox *bootstrap_node = tox_new(0, 0, 0, 0); |
254 | Tox *Alice = tox_new(0); | 254 | Tox *Alice = tox_new(0, 0, 0, 0); |
255 | Tox *Bob = tox_new(0); | 255 | Tox *Bob = tox_new(0, 0, 0, 0); |
256 | 256 | ||
257 | ck_assert_msg(bootstrap_node || Alice || Bob, "Failed to create 3 tox instances"); | 257 | ck_assert_msg(bootstrap_node || Alice || Bob, "Failed to create 3 tox instances"); |
258 | 258 | ||
259 | uint32_t to_compare = 974536; | 259 | uint32_t to_compare = 974536; |
260 | tox_callback_friend_request(Alice, accept_friend_request, &to_compare); | 260 | tox_callback_friend_request(Alice, accept_friend_request, &to_compare); |
261 | uint8_t address[TOX_FRIEND_ADDRESS_SIZE]; | 261 | uint8_t address[TOX_ADDRESS_SIZE]; |
262 | tox_get_address(Alice, address); | 262 | tox_self_get_address(Alice, address); |
263 | int test = tox_add_friend(Bob, address, (uint8_t *)"gentoo", 7); | 263 | uint32_t test = tox_friend_add(Bob, address, (uint8_t *)"gentoo", 7, 0); |
264 | 264 | ||
265 | ck_assert_msg(test == 0, "Failed to add friend error code: %i", test); | 265 | ck_assert_msg(test == 0, "Failed to add friend error code: %i", test); |
266 | 266 | ||
267 | uint8_t off = 1; | 267 | uint8_t off = 1; |
268 | 268 | ||
269 | while (1) { | 269 | while (1) { |
270 | tox_do(bootstrap_node); | 270 | tox_iteration(bootstrap_node); |
271 | tox_do(Alice); | 271 | tox_iteration(Alice); |
272 | tox_do(Bob); | 272 | tox_iteration(Bob); |
273 | 273 | ||
274 | if (tox_isconnected(bootstrap_node) && tox_isconnected(Alice) && tox_isconnected(Bob) && off) { | 274 | if (tox_get_connection_status(bootstrap_node) && tox_get_connection_status(Alice) && tox_get_connection_status(Bob) |
275 | && off) { | ||
275 | printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); | 276 | printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); |
276 | off = 0; | 277 | off = 0; |
277 | } | 278 | } |
278 | 279 | ||
279 | if (tox_get_friend_connection_status(Alice, 0) == 1 && tox_get_friend_connection_status(Bob, 0) == 1) | 280 | if (tox_friend_get_connection_status(Alice, 0, 0) && tox_friend_get_connection_status(Bob, 0, 0)) |
280 | break; | 281 | break; |
281 | 282 | ||
282 | c_sleep(20); | 283 | c_sleep(20); |
@@ -483,9 +484,9 @@ START_TEST(test_AV_flows) | |||
483 | int running = 1; | 484 | int running = 1; |
484 | 485 | ||
485 | while (running) { | 486 | while (running) { |
486 | tox_do(bootstrap_node); | 487 | tox_iteration(bootstrap_node); |
487 | tox_do(Alice); | 488 | tox_iteration(Alice); |
488 | tox_do(Bob); | 489 | tox_iteration(Bob); |
489 | 490 | ||
490 | switch ( step ) { | 491 | switch ( step ) { |
491 | case 0: /* Alice */ | 492 | case 0: /* Alice */ |
@@ -524,9 +525,9 @@ START_TEST(test_AV_flows) | |||
524 | int running = 1; | 525 | int running = 1; |
525 | 526 | ||
526 | while (running) { | 527 | while (running) { |
527 | tox_do(bootstrap_node); | 528 | tox_iteration(bootstrap_node); |
528 | tox_do(Alice); | 529 | tox_iteration(Alice); |
529 | tox_do(Bob); | 530 | tox_iteration(Bob); |
530 | 531 | ||
531 | toxav_do(status_control.Alice.av); | 532 | toxav_do(status_control.Alice.av); |
532 | toxav_do(status_control.Bob.av); | 533 | toxav_do(status_control.Bob.av); |
@@ -569,9 +570,9 @@ START_TEST(test_AV_flows) | |||
569 | int running = 1; | 570 | int running = 1; |
570 | 571 | ||
571 | while (running) { | 572 | while (running) { |
572 | tox_do(bootstrap_node); | 573 | tox_iteration(bootstrap_node); |
573 | tox_do(Alice); | 574 | tox_iteration(Alice); |
574 | tox_do(Bob); | 575 | tox_iteration(Bob); |
575 | 576 | ||
576 | toxav_do(status_control.Alice.av); | 577 | toxav_do(status_control.Alice.av); |
577 | 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 99012992..4002c4e7 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -58,10 +58,10 @@ typedef struct _Status { | |||
58 | 58 | ||
59 | Status status_control; | 59 | Status status_control; |
60 | 60 | ||
61 | void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata) | 61 | void accept_friend_request(Tox *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata) |
62 | { | 62 | { |
63 | if (length == 7 && memcmp("gentoo", data, 7) == 0) { | 63 | if (length == 7 && memcmp("gentoo", data, 7) == 0) { |
64 | tox_add_friend_norequest(m, public_key); | 64 | tox_friend_add_norequest(m, public_key, 0); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
@@ -264,12 +264,12 @@ START_TEST(test_AV_three_calls) | |||
264 | // void test_AV_three_calls() | 264 | // void test_AV_three_calls() |
265 | { | 265 | { |
266 | long long unsigned int cur_time = time(NULL); | 266 | long long unsigned int cur_time = time(NULL); |
267 | Tox *bootstrap_node = tox_new(0); | 267 | Tox *bootstrap_node = tox_new(0, 0, 0, 0); |
268 | Tox *caller = tox_new(0); | 268 | Tox *caller = tox_new(0, 0, 0, 0); |
269 | Tox *callees[3] = { | 269 | Tox *callees[3] = { |
270 | tox_new(0), | 270 | tox_new(0, 0, 0, 0), |
271 | tox_new(0), | 271 | tox_new(0, 0, 0, 0), |
272 | tox_new(0), | 272 | tox_new(0, 0, 0, 0), |
273 | }; | 273 | }; |
274 | 274 | ||
275 | 275 | ||
@@ -284,37 +284,37 @@ START_TEST(test_AV_three_calls) | |||
284 | for ( i = 0; i < 3; i ++ ) { | 284 | for ( i = 0; i < 3; i ++ ) { |
285 | uint32_t to_compare = 974536; | 285 | uint32_t to_compare = 974536; |
286 | tox_callback_friend_request(callees[i], accept_friend_request, &to_compare); | 286 | tox_callback_friend_request(callees[i], accept_friend_request, &to_compare); |
287 | uint8_t address[TOX_FRIEND_ADDRESS_SIZE]; | 287 | uint8_t address[TOX_ADDRESS_SIZE]; |
288 | tox_get_address(callees[i], address); | 288 | tox_self_get_address(callees[i], address); |
289 | 289 | ||
290 | int test = tox_add_friend(caller, address, (uint8_t *)"gentoo", 7); | 290 | uint32_t test = tox_friend_add(caller, address, (uint8_t *)"gentoo", 7, 0); |
291 | ck_assert_msg( test == i, "Failed to add friend error code: %i", test); | 291 | ck_assert_msg( test == i, "Failed to add friend error code: %i", test); |
292 | } | 292 | } |
293 | 293 | ||
294 | uint8_t off = 1; | 294 | uint8_t off = 1; |
295 | 295 | ||
296 | while (1) { | 296 | while (1) { |
297 | tox_do(bootstrap_node); | 297 | tox_iteration(bootstrap_node); |
298 | tox_do(caller); | 298 | tox_iteration(caller); |
299 | 299 | ||
300 | for (i = 0; i < 3; i ++) { | 300 | for (i = 0; i < 3; i ++) { |
301 | tox_do(callees[i]); | 301 | tox_iteration(callees[i]); |
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | if (tox_isconnected(bootstrap_node) && | 305 | if (tox_get_connection_status(bootstrap_node) && |
306 | tox_isconnected(caller) && | 306 | tox_get_connection_status(caller) && |
307 | tox_isconnected(callees[0]) && | 307 | tox_get_connection_status(callees[0]) && |
308 | tox_isconnected(callees[1]) && | 308 | tox_get_connection_status(callees[1]) && |
309 | tox_isconnected(callees[2]) && off) { | 309 | tox_get_connection_status(callees[2]) && off) { |
310 | printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); | 310 | printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); |
311 | off = 0; | 311 | off = 0; |
312 | } | 312 | } |
313 | 313 | ||
314 | 314 | ||
315 | if (tox_get_friend_connection_status(caller, 0) == 1 && | 315 | if (tox_friend_get_connection_status(caller, 0, 0) && |
316 | tox_get_friend_connection_status(caller, 1) == 1 && | 316 | tox_friend_get_connection_status(caller, 1, 0) && |
317 | tox_get_friend_connection_status(caller, 2) == 1 ) | 317 | tox_friend_get_connection_status(caller, 2, 0) ) |
318 | break; | 318 | break; |
319 | 319 | ||
320 | c_sleep(20); | 320 | c_sleep(20); |
@@ -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_do(bootstrap_node); | 354 | tox_iteration(bootstrap_node); |
355 | tox_do(caller); | 355 | tox_iteration(caller); |
356 | tox_do(callees[0]); | 356 | tox_iteration(callees[0]); |
357 | tox_do(callees[1]); | 357 | tox_iteration(callees[1]); |
358 | tox_do(callees[2]); | 358 | tox_iteration(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/toxcore/Messenger.c b/toxcore/Messenger.c index 863259ac..22adb088 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -491,21 +491,11 @@ static int send_message_generic(Messenger *m, int32_t friendnumber, const uint8_ | |||
491 | return 0; | 491 | return 0; |
492 | } | 492 | } |
493 | 493 | ||
494 | /* Send a text chat message to an online friend. | ||
495 | * | ||
496 | * return the message id if packet was successfully put into the send queue. | ||
497 | * return 0 if it was not. | ||
498 | */ | ||
499 | int m_sendmessage(Messenger *m, int32_t friendnumber, const uint8_t *message, uint32_t length, uint32_t *message_id) | 494 | int m_sendmessage(Messenger *m, int32_t friendnumber, const uint8_t *message, uint32_t length, uint32_t *message_id) |
500 | { | 495 | { |
501 | return send_message_generic(m, friendnumber, message, length, PACKET_ID_MESSAGE, message_id); | 496 | return send_message_generic(m, friendnumber, message, length, PACKET_ID_MESSAGE, message_id); |
502 | } | 497 | } |
503 | 498 | ||
504 | /* Send an action to an online friend. | ||
505 | * | ||
506 | * return the message id if packet was successfully put into the send queue. | ||
507 | * return 0 if it was not. | ||
508 | */ | ||
509 | int m_sendaction(Messenger *m, int32_t friendnumber, const uint8_t *action, uint32_t length, uint32_t *message_id) | 499 | int m_sendaction(Messenger *m, int32_t friendnumber, const uint8_t *action, uint32_t length, uint32_t *message_id) |
510 | { | 500 | { |
511 | return send_message_generic(m, friendnumber, action, length, PACKET_ID_ACTION, message_id); | 501 | return send_message_generic(m, friendnumber, action, length, PACKET_ID_ACTION, message_id); |