_server.requestAddBuddyPermission()

Availability:

SmartFoxServer PRO 1.6.0

Usage:

_server.requestAddBuddyPermission(sender, targetUserName, optionalMessage)

Description:

Requests permission for adding the target user in the sender buddy list. This is already done by default if the mode of the buddy list is set to ADVANCED. In most of the cases you wouldn't need to call this method in your extension.

It could be used to implement an off-line permission request system, where the system stores the requests for off-line users in a database and sends the requests as soon as the target user logs in.

For a complete overview of the Buddy List 2.0 system introduced in version 1.6 check this document.

Properties:

sender   the requester
targetUserName   the name of the target user
optionalMessage   an optional text message for the request. Use null if you don't need it.

Returns:

nothing, it will fire and onBuddyPermissionRequest event on the client side.

Example:

/*
* Ask permission to another user to be added in my buddy list
* The "me" variable is a User object
*/

_server.requestAddBuddyPermission(me, "Mr.X", "Hello, please allow me to add you to my buddy list.")

See also:

addBuddy(), removeBuddy()