mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge pull request #604 from JFreegman/master
made setfriendname() part of public api
This commit is contained in:
commit
b0149318fa
|
@ -352,13 +352,16 @@ static int m_sendname(Messenger *m, int friendnumber, uint8_t *name, uint16_t le
|
|||
* return 0 if success.
|
||||
* return -1 if failure.
|
||||
*/
|
||||
static int setfriendname(Messenger *m, int friendnumber, uint8_t *name, uint16_t len)
|
||||
int setfriendname(Messenger *m, int friendnumber, uint8_t *name, uint16_t length)
|
||||
{
|
||||
if (friend_not_valid(m, friendnumber))
|
||||
return -1;
|
||||
|
||||
m->friendlist[friendnumber].name_length = len;
|
||||
memcpy(m->friendlist[friendnumber].name, name, len);
|
||||
if (length > MAX_NAME_LENGTH || length == 0)
|
||||
return -1;
|
||||
|
||||
m->friendlist[friendnumber].name_length = length;
|
||||
memcpy(m->friendlist[friendnumber].name, name, length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -246,6 +246,16 @@ uint32_t m_sendmessage_withid(Messenger *m, int friendnumber, uint32_t theid, ui
|
|||
*/
|
||||
int m_sendaction(Messenger *m, int friendnumber, uint8_t *action, uint32_t length);
|
||||
|
||||
/* Set the name and name_length of a friend.
|
||||
* name must be a string of maximum MAX_NAME_LENGTH length.
|
||||
* length must be at least 1 byte.
|
||||
* length is the length of name with the NULL terminator.
|
||||
*
|
||||
* return 0 if success.
|
||||
* return -1 if failure.
|
||||
*/
|
||||
int setfriendname(Messenger *m, int friendnumber, uint8_t *name, uint16_t length);
|
||||
|
||||
/* Set our nickname.
|
||||
* name must be a string of maximum MAX_NAME_LENGTH length.
|
||||
* length must be at least 1 byte.
|
||||
|
|
|
@ -153,6 +153,20 @@ int tox_sendaction(void *tox, int friendnumber, uint8_t *action, uint32_t length
|
|||
return m_sendaction(m, friendnumber, action, length);
|
||||
}
|
||||
|
||||
/* Set friendnumber's nickname.
|
||||
* name must be a string of maximum MAX_NAME_LENGTH length.
|
||||
* length must be at least 1 byte.
|
||||
* length is the length of name with the NULL terminator.
|
||||
*
|
||||
* return 0 if success.
|
||||
* return -1 if failure.
|
||||
*/
|
||||
int tox_setfriendname(void *tox, int friendnumber, uint8_t *name, uint16_t length)
|
||||
{
|
||||
Messenger *m = tox;
|
||||
return setfriendname(m, friendnumber, name, length);
|
||||
}
|
||||
|
||||
/* Set our nickname.
|
||||
* name must be a string of maximum MAX_NAME_LENGTH length.
|
||||
* length must be at least 1 byte.
|
||||
|
|
|
@ -214,6 +214,16 @@ uint32_t tox_sendmessage_withid(Tox *tox, int friendnumber, uint32_t theid, uint
|
|||
*/
|
||||
int tox_sendaction(Tox *tox, int friendnumber, uint8_t *action, uint32_t length);
|
||||
|
||||
/* Set friendnumber's nickname.
|
||||
* name must be a string of maximum MAX_NAME_LENGTH length.
|
||||
* length must be at least 1 byte.
|
||||
* length is the length of name with the NULL terminator.
|
||||
*
|
||||
* return 0 if success.
|
||||
* return -1 if failure.
|
||||
*/
|
||||
int tox_setfriendname(void *tox, int friendnumber, uint8_t *name, uint16_t length);
|
||||
|
||||
/* Set our nickname.
|
||||
* name must be a string of maximum MAX_NAME_LENGTH length.
|
||||
* length must be at least 1 byte.
|
||||
|
|
Loading…
Reference in New Issue
Block a user