friend_add


Description:

public uint32 friend_add (uint8[] address, string message, out ErrFriendAdd error = null)

Add a friend to the friend list and send a friend request.

A friend request message must be at least 1 byte long and at most MAX_FRIEND_REQUEST_LENGTH.

Friend numbers are unique identifiers used in all functions that operate on friends. Once added, a friend number is stable for the lifetime of the Tox object. After saving the state and reloading it, the friend numbers may not be the same as before. Deleting a friend creates a gap in the friend number set, which is filled by the next adding of a friend. Any pattern in friend numbers should not be relied on.

If more than INT32_MAX friends are added, this function causes undefined behaviour.

Parameters:

address

The address of the friend (returned by Tox.self_get_address of the friend you wish to add) it must be ADDRESS_SIZE bytes.

message

The message that will be sent along with the friend request.

Returns:

the friend number on success, an unspecified value on failure.