mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Some modifications to the last pull request.
This commit is contained in:
parent
1bfc3792fd
commit
b808b0de2c
|
@ -1182,12 +1182,12 @@ int group_title_send(const Group_Chats *g_c, int groupnumber, const uint8_t *tit
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get group title from groupnumber and put it in title.
|
/* 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.
|
* title needs to be a valid memory location with a max_length size of at least MAX_NAME_LENGTH (128) bytes.
|
||||||
*
|
*
|
||||||
* return length of title if success.
|
* return length of copied title if success.
|
||||||
* return -1 if failure.
|
* return -1 if failure.
|
||||||
*/
|
*/
|
||||||
int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title)
|
int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title, uint32_t max_length)
|
||||||
{
|
{
|
||||||
Group_c *g = get_group_c(g_c, groupnumber);
|
Group_c *g = get_group_c(g_c, groupnumber);
|
||||||
|
|
||||||
|
@ -1197,8 +1197,11 @@ int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title)
|
||||||
if (g->title_len == 0 || g->title_len > MAX_NAME_LENGTH)
|
if (g->title_len == 0 || g->title_len > MAX_NAME_LENGTH)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memcpy(title, g->title, g->title_len);
|
if (max_length > g->title_len)
|
||||||
return g->title_len;
|
max_length = g->title_len;
|
||||||
|
|
||||||
|
memcpy(title, g->title, max_length);
|
||||||
|
return max_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -235,12 +235,12 @@ int group_title_send(const Group_Chats *g_c, int groupnumber, const uint8_t *tit
|
||||||
|
|
||||||
|
|
||||||
/* Get group title from groupnumber and put it in title.
|
/* 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.
|
* title needs to be a valid memory location with a max_length size of at least MAX_NAME_LENGTH (128) bytes.
|
||||||
*
|
*
|
||||||
* return length of title if success.
|
* return length of copied title if success.
|
||||||
* return -1 if failure.
|
* return -1 if failure.
|
||||||
*/
|
*/
|
||||||
int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title);
|
int group_title_get(const Group_Chats *g_c, int groupnumber, uint8_t *title, uint32_t max_length);
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
|
@ -694,15 +694,15 @@ int tox_group_set_title(Tox *tox, int groupnumber, const uint8_t *title, uint8_t
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get group title from groupnumber and put it in title.
|
/* 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.
|
* title needs to be a valid memory location with a max_length size of at least MAX_NAME_LENGTH (128) bytes.
|
||||||
*
|
*
|
||||||
* return length of title if success.
|
* return length of copied title if success.
|
||||||
* return -1 if failure.
|
* return -1 if failure.
|
||||||
*/
|
*/
|
||||||
int tox_group_get_title(Tox *tox, int groupnumber, uint8_t *title)
|
int tox_group_get_title(Tox *tox, int groupnumber, uint8_t *title, uint32_t max_length)
|
||||||
{
|
{
|
||||||
Messenger *m = tox;
|
Messenger *m = tox;
|
||||||
return group_title_get(m->group_chat_object, groupnumber, title);
|
return group_title_get(m->group_chat_object, groupnumber, title, max_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the current peernumber corresponds to ours.
|
/* Check if the current peernumber corresponds to ours.
|
||||||
|
|
|
@ -529,12 +529,12 @@ 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.
|
/* 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.
|
* title needs to be a valid memory location with a max_length size of at least MAX_NAME_LENGTH (128) bytes.
|
||||||
*
|
*
|
||||||
* return length of title if success.
|
* return length of copied title if success.
|
||||||
* return -1 if failure.
|
* return -1 if failure.
|
||||||
*/
|
*/
|
||||||
int tox_group_get_title(Tox *tox, int groupnumber, uint8_t *title);
|
int tox_group_get_title(Tox *tox, int groupnumber, uint8_t *title, uint32_t max_length);
|
||||||
|
|
||||||
/* Check if the current peernumber corresponds to ours.
|
/* Check if the current peernumber corresponds to ours.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user