A list containing the objects representing each buddy of the user's buddy list.
The buddy list can be iterated with a foreach loop, or a specific object can be retrieved by means of the GetBuddyById(Int32) and GetBuddyByName(String) methods.
The buddy list can be iterated with a foreach loop, or a specific object can be retrieved by means of the GetBuddyById(Int32) and GetBuddyByName(String) methods.
NOTE:
this property and all the buddy-related method are available only if the buddy list feature is enabled for the current zone. Check the SmartFoxServer server-side configuration.
Version:
SmartFoxServer Basic (except block status) / Pro
History:
SmartFoxServer Pro v1.6.0 - Buddy's isBlocked property added.
Each element in the buddy list is an object with the following properties:
The following example shows how to retrieve the properties of each buddy in the buddy list.
CopyC#
| term | description |
|---|---|
| id | (int) the buddy id. |
| name | (string) the buddy name. |
| isOnline | (bool) the buddy online status: true if the buddy is online; false if the buddy is offline. |
| isBlocked | (bool) the buddy block status: true if the buddy is blocked; false if the buddy is not blocked; when a buddy is blocked, SmartFoxServer does not deliver private messages from/to that user. |
| variables | (object) an object with extra properties of the buddy (Buddy Variables); see also SetBuddyVariables(Dictionary<(Of <(String, Object>)>)) |
foreach (Buddy buddy in smartFox.buddyList) { // Trace buddy properties Debug.WriteLine("Buddy id: " + buddy.GetId()); Debug.WriteLine("Buddy name: " + buddy.GetName()); Debug.WriteLine("Is buddy online? " + buddy.IsOnline()); Debug.WriteLine("Is buddy blocked? " + buddy.IsBlocked()); // Trace all Buddy Variables foreach (string v in buddy.GetVariables().Keys) Debug.WriteLine("\t" + v + " -- " + buddy.GetVariable(v)); }