_server.addBuddy()

Availability:

SmartFoxServer PRO 1.6.0

Usage:

_server.addBuddy(buddyName, user)

Description:

Adds a buddy to a user buddy list.
Based on the BuddyList configuration this may immediately add the buddy to the user list or send a buddy request that the target user must respond to.

If mutualAddBuddy is activated both users will be added to their respective buddy lists.

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

Properties:

buddyName   the name of the buddy to add
user   the user (User object), owner of the buddy list

Returns:

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

Example:

// Adds a buddy called Mr.X to the "user" object
_server.addBuddy("Mr.X", user)

See also:

removeBuddy()