From d56ab5aaff5fab7ac707a5c914d3701f43eb2ba3 Mon Sep 17 00:00:00 2001 From: "zugz (tox)" Date: Thu, 2 Aug 2018 19:23:34 +0100 Subject: add callback for successful connection to a conference --- toxcore/tox.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'toxcore/tox.c') diff --git a/toxcore/tox.c b/toxcore/tox.c index f7bdba79..2ccbef82 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c @@ -91,6 +91,7 @@ struct Tox { tox_file_recv_cb *file_recv_callback; tox_file_recv_chunk_cb *file_recv_chunk_callback; tox_conference_invite_cb *conference_invite_callback; + tox_conference_connected_cb *conference_connected_callback; tox_conference_message_cb *conference_message_callback; tox_conference_title_cb *conference_title_callback; tox_conference_peer_name_cb *conference_peer_name_callback; @@ -247,6 +248,15 @@ static void tox_conference_invite_handler(Messenger *m, uint32_t friend_number, } } +static void tox_conference_connected_handler(Messenger *m, uint32_t conference_number, void *user_data) +{ + struct Tox_Userdata *tox_data = (struct Tox_Userdata *)user_data; + + if (tox_data->tox->conference_connected_callback != nullptr) { + tox_data->tox->conference_connected_callback(tox_data->tox, conference_number, tox_data->user_data); + } +} + static void tox_conference_message_handler(Messenger *m, uint32_t conference_number, uint32_t peer_number, int type, const uint8_t *message, size_t length, void *user_data) { @@ -488,6 +498,7 @@ Tox *tox_new(const struct Tox_Options *options, Tox_Err_New *error) callback_file_sendrequest(m, tox_file_recv_handler); callback_file_data(m, tox_file_recv_chunk_handler); g_callback_group_invite((Group_Chats *)m->conferences_object, tox_conference_invite_handler); + g_callback_group_connected((Group_Chats *)m->conferences_object, tox_conference_connected_handler); g_callback_group_message((Group_Chats *)m->conferences_object, tox_conference_message_handler); g_callback_group_title((Group_Chats *)m->conferences_object, tox_conference_title_handler); g_callback_peer_name((Group_Chats *)m->conferences_object, tox_conference_peer_name_handler); @@ -1386,6 +1397,11 @@ void tox_callback_conference_invite(Tox *tox, tox_conference_invite_cb *callback tox->conference_invite_callback = callback; } +void tox_callback_conference_connected(Tox *tox, tox_conference_connected_cb *callback) +{ + tox->conference_connected_callback = callback; +} + void tox_callback_conference_message(Tox *tox, tox_conference_message_cb *callback) { tox->conference_message_callback = callback; -- cgit v1.2.3