mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
made setfriendname part of public api
This commit is contained in:
parent
59170c7d01
commit
c4702985a5
@ -352,13 +352,13 @@ static int m_sendname(Messenger *m, int friendnumber, uint8_t *name, uint16_t le
|
|||||||
* 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, uint16_t len)
|
int setfriendname(Messenger *m, int friendnumber, uint8_t *name, uint16_t length)
|
||||||
{
|
{
|
||||||
if (friend_not_valid(m, friendnumber))
|
if (friend_not_valid(m, friendnumber))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
m->friendlist[friendnumber].name_length = len;
|
m->friendlist[friendnumber].name_length = length;
|
||||||
memcpy(m->friendlist[friendnumber].name, name, len);
|
memcpy(m->friendlist[friendnumber].name, name, length);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +246,13 @@ 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);
|
int m_sendaction(Messenger *m, int friendnumber, uint8_t *action, uint32_t length);
|
||||||
|
|
||||||
|
/* Set the name and name_length of a friend.
|
||||||
|
*
|
||||||
|
* return 0 if success.
|
||||||
|
* return -1 if failure.
|
||||||
|
*/
|
||||||
|
int setfriendname(Messenger *m, int friendnumber, uint8_t *name, uint16_t length);
|
||||||
|
|
||||||
/* Set our nickname.
|
/* Set our nickname.
|
||||||
* name must be a string of maximum MAX_NAME_LENGTH length.
|
* name must be a string of maximum MAX_NAME_LENGTH length.
|
||||||
* length must be at least 1 byte.
|
* 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);
|
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.
|
/* Set our nickname.
|
||||||
* name must be a string of maximum MAX_NAME_LENGTH length.
|
* name must be a string of maximum MAX_NAME_LENGTH length.
|
||||||
* length must be at least 1 byte.
|
* 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);
|
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.
|
/* Set our nickname.
|
||||||
* name must be a string of maximum MAX_NAME_LENGTH length.
|
* name must be a string of maximum MAX_NAME_LENGTH length.
|
||||||
* length must be at least 1 byte.
|
* length must be at least 1 byte.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user