summaryrefslogtreecommitdiff
path: root/toxcore/tox.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r--toxcore/tox.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c
index 4fba360b..fa53e693 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -262,16 +262,24 @@ void tox_set_sends_receipts(void *tox, int friendnumber, int yesno)
262 m_set_sends_receipts(m, friendnumber, yesno); 262 m_set_sends_receipts(m, friendnumber, yesno);
263} 263}
264 264
265/* Allocate and return a list of valid friend id's. List must be freed by the 265/* Return the number of friends in the instance m.
266 * caller. 266 * You should use this to determine how much memory to allocate
267 * 267 * for copy_friendlist. */
268 * retun 0 if success. 268uint32_t tox_count_friendlist(void *tox)
269 * return -1 if failure. 269{
270 */ 270 Messenger *m = tox;
271int tox_get_friendlist(void *tox, int **out_list, uint32_t *out_list_length) 271 return count_friendlist(m);
272}
273
274/* Copy a list of valid friend IDs into the array out_list.
275 * If out_list is NULL, returns 0.
276 * Otherwise, returns the number of elements copied.
277 * If the array was too small, the contents
278 * of out_list will be truncated to list_size. */
279uint32_t tox_copy_friendlist(void *tox, int *out_list, uint32_t list_size)
272{ 280{
273 Messenger *m = tox; 281 Messenger *m = tox;
274 return get_friendlist(m, out_list, out_list_length); 282 return copy_friendlist(m, out_list, list_size);
275} 283}
276 284
277/* Set the function that will be executed when a friend request is received. 285/* Set the function that will be executed when a friend request is received.