mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Move get_connection_status to self pseudonamespace, to contrast friend_get_connection_status
This commit is contained in:
parent
ad87dbb470
commit
2f65de6fd1
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user