SFSBuddyManager

Manages the client-side Buddy List System.


This manager keeps the list of Buddies updated and tracks their state and Buddy Variables. It also provides utility methods to set the properties of the User inside the Buddy List of other clients.

Members

(readonly) buddyList :Array.<SFSBuddy>

List of SFSBuddy objects representing all the Buddies of the current User.
Type:

(readonly) buddyStates :Array.<string>

List of strings representing the available custom Buddy states.

The custom states are received by the client upon initialization of the Buddy List System. They can be configured using the SmartFoxServer Administration Tool.

Type:
  • Array.<string>
See
  • SFSBuddy#getState

(readonly) isInited :boolean

Indicates whether the client-side Buddy List System is initialized.

Buddy List System requires initilization in order to retrieve the client's persistent Buddy List data and enable interaction with Buddies. Use the InitBuddyListRequest to initialize the client-side Buddy List System.

Type:
  • boolean

(readonly) myDisplayName :string

Nickname of the current User in the Buddy List System (if set).

If the nickname is not set, null is returned.

The nickname of the User in the Buddy List System is handled by means of the ReservedBuddyVariables.BV_NICKNAME reserved Buddy Variable; it can be changed using the dedicated SetBuddyVariablesRequest.

Type:
  • string

(readonly) myNickname :string

Nickname of the current User in the Buddy List System (if set).

If the nickname is not set, null is returned.

The nickname of the User in the Buddy List System is handled by means of the ReservedBuddyVariables.BV_NICKNAME reserved Buddy Variable; it can be changed using the dedicated SetBuddyVariablesRequest.

Type:
  • string

(readonly) myOnlineState :boolean

Online/offline state of the current User in the Buddy List System.

If true, the User is reported as online in the Buddy Lists of other Users having it as a Buddy.

The online state of the User in the Buddy List System is handled by means of the ReservedBuddyVariables.BV_ONLINE reserved Buddy Variable; it can be changed using the dedicated GoOnlineRequest.

Type:
  • boolean

(readonly) myState :string

Custom state of the current User in the Buddy List System (if set).

Examples of custom states are Available, Busy, Be right back, etc. If the custom state is not set, null is returned.

The custom state of the User in the Buddy List System is handled by means of the ReservedBuddyVariables.BV_STATE reserved Buddy Variable; it can be changed using the dedicated SetBuddyVariablesRequest.

Type:
  • string

(readonly) offlineBuddies :Array.<SFSBuddy>

List of SFSBuddy objects representing all the offline Buddies of the current User.
Type:

(readonly) onlineBuddies :Array.<SFSBuddy>

List of SFSBuddy objects representing all the online Buddies of the current User.
Type:

Methods

containsBuddy(name) → {boolean}

Indicates whether a Buddy exists in the client Buddy List.
Parameters:
NameTypeDescription
namestringThe name of the Buddy whose presence in the Buddy List should be checked.
Returns:
true if the specified Buddy is found in the Buddy List.
Type: 
boolean

getBuddyById(id) → {SFSBuddy}

Retrieves a SFSBuddy object by its id.
Parameters:
NameTypeDescription
idnumberThe id of the Buddy to be found.
Returns:
The object representing the Buddy, or null if no Buddy with the passed id can be found in the Buddy List.
Type: 
SFSBuddy

getBuddyByName(name) → {SFSBuddy}

Retrieves a SFSBuddy object by its name.
Parameters:
NameTypeDescription
namestringThe name of the Buddy to be found.
Returns:
The object representing the Buddy, or null if no Buddy with the passed name can be found in the Buddy List.
Type: 
SFSBuddy

getBuddyByNickname(nickname) → {SFSBuddy}

Retrieves a SFSBuddy object by its nickname (if set).
Parameters:
NameTypeDescription
nicknamestringThe nickname of the Buddy to be found.
Returns:
The object representing the Buddy, or null if no Buddy with the passed nickname can be found in the Buddy List.
Type: 
SFSBuddy

getMyVariable(varName) → {SFSBuddyVariable}

Retrieves a Buddy Variable belonging to the current User in the Buddy List System by its name.
Parameters:
NameTypeDescription
varNamestringThe name of the Buddy Variable to be retrieved.
Returns:
The object representing the Buddy Variable, or null if no Buddy Variable with the passed name belongs to the User.
Type: 
SFSBuddyVariable

getMyVariables() → {Array.<SFSBuddyVariable>}

Returns all Buddy Variables belonging to the current User in the Buddy List System.
Returns:
A list of objects representing the Buddy Variables.
Type: 
Array.<SFSBuddyVariable>