SmartFoxServer Silverlight API
SendBuddyPermissionResponse Method (allowBuddy, targetBuddy)
Namespaces ► SmartFoxClientAPI ► SmartFoxClient ► SendBuddyPermissionResponse(Boolean, String)
Grant current user permission to be added to a buddy list.
If the SmartFoxServer Pro 1.6.0 advanced security mode is used (see the SmartFoxServer server-side configuration), when a user wants to add a buddy to his/her buddy list, a permission request is sent to the buddy.
Once the SFSEvent..::.OnBuddyPermissionRequestDelegate event is received, this method must be used by the buddy to grant or refuse permission. When the permission is granted, the requester's buddy list is updated.
Declaration Syntax

C# | Visual Basic | Visual C++

    public void SendBuddyPermissionResponse(
    	bool allowBuddy,
    	string targetBuddy
    )

    Public Sub SendBuddyPermissionResponse ( _
    	allowBuddy As Boolean, _
    	targetBuddy As String _
    )

    public:
    void SendBuddyPermissionResponse(
    	bool allowBuddy,
    	String^ targetBuddy
    )

Parameters

allowBuddy (Boolean)
  true to grant permission, false to refuse to be added to the requester's buddy list.

targetBuddy (String)
  the username of the requester.

Remarks

Sends:
SFSEvent..::.OnBuddyPermissionRequestDelegate

Since:
SmartFoxServer Pro v1.6.0

Version:
SmartFoxServer Pro

Examples
The following example shows how to grant permission to be added to a buddy list once request is received.
CopyC#

    SFSEvent.onBuddyPermissionRequest += OnBuddyPermissionRequest;

    bool autoGrantPermission = true;

    public void OnBuddyPermissionRequest(string sender, string message)
    {
        if (autoGrantPermission)
        {
            // Automatically grant permission

            smartFox.SendBuddyPermissionResponse(true, sender);
        }
        else
        {
            // Display a popup containing grant/refuse buttons
        }
    }

See Also
AddBuddy(String)
SFSEvent..::.OnBuddyPermissionRequestDelegate

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