summaryrefslogtreecommitdiff
path: root/toxcore/group.h
diff options
context:
space:
mode:
authorzugz (tox) <mbays+tox@sdf.org>2018-10-31 19:21:00 +0100
committeriphydf <iphydf@users.noreply.github.com>2019-01-05 15:01:29 +0000
commita122ee9e01a1614366350537e1b49299eb355c1d (patch)
tree71dac74aa73f90bce66b8cc9299408e0c4e52c42 /toxcore/group.h
parentebf3a82de8709270cb46266f1c06a3c1cee0649d (diff)
Expose offline conference peers in API
Diffstat (limited to 'toxcore/group.h')
-rw-r--r--toxcore/group.h44
1 files changed, 26 insertions, 18 deletions
diff --git a/toxcore/group.h b/toxcore/group.h
index 148de0c1..83015273 100644
--- a/toxcore/group.h
+++ b/toxcore/group.h
@@ -238,38 +238,51 @@ void g_callback_peer_list_changed(Group_Chats *g_c, peer_list_changed_cb *functi
238 */ 238 */
239int add_groupchat(Group_Chats *g_c, uint8_t type); 239int add_groupchat(Group_Chats *g_c, uint8_t type);
240 240
241/* Delete a groupchat from the chats array. 241/* Delete a groupchat from the chats array, informing the group first as
242 * appropriate.
242 * 243 *
243 * return 0 on success. 244 * return 0 on success.
244 * return -1 if groupnumber is invalid. 245 * return -1 if groupnumber is invalid.
245 */ 246 */
246int del_groupchat(Group_Chats *g_c, uint32_t groupnumber); 247int del_groupchat(Group_Chats *g_c, uint32_t groupnumber, bool leave_permanently);
247 248
248/* Copy the public key of peernumber who is in groupnumber to pk. 249/* Copy the public key of (frozen, if frozen is true) peernumber who is in
250 * groupnumber to pk.
249 * pk must be CRYPTO_PUBLIC_KEY_SIZE long. 251 * pk must be CRYPTO_PUBLIC_KEY_SIZE long.
250 * 252 *
251 * return 0 on success 253 * return 0 on success
252 * return -1 if groupnumber is invalid. 254 * return -1 if groupnumber is invalid.
253 * return -2 if peernumber is invalid. 255 * return -2 if peernumber is invalid.
254 */ 256 */
255int group_peer_pubkey(const Group_Chats *g_c, uint32_t groupnumber, int peernumber, uint8_t *pk); 257int group_peer_pubkey(const Group_Chats *g_c, uint32_t groupnumber, int peernumber, uint8_t *pk, bool frozen);
256 258
257/* 259/*
258 * Return the size of peernumber's name. 260 * Return the size of (frozen, if frozen is true) peernumber's name.
259 * 261 *
260 * return -1 if groupnumber is invalid. 262 * return -1 if groupnumber is invalid.
261 * return -2 if peernumber is invalid. 263 * return -2 if peernumber is invalid.
262 */ 264 */
263int group_peername_size(const Group_Chats *g_c, uint32_t groupnumber, int32_t peernumber); 265int group_peername_size(const Group_Chats *g_c, uint32_t groupnumber, int32_t peernumber, bool frozen);
264 266
265/* Copy the name of peernumber who is in groupnumber to name. 267/* Copy the name of (frozen, if frozen is true) peernumber who is in
268 * groupnumber to name.
266 * name must be at least MAX_NAME_LENGTH long. 269 * name must be at least MAX_NAME_LENGTH long.
267 * 270 *
268 * return length of name if success 271 * return length of name if success
269 * return -1 if groupnumber is invalid. 272 * return -1 if groupnumber is invalid.
270 * return -2 if peernumber is invalid. 273 * return -2 if peernumber is invalid.
271 */ 274 */
272int group_peername(const Group_Chats *g_c, uint32_t groupnumber, int peernumber, uint8_t *name); 275int group_peername(const Group_Chats *g_c, uint32_t groupnumber, int peernumber, uint8_t *name, bool frozen);
276
277/* Copy last active timestamp of frozen peernumber who is in groupnumber to
278 * last_active.
279 *
280 * return 0 on success.
281 * return -1 if groupnumber is invalid.
282 * return -2 if peernumber is invalid.
283 */
284int group_frozen_last_active(const Group_Chats *g_c, uint32_t groupnumber, int peernumber,
285 uint64_t *last_active);
273 286
274/* invite friendnumber to groupnumber 287/* invite friendnumber to groupnumber
275 * 288 *
@@ -306,12 +319,6 @@ int group_message_send(const Group_Chats *g_c, uint32_t groupnumber, const uint8
306 */ 319 */
307int group_action_send(const Group_Chats *g_c, uint32_t groupnumber, const uint8_t *action, uint16_t length); 320int group_action_send(const Group_Chats *g_c, uint32_t groupnumber, const uint8_t *action, uint16_t length);
308 321
309/* send message to announce leaving group
310 * return true on success
311 * return false on failure
312 */
313bool group_leave(const Group_Chats *g_c, uint32_t groupnumber);
314
315/* set the group's title, limited to MAX_NAME_LENGTH 322/* set the group's title, limited to MAX_NAME_LENGTH
316 * return 0 on success 323 * return 0 on success
317 * return -1 if groupnumber is invalid. 324 * return -1 if groupnumber is invalid.
@@ -336,10 +343,11 @@ int group_title_get_size(const Group_Chats *g_c, uint32_t groupnumber);
336 */ 343 */
337int group_title_get(const Group_Chats *g_c, uint32_t groupnumber, uint8_t *title); 344int group_title_get(const Group_Chats *g_c, uint32_t groupnumber, uint8_t *title);
338 345
339/* Return the number of peers in the group chat on success. 346/* Return the number of (frozen, if frozen is true) peers in the group chat on
347 * success.
340 * return -1 if groupnumber is invalid. 348 * return -1 if groupnumber is invalid.
341 */ 349 */
342int group_number_peers(const Group_Chats *g_c, uint32_t groupnumber); 350int group_number_peers(const Group_Chats *g_c, uint32_t groupnumber, bool frozen);
343 351
344/* return 1 if the peernumber corresponds to ours. 352/* return 1 if the peernumber corresponds to ours.
345 * return 0 if the peernumber is not ours. 353 * return 0 if the peernumber is not ours.
@@ -349,7 +357,7 @@ int group_number_peers(const Group_Chats *g_c, uint32_t groupnumber);
349 */ 357 */
350int group_peernumber_is_ours(const Group_Chats *g_c, uint32_t groupnumber, int peernumber); 358int group_peernumber_is_ours(const Group_Chats *g_c, uint32_t groupnumber, int peernumber);
351 359
352/* List all the peers in the group chat. 360/* List all the (frozen, if frozen is true) peers in the group chat.
353 * 361 *
354 * Copies the names of the peers to the name[length][MAX_NAME_LENGTH] array. 362 * Copies the names of the peers to the name[length][MAX_NAME_LENGTH] array.
355 * 363 *
@@ -360,7 +368,7 @@ int group_peernumber_is_ours(const Group_Chats *g_c, uint32_t groupnumber, int p
360 * return -1 on failure. 368 * return -1 on failure.
361 */ 369 */
362int group_names(const Group_Chats *g_c, uint32_t groupnumber, uint8_t names[][MAX_NAME_LENGTH], uint16_t lengths[], 370int group_names(const Group_Chats *g_c, uint32_t groupnumber, uint8_t names[][MAX_NAME_LENGTH], uint16_t lengths[],
363 uint16_t length); 371 uint16_t length, bool frozen);
364 372
365/* Set handlers for custom lossy packets. */ 373/* Set handlers for custom lossy packets. */
366void group_lossy_packet_registerhandler(Group_Chats *g_c, uint8_t byte, lossy_packet_cb *function); 374void group_lossy_packet_registerhandler(Group_Chats *g_c, uint8_t byte, lossy_packet_cb *function);