Merge branch 'JFreegman-groupnames'

This commit is contained in:
irungentoo 2014-10-05 10:42:05 -04:00
commit 83e31c1ad5
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 28 additions and 2 deletions

View File

@ -704,6 +704,33 @@ int group_peername(const Group_Chats *g_c, int groupnumber, int peernumber, uint
return g->group[peernumber].nick_len;
}
/* 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;
}
/* Return the number of peers in the group chat on success.
* return -1 on failure
*/

View File

@ -695,8 +695,7 @@ int tox_group_get_names(const Tox *tox, int groupnumber, uint8_t names[][TOX_MAX
uint16_t length)
{
const Messenger *m = tox;
//return group_names(m, groupnumber, names, lengths, length);
return -1;
return group_names(m->group_chat_object, groupnumber, names, lengths, length);
}
/* Return the number of chats in the instance m.