SmartFoxServer Silverlight API
AddBuddy Method (buddyName)
NamespacesSmartFoxClientAPISmartFoxClientAddBuddy(String)
Add a user to the buddy list.
Since SmartFoxServer Pro 1.6.0, the buddy list feature can be configured to use a basic or advanced security mode (see the SmartFoxServer server-side configuration file).
Check the following usage notes for details on the behavior of the AddBuddy method in the two cases.
Declaration Syntax
C#Visual BasicVisual C++
public void AddBuddy(
	string buddyName
)
Public Sub AddBuddy ( _
	buddyName As String _
)
public:
void AddBuddy(
	String^ buddyName
)
Parameters
buddyName (String)
the name of the user to be added to the buddy list.
Remarks

Sends:
SFSEvent..::.OnBuddyListDelegate
SFSEvent..::.OnBuddyListErrorDelegate
SFSEvent..::.OnBuddyPermissionRequestDelegate

Usage Note:
Basic security mode When a buddy is added, if the buddy list is already full, the SFSEvent..::.OnBuddyListErrorDelegate event is fired; otherwise the buddy list is updated and the SFSEvent..::.OnBuddyListDelegate event is fired.


Advanced security mode If the <addBuddyPermission> parameter is set to true in the buddy list configuration section of a zone, before the user is actually added to the buddy list he/she must grant his/her permission. The permission request is sent if the user is online only; the user receives the {@link SFSEvent#onBuddyPermissionRequest} event. When the permission is granted, the buddy list is updated and the SFSEvent..::.OnBuddyListDelegate event is fired. If the permission is not granted (or the buddy didn't receive the permission request), the addBuddy method can be called again after a certain amount of time only. This time is set in the server configuration <permissionTimeOut> parameter. Also, if the <mutualAddBuddy> parameter is set to true, when user A adds user B to the buddy list, he/she is automatically added to user B's buddy list. Lastly, if the buddy list is full, the SFSEvent..::.OnBuddyListErrorDelegate event is fired.

History:
SmartFoxServer Pro v1.6.0 - Buddy list's advanced security mode implemented.

Version:
SmartFoxServer Basic (except advanced mode) / Pro

Examples
The following example shows how to add a user to the buddy list.
CopyC#
smartFox.AddBuddy("jack");
See Also

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