uint32_t group_client_names(Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[], uint16_t length) { uint32_t i; for (i = 0; i < chat->numpeers && i < length; ++i) { lengths[i] = group_peername(chat, i, names[i]); } return i; }
/* List all the peers in the group chat. * * Copies the names of the peers to the name[length][MAX_NAME_LENGTH] array. * * Copies the lengths of the names to lengths[length] * * returns the number of peers on success. * * return -1 on failure. */ int group_names(const Group_Chats *g_c, int groupnumber, uint8_t names[][MAX_NAME_LENGTH], uint16_t lengths[], uint16_t length) { Group_c *g = get_group_c(g_c, groupnumber); if (!g) return -1; int i; for (i = 0; i < g->numpeers && i < length; ++i) { lengths[i] = group_peername(g_c, groupnumber, i, names[i]); } return i; }
/* Copy the name of peernumber who is in groupnumber to name. * name must be at least MAX_NICK_BYTES long. * * return length of name if success * return -1 if failure */ int tox_group_peername(const Tox *tox, int groupnumber, int peernumber, uint8_t *name) { const Messenger *m = tox; return group_peername(m->group_chat_object, groupnumber, peernumber, name); }