tox_count_chatlist() now works.

This commit is contained in:
irungentoo 2014-10-13 20:27:13 -04:00
parent cfa142f471
commit b41eadf695
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
3 changed files with 13 additions and 8 deletions

View File

@ -1630,21 +1630,21 @@ void kill_groupchats(Group_Chats *g_c)
/* Return the number of chats in the instance m.
* You should use this to determine how much memory to allocate
* for copy_chatlist. */
/*
uint32_t count_chatlist(const Messenger *m)
* for copy_chatlist.
*/
uint32_t count_chatlist(Group_Chats *g_c)
{
uint32_t ret = 0;
uint32_t i;
for (i = 0; i < m->numchats; i++) {
if (m->chats[i]) {
for (i = 0; i < g_c->num_chats; i++) {
if (g_c->chats[i].status != GROUPCHAT_STATUS_NONE) {
ret++;
}
}
return ret;
}*/
}
/* Copy a list of valid chat IDs into the array out_list.
* If out_list is NULL, returns 0.

View File

@ -203,6 +203,12 @@ int group_number_peers(const Group_Chats *g_c, int groupnumber);
int group_names(const Group_Chats *g_c, int groupnumber, uint8_t names[][MAX_NAME_LENGTH], uint16_t lengths[],
uint16_t length);
/* Return the number of chats in the instance m.
* You should use this to determine how much memory to allocate
* for copy_chatlist.
*/
uint32_t count_chatlist(Group_Chats *g_c);
/* Send current name (set in messenger) to all online groups.
*/
void send_name_all_groups(Group_Chats *g_c);

View File

@ -704,8 +704,7 @@ int tox_group_get_names(const Tox *tox, int groupnumber, uint8_t names[][TOX_MAX
uint32_t tox_count_chatlist(const Tox *tox)
{
const Messenger *m = tox;
//return count_chatlist(m);
return 0;
return count_chatlist(m->group_chat_object);
}
/* Copy a list of valid chat IDs into the array out_list.