mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge branch 'get_group_title' of https://github.com/JFreegman/toxcore
This commit is contained in:
commit
1bfc3792fd
|
@ -1181,6 +1181,26 @@ int group_title_send(const Group_Chats *g_c, int groupnumber, const uint8_t *tit
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get group title from groupnumber and put it in title.
|
||||||
|
* title needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
|
||||||
|
*
|
||||||
|
* return length of title if success.
|
||||||
|
* return -1 if failure.
|
||||||
|
*/
|
||||||
|
int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title)
|
||||||
|
{
|
||||||
|
Group_c *g = get_group_c(g_c, groupnumber);
|
||||||
|
|
||||||
|
if (!g)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (g->title_len == 0 || g->title_len > MAX_NAME_LENGTH)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
memcpy(title, g->title, g->title_len);
|
||||||
|
return g->title_len;
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_friend_invite_packet(Messenger *m, int32_t friendnumber, const uint8_t *data, uint16_t length)
|
static void handle_friend_invite_packet(Messenger *m, int32_t friendnumber, const uint8_t *data, uint16_t length)
|
||||||
{
|
{
|
||||||
Group_Chats *g_c = m->group_chat_object;
|
Group_Chats *g_c = m->group_chat_object;
|
||||||
|
|
|
@ -233,6 +233,15 @@ int group_action_send(const Group_Chats *g_c, int groupnumber, const uint8_t *ac
|
||||||
*/
|
*/
|
||||||
int group_title_send(const Group_Chats *g_c, int groupnumber, const uint8_t *title, uint8_t title_len);
|
int group_title_send(const Group_Chats *g_c, int groupnumber, const uint8_t *title, uint8_t title_len);
|
||||||
|
|
||||||
|
|
||||||
|
/* Get group title from groupnumber and put it in title.
|
||||||
|
* title needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
|
||||||
|
*
|
||||||
|
* return length of title if success.
|
||||||
|
* return -1 if failure.
|
||||||
|
*/
|
||||||
|
int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title);
|
||||||
|
|
||||||
/* Return the number of peers in the group chat on success.
|
/* Return the number of peers in the group chat on success.
|
||||||
* return -1 on failure
|
* return -1 on failure
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -693,6 +693,18 @@ int tox_group_set_title(Tox *tox, int groupnumber, const uint8_t *title, uint8_t
|
||||||
return group_title_send(m->group_chat_object, groupnumber, title, length);
|
return group_title_send(m->group_chat_object, groupnumber, title, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get group title from groupnumber and put it in title.
|
||||||
|
* title needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
|
||||||
|
*
|
||||||
|
* return length of title if success.
|
||||||
|
* return -1 if failure.
|
||||||
|
*/
|
||||||
|
int tox_group_get_title(Tox *tox, int groupnumber, uint8_t *title)
|
||||||
|
{
|
||||||
|
Messenger *m = tox;
|
||||||
|
return group_title_get(m->group_chat_object, groupnumber, title);
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if the current peernumber corresponds to ours.
|
/* Check if the current peernumber corresponds to ours.
|
||||||
*
|
*
|
||||||
* return 1 if the peernumber corresponds to ours.
|
* return 1 if the peernumber corresponds to ours.
|
||||||
|
|
|
@ -528,6 +528,14 @@ int tox_group_action_send(Tox *tox, int groupnumber, const uint8_t *action, uint
|
||||||
*/
|
*/
|
||||||
int tox_group_set_title(Tox *tox, int groupnumber, const uint8_t *title, uint8_t length);
|
int tox_group_set_title(Tox *tox, int groupnumber, const uint8_t *title, uint8_t length);
|
||||||
|
|
||||||
|
/* Get group title from groupnumber and put it in title.
|
||||||
|
* title needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
|
||||||
|
*
|
||||||
|
* return length of title if success.
|
||||||
|
* return -1 if failure.
|
||||||
|
*/
|
||||||
|
int tox_group_get_title(Tox *tox, int groupnumber, uint8_t *title);
|
||||||
|
|
||||||
/* Check if the current peernumber corresponds to ours.
|
/* Check if the current peernumber corresponds to ours.
|
||||||
*
|
*
|
||||||
* return 1 if the peernumber corresponds to ours.
|
* return 1 if the peernumber corresponds to ours.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user