Packagecom.smartfoxserver.v2.entities
Classpublic class SFSBuddy
InheritanceSFSBuddy Inheritance Object
Implements Buddy

The SFSBuddy object represents a buddy in the current user's buddies list.

A buddy is marked out by the following characteristics.

See also

SmartFox.buddyManager
BuddyVariable


Public Properties
 PropertyDefined By
  id : int
[read-only] Indicates the id of this buddy.
SFSBuddy
  isBlocked : Boolean
[read-only] Indicates whether this buddy is blocked in the current user's buddies list or not.
SFSBuddy
  isOnline : Boolean
[read-only] Indicates whether this buddy is online in the Buddy List system or not.
SFSBuddy
  isTemp : Boolean
[read-only] Indicates whether this buddy is temporary (non-persistent) in the current user's buddies list or not.
SFSBuddy
  name : String
[read-only] Indicates the name of this buddy.
SFSBuddy
  nickName : String
[read-only] Returns the nickname of this buddy.
SFSBuddy
  state : String
[read-only] Returns the custom state of this buddy.
SFSBuddy
  variables : Array
[read-only] Returns a list of BuddyVariable objects associated with the buddy.
SFSBuddy
Public Methods
 MethodDefined By
  
SFSBuddy(id:int, name:String, isBlocked:Boolean = false, isTemp:Boolean = false)
Creates a new SFSBuddy instance.
SFSBuddy
  
containsVariable(varName:String):Boolean
Indicates whether this buddy has the specified Buddy Variable set or not.
SFSBuddy
  
Retrieves the list of persistent Buddy Variables of this buddy.
SFSBuddy
  
Retrieves the list of non-persistent Buddy Variables of this buddy.
SFSBuddy
  
getVariable(varName:String):BuddyVariable
Retrieves a Buddy Variable from its name.
SFSBuddy
  
toString():String
Returns a string that contains the buddy name and id.
SFSBuddy
Property Detail
idproperty
id:int  [read-only]

Indicates the id of this buddy. This is equal to the id assigned by SmartFoxServer to the corresponding user.


Implementation
    public function get id():int
isBlockedproperty 
isBlocked:Boolean  [read-only]

Indicates whether this buddy is blocked in the current user's buddies list or not. A buddy can be blocked by means of a BlockBuddyRequest request.


Implementation
    public function get isBlocked():Boolean
isOnlineproperty 
isOnline:Boolean  [read-only]

Indicates whether this buddy is online in the Buddy List system or not.


Implementation
    public function get isOnline():Boolean
isTempproperty 
isTemp:Boolean  [read-only]

Indicates whether this buddy is temporary (non-persistent) in the current user's buddies list or not.


Implementation
    public function get isTemp():Boolean
nameproperty 
name:String  [read-only]

Indicates the name of this buddy. This is equal to the name of the corresponding user.


Implementation
    public function get name():String
nickNameproperty 
nickName:String  [read-only]

Returns the nickname of this buddy. If the nickname is not set, null is returned.


Implementation
    public function get nickName():String
stateproperty 
state:String  [read-only]

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

The list of available custom states is returned by the IBuddyManager.buddyStates property.


Implementation
    public function get state():String
variablesproperty 
variables:Array  [read-only]

Returns a list of BuddyVariable objects associated with the buddy.


Implementation
    public function get variables():Array
Constructor Detail
SFSBuddy()Constructor
public function SFSBuddy(id:int, name:String, isBlocked:Boolean = false, isTemp:Boolean = false)

Creates a new SFSBuddy instance.

NOTE: developers never istantiate a SFSBuddy manually: this is done by the SmartFoxServer 2X API internally.

Parameters
id:int — The buddy id.
 
name:String — The buddy name.
 
isBlocked:Boolean (default = false) — If true, the buddy being created is blocked by the current user.
 
isTemp:Boolean (default = false) — If true, the buddy being created is temporary in the current client.
Method Detail
containsVariable()method
public function containsVariable(varName:String):Boolean

Indicates whether this buddy has the specified Buddy Variable set or not.

Parameters

varName:String — The name of the Buddy Variable whose existance must be checked.

Returns
Booleantrue if a Buddy Variable with the passed name is set for this buddy.
getOfflineVariables()method 
public function getOfflineVariables():Array

Retrieves the list of persistent Buddy Variables of this buddy.

Returns
Array — An array of BuddyVariable objects.
getOnlineVariables()method 
public function getOnlineVariables():Array

Retrieves the list of non-persistent Buddy Variables of this buddy.

Returns
Array — An array of BuddyVariable objects.
getVariable()method 
public function getVariable(varName:String):BuddyVariable

Retrieves a Buddy Variable from its name.

Parameters

varName:String — The name of the Buddy Variable to be retrieved.

Returns
BuddyVariable — The BuddyVariable object representing the Buddy Variable, or null if no Buddy Variable with the passed name is associated with this buddy.
toString()method 
public function toString():String

Returns a string that contains the buddy name and id.

Returns
String — The string representation of the SFSBuddy object.