SmartFoxServer Silverlight API
buddyList Field
Namespaces ► SmartFoxClientAPI ► SmartFoxClient ► buddyList
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.
Declaration Syntax

C# | Visual Basic | Visual C++

    public List<Buddy> buddyList

    Public buddyList As List(Of Buddy)

    public:
    List<Buddy^>^ buddyList

Remarks

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.

Examples
Each element in the buddy list is an object with the following properties:

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>)>))

The following example shows how to retrieve the properties of each buddy in the buddy list.
CopyC#

    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));
     }

See Also
myBuddyVars
LoadBuddyList()()()
GetBuddyById(Int32)
GetBuddyByName(String)
RemoveBuddy(String)
SetBuddyBlockStatus(String, Boolean)
SetBuddyVariables(Dictionary<(Of <(String, Object>)>))
SFSEvent..::.OnBuddyListDelegate
SFSEvent..::.OnBuddyListUpdateDelegate

Assembly: SmartFoxClientAPI_Silverlight (Module: SmartFoxClientAPI_Silverlight) Version: 1.0.0.0 (1.0.0.0)