From 2f65de6fd1a3c83e0754898ab45da006917223ff Mon Sep 17 00:00:00 2001 From: Dubslow Date: Wed, 18 Mar 2015 14:18:36 -0500 Subject: Move get_connection_status to self pseudonamespace, to contrast friend_get_connection_status --- auto_tests/tox_test.c | 4 ++-- auto_tests/toxav_basic_test.c | 2 +- auto_tests/toxav_many_test.c | 10 +++++----- testing/nTox.c | 2 +- testing/tox_shell.c | 2 +- testing/tox_sync.c | 2 +- toxcore/tox.c | 4 ++-- 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) uint32_t to_compare = 974536; connected_t1 = 0; - tox_callback_connection_status(tox1, tox_connection_status, &to_compare); + tox_callback_self_connection_status(tox1, tox_connection_status, &to_compare); tox_callback_friend_request(tox2, accept_friend_request, &to_compare); uint8_t address[TOX_ADDRESS_SIZE]; tox_self_get_address(tox2, address); @@ -373,7 +373,7 @@ START_TEST(test_few_clients) tox_iterate(tox2); tox_iterate(tox3); - if (tox_get_connection_status(tox1) && tox_get_connection_status(tox2) && tox_get_connection_status(tox3)) { + if (tox_self_get_connection_status(tox1) && tox_self_get_connection_status(tox2) && tox_self_get_connection_status(tox3)) { if (off) { printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); 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) tox_iterate(Alice); tox_iterate(Bob); - if (tox_get_connection_status(bootstrap_node) && tox_get_connection_status(Alice) && tox_get_connection_status(Bob) + if (tox_self_get_connection_status(bootstrap_node) && tox_self_get_connection_status(Alice) && tox_self_get_connection_status(Bob) && off) { printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); 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) } - if (tox_get_connection_status(bootstrap_node) && - tox_get_connection_status(caller) && - tox_get_connection_status(callees[0]) && - tox_get_connection_status(callees[1]) && - tox_get_connection_status(callees[2]) && off) { + if (tox_self_get_connection_status(bootstrap_node) && + tox_self_get_connection_status(caller) && + tox_self_get_connection_status(callees[0]) && + tox_self_get_connection_status(callees[1]) && + tox_self_get_connection_status(callees[2]) && off) { printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); off = 0; } 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[]) while (1) { if (on == 0) { - if (tox_get_connection_status(m)) { + if (tox_self_get_connection_status(m)) { new_lines("[i] connected to DHT"); on = 1; } 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[]) uint8_t notconnected = 1; while (1) { - if (tox_get_connection_status(tox) && notconnected) { + if (tox_self_get_connection_status(tox) && notconnected) { printf("\nDHT connected.\n"); notconnected = 0; } 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[]) uint8_t notconnected = 1; while (1) { - if (tox_get_connection_status(tox) && notconnected) { + if (tox_self_get_connection_status(tox) && notconnected) { printf("\nDHT connected.\n"); notconnected = 0; } 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 return 1; } -TOX_CONNECTION tox_get_connection_status(const Tox *tox) +TOX_CONNECTION tox_self_get_connection_status(const Tox *tox) { const Messenger *m = tox; @@ -335,7 +335,7 @@ TOX_CONNECTION tox_get_connection_status(const Tox *tox) } -void tox_callback_connection_status(Tox *tox, tox_connection_status_cb *function, void *user_data) +void tox_callback_self_connection_status(Tox *tox, tox_self_connection_status_cb *function, void *user_data) { Messenger *m = tox; 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 { /** * Return whether we are connected to the DHT. The return value is equal to the - * last value received through the `connection_status` callback. + * last value received through the `self_connection_status` callback. */ -TOX_CONNECTION tox_get_connection_status(const Tox *tox); +TOX_CONNECTION tox_self_get_connection_status(const Tox *tox); /** - * The function type for the `connection_status` callback. + * The function type for the `self_connection_status` callback. * * @param connection_status Equal to the return value of - * tox_get_connection_status. + * tox_self_get_connection_status. */ -typedef void tox_connection_status_cb(Tox *tox, TOX_CONNECTION connection_status, void *user_data); +typedef void tox_self_connection_status_cb(Tox *tox, TOX_CONNECTION connection_status, void *user_data); /** - * Set the callback for the `connection_status` event. Pass NULL to unset. + * Set the callback for the `self_connection_status` event. Pass NULL to unset. * * This event is triggered whenever there is a change in the DHT connection * 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 * * TODO: how long should a client wait before bootstrapping again? */ -void tox_callback_connection_status(Tox *tox, tox_connection_status_cb *function, void *user_data); +void tox_callback_self_connection_status(Tox *tox, tox_self_connection_status_cb *function, void *user_data); /** -- cgit v1.2.3