summaryrefslogtreecommitdiff
path: root/toxcore/tox.c
diff options
context:
space:
mode:
authorzugz (tox) <mbays+tox@sdf.org>2018-08-02 19:23:34 +0100
committerzugz (tox) <mbays+tox@sdf.org>2018-08-12 22:46:06 +0200
commitd56ab5aaff5fab7ac707a5c914d3701f43eb2ba3 (patch)
tree161278ec297d281d1c39f1f337fe67eb52865c4c /toxcore/tox.c
parent4ed6e5999226f9061f546108c5be72fe6f21a775 (diff)
add callback for successful connection to a conference
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r--toxcore/tox.c16
1 files changed, 16 insertions, 0 deletions
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 {
91 tox_file_recv_cb *file_recv_callback; 91 tox_file_recv_cb *file_recv_callback;
92 tox_file_recv_chunk_cb *file_recv_chunk_callback; 92 tox_file_recv_chunk_cb *file_recv_chunk_callback;
93 tox_conference_invite_cb *conference_invite_callback; 93 tox_conference_invite_cb *conference_invite_callback;
94 tox_conference_connected_cb *conference_connected_callback;
94 tox_conference_message_cb *conference_message_callback; 95 tox_conference_message_cb *conference_message_callback;
95 tox_conference_title_cb *conference_title_callback; 96 tox_conference_title_cb *conference_title_callback;
96 tox_conference_peer_name_cb *conference_peer_name_callback; 97 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,
247 } 248 }
248} 249}
249 250
251static void tox_conference_connected_handler(Messenger *m, uint32_t conference_number, void *user_data)
252{
253 struct Tox_Userdata *tox_data = (struct Tox_Userdata *)user_data;
254
255 if (tox_data->tox->conference_connected_callback != nullptr) {
256 tox_data->tox->conference_connected_callback(tox_data->tox, conference_number, tox_data->user_data);
257 }
258}
259
250static void tox_conference_message_handler(Messenger *m, uint32_t conference_number, uint32_t peer_number, int type, 260static void tox_conference_message_handler(Messenger *m, uint32_t conference_number, uint32_t peer_number, int type,
251 const uint8_t *message, size_t length, void *user_data) 261 const uint8_t *message, size_t length, void *user_data)
252{ 262{
@@ -488,6 +498,7 @@ Tox *tox_new(const struct Tox_Options *options, Tox_Err_New *error)
488 callback_file_sendrequest(m, tox_file_recv_handler); 498 callback_file_sendrequest(m, tox_file_recv_handler);
489 callback_file_data(m, tox_file_recv_chunk_handler); 499 callback_file_data(m, tox_file_recv_chunk_handler);
490 g_callback_group_invite((Group_Chats *)m->conferences_object, tox_conference_invite_handler); 500 g_callback_group_invite((Group_Chats *)m->conferences_object, tox_conference_invite_handler);
501 g_callback_group_connected((Group_Chats *)m->conferences_object, tox_conference_connected_handler);
491 g_callback_group_message((Group_Chats *)m->conferences_object, tox_conference_message_handler); 502 g_callback_group_message((Group_Chats *)m->conferences_object, tox_conference_message_handler);
492 g_callback_group_title((Group_Chats *)m->conferences_object, tox_conference_title_handler); 503 g_callback_group_title((Group_Chats *)m->conferences_object, tox_conference_title_handler);
493 g_callback_peer_name((Group_Chats *)m->conferences_object, tox_conference_peer_name_handler); 504 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
1386 tox->conference_invite_callback = callback; 1397 tox->conference_invite_callback = callback;
1387} 1398}
1388 1399
1400void tox_callback_conference_connected(Tox *tox, tox_conference_connected_cb *callback)
1401{
1402 tox->conference_connected_callback = callback;
1403}
1404
1389void tox_callback_conference_message(Tox *tox, tox_conference_message_cb *callback) 1405void tox_callback_conference_message(Tox *tox, tox_conference_message_cb *callback)
1390{ 1406{
1391 tox->conference_message_callback = callback; 1407 tox->conference_message_callback = callback;