mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge branch 'one_more_rename' of https://github.com/dubslow/toxcore into new_api
This commit is contained in:
commit
45cf8a744c
@ -364,7 +364,7 @@ START_TEST(test_few_clients)
|
|||||||
|
|
||||||
uint32_t to_compare = 974536;
|
uint32_t to_compare = 974536;
|
||||||
connected_t1 = 0;
|
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);
|
tox_callback_friend_request(tox2, accept_friend_request, &to_compare);
|
||||||
uint8_t address[TOX_ADDRESS_SIZE];
|
uint8_t address[TOX_ADDRESS_SIZE];
|
||||||
tox_self_get_address(tox2, address);
|
tox_self_get_address(tox2, address);
|
||||||
@ -378,7 +378,8 @@ START_TEST(test_few_clients)
|
|||||||
tox_iterate(tox2);
|
tox_iterate(tox2);
|
||||||
tox_iterate(tox3);
|
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) {
|
if (off) {
|
||||||
printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time);
|
printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time);
|
||||||
con_time = time(NULL);
|
con_time = time(NULL);
|
||||||
|
@ -271,7 +271,8 @@ START_TEST(test_AV_flows)
|
|||||||
tox_iterate(Alice);
|
tox_iterate(Alice);
|
||||||
tox_iterate(Bob);
|
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) {
|
&& off) {
|
||||||
printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time);
|
printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time);
|
||||||
off = 0;
|
off = 0;
|
||||||
|
@ -302,11 +302,11 @@ START_TEST(test_AV_three_calls)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (tox_get_connection_status(bootstrap_node) &&
|
if (tox_self_get_connection_status(bootstrap_node) &&
|
||||||
tox_get_connection_status(caller) &&
|
tox_self_get_connection_status(caller) &&
|
||||||
tox_get_connection_status(callees[0]) &&
|
tox_self_get_connection_status(callees[0]) &&
|
||||||
tox_get_connection_status(callees[1]) &&
|
tox_self_get_connection_status(callees[1]) &&
|
||||||
tox_get_connection_status(callees[2]) && off) {
|
tox_self_get_connection_status(callees[2]) && off) {
|
||||||
printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time);
|
printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time);
|
||||||
off = 0;
|
off = 0;
|
||||||
}
|
}
|
||||||
|
@ -1331,7 +1331,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (on == 0) {
|
if (on == 0) {
|
||||||
if (tox_get_connection_status(m)) {
|
if (tox_self_get_connection_status(m)) {
|
||||||
new_lines("[i] connected to DHT");
|
new_lines("[i] connected to DHT");
|
||||||
on = 1;
|
on = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
|
|||||||
uint8_t notconnected = 1;
|
uint8_t notconnected = 1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (tox_get_connection_status(tox) && notconnected) {
|
if (tox_self_get_connection_status(tox) && notconnected) {
|
||||||
printf("\nDHT connected.\n");
|
printf("\nDHT connected.\n");
|
||||||
notconnected = 0;
|
notconnected = 0;
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ int main(int argc, char *argv[])
|
|||||||
uint8_t notconnected = 1;
|
uint8_t notconnected = 1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (tox_get_connection_status(tox) && notconnected) {
|
if (tox_self_get_connection_status(tox) && notconnected) {
|
||||||
printf("\nDHT connected.\n");
|
printf("\nDHT connected.\n");
|
||||||
notconnected = 0;
|
notconnected = 0;
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ bool tox_add_tcp_relay(Tox *tox, const char *address, uint16_t port, const uint8
|
|||||||
return 1;
|
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;
|
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;
|
Messenger *m = tox;
|
||||||
m_callback_core_connection(m, function, user_data);
|
m_callback_core_connection(m, function, user_data);
|
||||||
|
@ -642,20 +642,20 @@ typedef enum TOX_CONNECTION {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether we are connected to the DHT. The return value is equal to the
|
* 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
|
* @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
|
* 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
|
* state. When disconnected, a client may choose to call tox_bootstrap again, to
|
||||||
@ -665,7 +665,7 @@ typedef void tox_connection_status_cb(Tox *tox, TOX_CONNECTION connection_status
|
|||||||
*
|
*
|
||||||
* TODO: how long should a client wait before bootstrapping again?
|
* 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…
x
Reference in New Issue
Block a user