diff options
author | Coren[m] <Break@Ocean> | 2013-09-13 09:06:52 +0200 |
---|---|---|
committer | Coren[m] <Break@Ocean> | 2013-09-13 09:06:52 +0200 |
commit | e67a11dd04edce395c2d0ac403241ed08a875737 (patch) | |
tree | 4a0c069cfe501c6395ee25a4050fd6068acd2f29 /toxcore/tox.c | |
parent | ec3734fc5d0f0d81a5220cf16ad6ef8eb5f06c7c (diff) | |
parent | f8b979a92a8c316c49bed28e158a468a2f74346c (diff) |
Merge remote-tracking branch 'upstream/master' into Integration
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r-- | toxcore/tox.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c index 3eb80d22..68b1e6e9 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -366,6 +366,81 @@ void tox_callback_connectionstatus(void *tox, void (*function)(Messenger *tox, i | |||
366 | m_callback_connectionstatus(m, function, userdata); | 366 | m_callback_connectionstatus(m, function, userdata); |
367 | } | 367 | } |
368 | 368 | ||
369 | /**********GROUP CHAT FUNCTIONS: WARNING WILL BREAK A LOT************/ | ||
370 | |||
371 | /* Set the callback for group invites. | ||
372 | * | ||
373 | * Function(Tox *tox, int friendnumber, uint8_t *group_public_key, void *userdata) | ||
374 | */ | ||
375 | void tox_callback_group_invite(void *tox, void (*function)(Messenger *tox, int, uint8_t *, void *), void *userdata) | ||
376 | { | ||
377 | Messenger *m = tox; | ||
378 | m_callback_group_invite(m, function, userdata); | ||
379 | } | ||
380 | /* Set the callback for group messages. | ||
381 | * | ||
382 | * Function(Tox *tox, int groupnumber, uint8_t * message, uint16_t length, void *userdata) | ||
383 | */ | ||
384 | void tox_callback_group_message(void *tox, void (*function)(Messenger *tox, int, uint8_t *, uint16_t, void *), | ||
385 | void *userdata) | ||
386 | { | ||
387 | Messenger *m = tox; | ||
388 | m_callback_group_message(m, function, userdata); | ||
389 | } | ||
390 | /* Creates a new groupchat and puts it in the chats array. | ||
391 | * | ||
392 | * return group number on success. | ||
393 | * return -1 on failure. | ||
394 | */ | ||
395 | int tox_add_groupchat(void *tox) | ||
396 | { | ||
397 | Messenger *m = tox; | ||
398 | return add_groupchat(m); | ||
399 | } | ||
400 | /* Delete a groupchat from the chats array. | ||
401 | * | ||
402 | * return 0 on success. | ||
403 | * return -1 if failure. | ||
404 | */ | ||
405 | int tox_del_groupchat(void *tox, int groupnumber) | ||
406 | { | ||
407 | Messenger *m = tox; | ||
408 | return del_groupchat(m, groupnumber); | ||
409 | } | ||
410 | /* invite friendnumber to groupnumber | ||
411 | * return 0 on success | ||
412 | * return -1 on failure | ||
413 | */ | ||
414 | int tox_invite_friend(void *tox, int friendnumber, int groupnumber) | ||
415 | { | ||
416 | Messenger *m = tox; | ||
417 | return invite_friend(m, friendnumber, groupnumber); | ||
418 | } | ||
419 | /* Join a group (you need to have been invited first.) | ||
420 | * | ||
421 | * returns group number on success | ||
422 | * returns -1 on failure. | ||
423 | */ | ||
424 | int tox_join_groupchat(void *tox, int friendnumber, uint8_t *friend_group_public_key) | ||
425 | { | ||
426 | Messenger *m = tox; | ||
427 | return join_groupchat(m, friendnumber, friend_group_public_key); | ||
428 | } | ||
429 | |||
430 | /* send a group message | ||
431 | * return 0 on success | ||
432 | * return -1 on failure | ||
433 | */ | ||
434 | int tox_group_message_send(void *tox, int groupnumber, uint8_t *message, uint32_t length) | ||
435 | { | ||
436 | Messenger *m = tox; | ||
437 | return group_message_send(m, groupnumber, message, length); | ||
438 | } | ||
439 | |||
440 | |||
441 | |||
442 | /******************END OF GROUP CHAT FUNCTIONS************************/ | ||
443 | |||
369 | /* Use these functions to bootstrap the client. | 444 | /* Use these functions to bootstrap the client. |
370 | * Sends a get nodes request to the given node with ip port and public_key. | 445 | * Sends a get nodes request to the given node with ip port and public_key. |
371 | */ | 446 | */ |