mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
commit
7722d420e7
|
@ -346,17 +346,18 @@ static int m_sendname(Messenger *m, int friendnumber, uint8_t *name, uint16_t le
|
||||||
return write_cryptpacket_id(m, friendnumber, PACKET_ID_NICKNAME, name, length);
|
return write_cryptpacket_id(m, friendnumber, PACKET_ID_NICKNAME, name, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the name of a friend.
|
/* Set the name and name_length of a friend.
|
||||||
*
|
*
|
||||||
* return 0 if success.
|
* return 0 if success.
|
||||||
* return -1 if failure.
|
* return -1 if failure.
|
||||||
*/
|
*/
|
||||||
static int setfriendname(Messenger *m, int friendnumber, uint8_t *name)
|
static int setfriendname(Messenger *m, int friendnumber, uint8_t *name, uint16_t len)
|
||||||
{
|
{
|
||||||
if (friend_not_valid(m, friendnumber))
|
if (friend_not_valid(m, friendnumber))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memcpy(m->friendlist[friendnumber].name, name, MAX_NAME_LENGTH);
|
m->friendlist[friendnumber].name_length = len;
|
||||||
|
memcpy(m->friendlist[friendnumber].name, name, len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,7 +1028,7 @@ int Messenger_load(Messenger *m, uint8_t *data, uint32_t length)
|
||||||
for (i = 0; i < num; ++i) {
|
for (i = 0; i < num; ++i) {
|
||||||
if (temp[i].status >= 3) {
|
if (temp[i].status >= 3) {
|
||||||
int fnum = m_addfriend_norequest(m, temp[i].client_id);
|
int fnum = m_addfriend_norequest(m, temp[i].client_id);
|
||||||
setfriendname(m, fnum, temp[i].name);
|
setfriendname(m, fnum, temp[i].name, temp[i].name_length);
|
||||||
/* set_friend_statusmessage(fnum, temp[i].statusmessage, temp[i].statusmessage_length); */
|
/* set_friend_statusmessage(fnum, temp[i].statusmessage, temp[i].statusmessage_length); */
|
||||||
} else if (temp[i].status != 0) {
|
} else if (temp[i].status != 0) {
|
||||||
/* TODO: This is not a good way to do this. */
|
/* TODO: This is not a good way to do this. */
|
||||||
|
|
|
@ -184,7 +184,7 @@ uint16_t tox_getselfname(void *tox, uint8_t *name, uint16_t nlen)
|
||||||
/* Get name of friendnumber and put it in name.
|
/* Get name of friendnumber and put it in name.
|
||||||
* name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
|
* name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
|
||||||
*
|
*
|
||||||
* return 0 if success.
|
* return length of name (with the NULL terminator) if success.
|
||||||
* return -1 if failure.
|
* return -1 if failure.
|
||||||
*/
|
*/
|
||||||
int tox_getname(void *tox, int friendnumber, uint8_t *name)
|
int tox_getname(void *tox, int friendnumber, uint8_t *name)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user