diff options
author | Dubslow <bunslow@gmail.com> | 2015-03-18 14:18:36 -0500 |
---|---|---|
committer | Dubslow <bunslow@gmail.com> | 2015-03-18 14:18:36 -0500 |
commit | 2f65de6fd1a3c83e0754898ab45da006917223ff (patch) | |
tree | f7877eb3190ee468daf1bd072254e01731d21464 | |
parent | ad87dbb470cb9b223c66727ab6ad615f46e73a37 (diff) |
Move get_connection_status to self pseudonamespace, to contrast friend_get_connection_status
-rw-r--r-- | auto_tests/tox_test.c | 4 | ||||
-rw-r--r-- | auto_tests/toxav_basic_test.c | 2 | ||||
-rw-r--r-- | auto_tests/toxav_many_test.c | 10 | ||||
-rw-r--r-- | testing/nTox.c | 2 | ||||
-rw-r--r-- | testing/tox_shell.c | 2 | ||||
-rw-r--r-- | testing/tox_sync.c | 2 | ||||
-rw-r--r-- | toxcore/tox.c | 4 | ||||
-rw-r--r-- | toxcore/tox.h | 14 |
8 files changed, 20 insertions, 20 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 42ba65c7..adf33424 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -359,7 +359,7 @@ START_TEST(test_few_clients) | |||
359 | 359 | ||
360 | uint32_t to_compare = 974536; | 360 | uint32_t to_compare = 974536; |
361 | connected_t1 = 0; | 361 | connected_t1 = 0; |
362 | tox_callback_connection_status(tox1, tox_connection_status, &to_compare); | 362 | tox_callback_self_connection_status(tox1, tox_connection_status, &to_compare); |
363 | tox_callback_friend_request(tox2, accept_friend_request, &to_compare); | 363 | tox_callback_friend_request(tox2, accept_friend_request, &to_compare); |
364 | uint8_t address[TOX_ADDRESS_SIZE]; | 364 | uint8_t address[TOX_ADDRESS_SIZE]; |
365 | tox_self_get_address(tox2, address); | 365 | tox_self_get_address(tox2, address); |
@@ -373,7 +373,7 @@ START_TEST(test_few_clients) | |||
373 | tox_iterate(tox2); | 373 | tox_iterate(tox2); |
374 | tox_iterate(tox3); | 374 | tox_iterate(tox3); |
375 | 375 | ||
376 | if (tox_get_connection_status(tox1) && tox_get_connection_status(tox2) && tox_get_connection_status(tox3)) { | 376 | if (tox_self_get_connection_status(tox1) && tox_self_get_connection_status(tox2) && tox_self_get_connection_status(tox3)) { |
377 | if (off) { | 377 | if (off) { |
378 | printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); | 378 | printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); |
379 | con_time = time(NULL); | 379 | con_time = time(NULL); |
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c index 3f4a3b8d..4f75b9fb 100644 --- a/auto_tests/toxav_basic_test.c +++ b/auto_tests/toxav_basic_test.c | |||
@@ -271,7 +271,7 @@ START_TEST(test_AV_flows) | |||
271 | tox_iterate(Alice); | 271 | tox_iterate(Alice); |
272 | tox_iterate(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_self_get_connection_status(bootstrap_node) && tox_self_get_connection_status(Alice) && tox_self_get_connection_status(Bob) |
275 | && off) { | 275 | && off) { |
276 | 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); |
277 | off = 0; | 277 | off = 0; |
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index f22043e1..4287118f 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -302,11 +302,11 @@ START_TEST(test_AV_three_calls) | |||
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | if (tox_get_connection_status(bootstrap_node) && | 305 | if (tox_self_get_connection_status(bootstrap_node) && |
306 | tox_get_connection_status(caller) && | 306 | tox_self_get_connection_status(caller) && |
307 | tox_get_connection_status(callees[0]) && | 307 | tox_self_get_connection_status(callees[0]) && |
308 | tox_get_connection_status(callees[1]) && | 308 | tox_self_get_connection_status(callees[1]) && |
309 | tox_get_connection_status(callees[2]) && off) { | 309 | tox_self_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 | } |
diff --git a/testing/nTox.c b/testing/nTox.c index 9e114ba5..a6ee9dde 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -1313,7 +1313,7 @@ int main(int argc, char *argv[]) | |||
1313 | 1313 | ||
1314 | while (1) { | 1314 | while (1) { |
1315 | if (on == 0) { | 1315 | if (on == 0) { |
1316 | if (tox_get_connection_status(m)) { | 1316 | if (tox_self_get_connection_status(m)) { |
1317 | new_lines("[i] connected to DHT"); | 1317 | new_lines("[i] connected to DHT"); |
1318 | on = 1; | 1318 | on = 1; |
1319 | } else { | 1319 | } else { |
diff --git a/testing/tox_shell.c b/testing/tox_shell.c index 38fe6364..37865b1c 100644 --- a/testing/tox_shell.c +++ b/testing/tox_shell.c | |||
@@ -136,7 +136,7 @@ int main(int argc, char *argv[]) | |||
136 | uint8_t notconnected = 1; | 136 | uint8_t notconnected = 1; |
137 | 137 | ||
138 | while (1) { | 138 | while (1) { |
139 | if (tox_get_connection_status(tox) && notconnected) { | 139 | if (tox_self_get_connection_status(tox) && notconnected) { |
140 | printf("\nDHT connected.\n"); | 140 | printf("\nDHT connected.\n"); |
141 | notconnected = 0; | 141 | notconnected = 0; |
142 | } | 142 | } |
diff --git a/testing/tox_sync.c b/testing/tox_sync.c index 8c693793..d60b091e 100644 --- a/testing/tox_sync.c +++ b/testing/tox_sync.c | |||
@@ -276,7 +276,7 @@ int main(int argc, char *argv[]) | |||
276 | uint8_t notconnected = 1; | 276 | uint8_t notconnected = 1; |
277 | 277 | ||
278 | while (1) { | 278 | while (1) { |
279 | if (tox_get_connection_status(tox) && notconnected) { | 279 | if (tox_self_get_connection_status(tox) && notconnected) { |
280 | printf("\nDHT connected.\n"); | 280 | printf("\nDHT connected.\n"); |
281 | notconnected = 0; | 281 | notconnected = 0; |
282 | } | 282 | } |
diff --git a/toxcore/tox.c b/toxcore/tox.c index f245993f..5d06bd0f 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -319,7 +319,7 @@ bool tox_add_tcp_relay(Tox *tox, const char *address, uint16_t port, const uint8 | |||
319 | return 1; | 319 | return 1; |
320 | } | 320 | } |
321 | 321 | ||
322 | TOX_CONNECTION tox_get_connection_status(const Tox *tox) | 322 | TOX_CONNECTION tox_self_get_connection_status(const Tox *tox) |
323 | { | 323 | { |
324 | const Messenger *m = tox; | 324 | const Messenger *m = tox; |
325 | 325 | ||
@@ -335,7 +335,7 @@ TOX_CONNECTION tox_get_connection_status(const Tox *tox) | |||
335 | } | 335 | } |
336 | 336 | ||
337 | 337 | ||
338 | void tox_callback_connection_status(Tox *tox, tox_connection_status_cb *function, void *user_data) | 338 | void tox_callback_self_connection_status(Tox *tox, tox_self_connection_status_cb *function, void *user_data) |
339 | { | 339 | { |
340 | Messenger *m = tox; | 340 | Messenger *m = tox; |
341 | m_callback_core_connection(m, function, user_data); | 341 | m_callback_core_connection(m, function, user_data); |
diff --git a/toxcore/tox.h b/toxcore/tox.h index 373786ae..778089b7 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -626,20 +626,20 @@ typedef enum TOX_CONNECTION { | |||
626 | 626 | ||
627 | /** | 627 | /** |
628 | * Return whether we are connected to the DHT. The return value is equal to the | 628 | * Return whether we are connected to the DHT. The return value is equal to the |
629 | * last value received through the `connection_status` callback. | 629 | * last value received through the `self_connection_status` callback. |
630 | */ | 630 | */ |
631 | TOX_CONNECTION tox_get_connection_status(const Tox *tox); | 631 | TOX_CONNECTION tox_self_get_connection_status(const Tox *tox); |
632 | 632 | ||
633 | /** | 633 | /** |
634 | * The function type for the `connection_status` callback. | 634 | * The function type for the `self_connection_status` callback. |
635 | * | 635 | * |
636 | * @param connection_status Equal to the return value of | 636 | * @param connection_status Equal to the return value of |
637 | * tox_get_connection_status. | 637 | * tox_self_get_connection_status. |
638 | */ | 638 | */ |
639 | typedef void tox_connection_status_cb(Tox *tox, TOX_CONNECTION connection_status, void *user_data); | 639 | typedef void tox_self_connection_status_cb(Tox *tox, TOX_CONNECTION connection_status, void *user_data); |
640 | 640 | ||
641 | /** | 641 | /** |
642 | * Set the callback for the `connection_status` event. Pass NULL to unset. | 642 | * Set the callback for the `self_connection_status` event. Pass NULL to unset. |
643 | * | 643 | * |
644 | * This event is triggered whenever there is a change in the DHT connection | 644 | * This event is triggered whenever there is a change in the DHT connection |
645 | * state. When disconnected, a client may choose to call tox_bootstrap again, to | 645 | * state. When disconnected, a client may choose to call tox_bootstrap again, to |
@@ -649,7 +649,7 @@ typedef void tox_connection_status_cb(Tox *tox, TOX_CONNECTION connection_status | |||
649 | * | 649 | * |
650 | * TODO: how long should a client wait before bootstrapping again? | 650 | * TODO: how long should a client wait before bootstrapping again? |
651 | */ | 651 | */ |
652 | void tox_callback_connection_status(Tox *tox, tox_connection_status_cb *function, void *user_data); | 652 | void tox_callback_self_connection_status(Tox *tox, tox_self_connection_status_cb *function, void *user_data); |
653 | 653 | ||
654 | 654 | ||
655 | /** | 655 | /** |