diff options
author | irungentoo <irungentoo@gmail.com> | 2013-09-22 14:14:53 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-09-22 14:14:53 -0400 |
commit | 8b5d9dc13e5b5fe66f47701aec57ae7b04345be3 (patch) | |
tree | 80caf6a1cf7729078dee1bb8bb59d9753a0f36e8 /toxcore/tox.c | |
parent | 64150f4bde73f4b4748a3e46664a2930a3635054 (diff) | |
parent | cb68be00b0bb8802da94b877a24e68ee35b5658a (diff) |
Merge branch 'patch-9001' of https://github.com/stal888/ProjectTox-Core into stal888-patch-9001
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r-- | toxcore/tox.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c index 4fba360b..dfafaf20 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. | 268 | size_t tox_count_friendlist(void *tox) |
269 | * return -1 if failure. | 269 | { |
270 | */ | 270 | Messenger *m = tox; |
271 | int 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 -1. | ||
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. */ | ||
279 | size_t tox_copy_friendlist(void *tox, int *out_list, size_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. |