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. /* Return the number of chats in the instance m.
* You should use this to determine how much memory to allocate * You should use this to determine how much memory to allocate
* for copy_chatlist. */ * for copy_chatlist.
/* */
uint32_t count_chatlist(const Messenger *m) uint32_t count_chatlist(Group_Chats *g_c)
{ {
uint32_t ret = 0; uint32_t ret = 0;
uint32_t i; uint32_t i;
for (i = 0; i < m->numchats; i++) { for (i = 0; i < g_c->num_chats; i++) {
if (m->chats[i]) { if (g_c->chats[i].status != GROUPCHAT_STATUS_NONE) {
ret++; ret++;
} }
} }
return ret; return ret;
}*/ }
/* Copy a list of valid chat IDs into the array out_list. /* Copy a list of valid chat IDs into the array out_list.
* If out_list is NULL, returns 0. * 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[], int group_names(const Group_Chats *g_c, int groupnumber, uint8_t names[][MAX_NAME_LENGTH], uint16_t lengths[],
uint16_t length); 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. /* Send current name (set in messenger) to all online groups.
*/ */
void send_name_all_groups(Group_Chats *g_c); 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) uint32_t tox_count_chatlist(const Tox *tox)
{ {
const Messenger *m = tox; const Messenger *m = tox;
//return count_chatlist(m); return count_chatlist(m->group_chat_object);
return 0;
} }
/* Copy a list of valid chat IDs into the array out_list. /* Copy a list of valid chat IDs into the array out_list.