Added function to get groupchat type.

This commit is contained in:
irungentoo 2014-11-11 18:01:54 -05:00
parent 3b10a248dc
commit d9f99c15ca
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
4 changed files with 39 additions and 0 deletions

View File

@ -783,6 +783,21 @@ unsigned int group_peernumber_is_ours(const Group_Chats *g_c, int groupnumber, i
return g->peer_number == g->group[peernumber].peer_number; return g->peer_number == g->group[peernumber].peer_number;
} }
/* return the type of groupchat (GROUPCHAT_TYPE_) that groupnumber is.
*
* return -1 on failure.
* return type on success.
*/
int group_get_type(const Group_Chats *g_c, int groupnumber)
{
Group_c *g = get_group_c(g_c, groupnumber);
if (!g)
return -1;
return g->identifier[0];
}
/* Send a group packet to friendcon_id. /* Send a group packet to friendcon_id.
* *
* return 1 on success * return 1 on success

View File

@ -266,6 +266,13 @@ uint32_t count_chatlist(Group_Chats *g_c);
* of out_list will be truncated to list_size. */ * of out_list will be truncated to list_size. */
uint32_t copy_chatlist(Group_Chats *g_c, int32_t *out_list, uint32_t list_size); uint32_t copy_chatlist(Group_Chats *g_c, int32_t *out_list, uint32_t list_size);
/* return the type of groupchat (GROUPCHAT_TYPE_) that groupnumber is.
*
* return -1 on failure.
* return type on success.
*/
int group_get_type(const Group_Chats *g_c, int groupnumber);
/* 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

@ -728,6 +728,16 @@ uint32_t tox_get_chatlist(const Tox *tox, int32_t *out_list, uint32_t list_size)
return copy_chatlist(m->group_chat_object, out_list, list_size); return copy_chatlist(m->group_chat_object, out_list, list_size);
} }
/* return the type of groupchat (TOX_GROUPCHAT_TYPE_) that groupnumber is.
*
* return -1 on failure.
* return type on success.
*/
int tox_group_get_type(const Tox *tox, int groupnumber)
{
const Messenger *m = tox;
return group_get_type(m->group_chat_object, groupnumber);
}
/****************FILE SENDING FUNCTIONS*****************/ /****************FILE SENDING FUNCTIONS*****************/

View File

@ -551,6 +551,13 @@ uint32_t tox_count_chatlist(const Tox *tox);
* of out_list will be truncated to list_size. */ * of out_list will be truncated to list_size. */
uint32_t tox_get_chatlist(const Tox *tox, int32_t *out_list, uint32_t list_size); uint32_t tox_get_chatlist(const Tox *tox, int32_t *out_list, uint32_t list_size);
/* return the type of groupchat (TOX_GROUPCHAT_TYPE_) that groupnumber is.
*
* return -1 on failure.
* return type on success.
*/
int tox_group_get_type(const Tox *tox, int groupnumber);
/****************AVATAR FUNCTIONS*****************/ /****************AVATAR FUNCTIONS*****************/
/* Set the callback function for avatar information. /* Set the callback function for avatar information.