diff options
author | zugz (tox) <mbays+tox@sdf.org> | 2018-09-09 23:27:39 +0200 |
---|---|---|
committer | zugz (tox) <mbays+tox@sdf.org> | 2018-11-29 21:52:23 +0100 |
commit | 9770880e975a09635a461c46c8fcc193bce57004 (patch) | |
tree | 8c7aa3c3ee8d264a3fdd97d8a5c49caa25f5da0b /toxcore/friend_connection.c | |
parent | caca350f435cf6a2a3778c64771dafdb7dde8b7a (diff) |
Implement conferences saving
* add global friend_connection status callback, used for group rejoining
* stop leaving groups on killing tox
Diffstat (limited to 'toxcore/friend_connection.c')
-rw-r--r-- | toxcore/friend_connection.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c index 9c805b45..69533def 100644 --- a/toxcore/friend_connection.c +++ b/toxcore/friend_connection.c | |||
@@ -85,6 +85,9 @@ struct Friend_Connections { | |||
85 | fr_request_cb *fr_request_callback; | 85 | fr_request_cb *fr_request_callback; |
86 | void *fr_request_object; | 86 | void *fr_request_object; |
87 | 87 | ||
88 | global_status_cb *global_status_callback; | ||
89 | void *global_status_callback_object; | ||
90 | |||
88 | uint64_t last_lan_discovery; | 91 | uint64_t last_lan_discovery; |
89 | uint16_t next_lan_port; | 92 | uint16_t next_lan_port; |
90 | 93 | ||
@@ -401,9 +404,11 @@ static int handle_status(void *object, int number, uint8_t status, void *userdat | |||
401 | } | 404 | } |
402 | 405 | ||
403 | if (status_changed) { | 406 | if (status_changed) { |
404 | unsigned int i; | 407 | if (fr_c->global_status_callback) { |
408 | fr_c->global_status_callback(fr_c->global_status_callback_object, number, status, userdata); | ||
409 | } | ||
405 | 410 | ||
406 | for (i = 0; i < MAX_FRIEND_CONNECTION_CALLBACKS; ++i) { | 411 | for (unsigned i = 0; i < MAX_FRIEND_CONNECTION_CALLBACKS; ++i) { |
407 | if (friend_con->callbacks[i].status_callback) { | 412 | if (friend_con->callbacks[i].status_callback) { |
408 | friend_con->callbacks[i].status_callback( | 413 | friend_con->callbacks[i].status_callback( |
409 | friend_con->callbacks[i].callback_object, | 414 | friend_con->callbacks[i].callback_object, |
@@ -716,6 +721,13 @@ int friend_connection_callbacks(Friend_Connections *fr_c, int friendcon_id, unsi | |||
716 | return 0; | 721 | return 0; |
717 | } | 722 | } |
718 | 723 | ||
724 | /* Set global status callback for friend connections. */ | ||
725 | void set_global_status_callback(Friend_Connections *fr_c, global_status_cb *global_status_callback, void *object) | ||
726 | { | ||
727 | fr_c->global_status_callback = global_status_callback; | ||
728 | fr_c->global_status_callback_object = object; | ||
729 | } | ||
730 | |||
719 | /* return the crypt_connection_id for the connection. | 731 | /* return the crypt_connection_id for the connection. |
720 | * | 732 | * |
721 | * return crypt_connection_id on success. | 733 | * return crypt_connection_id on success. |