new BlockBuddyRequest(buddyName, blocked)

Creates a new BlockBuddyRequest instance. The instance must be passed to the SmartFox.send() method for the request to be executed.

Blocked buddies won't be able to see if the user who blocked them is online in their buddy list; they also won't be able to send messages or requests to that user.

In order to block a buddy, the current user must be online in the Buddy List system. If the operation is successful, a buddyBlock confirmation event is dispatched; otherwise the buddyError event is fired.

NOTE: this request can be sent if the Buddy List system was previously initialized only (see the InitBuddyListRequest request description).

Example

This example handles the possible events caused by a request to block a buddy.

function someMethod()
{
	sfs.addEventListener(SFS2X.SFSBuddyEvent.BUDDY_BLOCK, onBuddyBlock, this);
	sfs.addEventListener(SFS2X.SFSBuddyEvent.BUDDY_ERROR, onBuddyError, this);

	// Block user "Jack" in my buddies list
	smartFox.send(new SFS2X.BlockBuddyRequest("Jack", true));
}

function onBuddyBlock(evtParams)
{
	var isBlocked = evtParams.buddy.isBlocked;
	console.log("Buddy " + evtParams.buddy.name + " is now " + (isBlocked ? "blocked" : "unblocked"));
}

function onBuddyError(evtParams)
{
	console.log("The following error occurred while executing a buddy-related request: " + evtParams.errorMessage);
}

Parameters

Name Type Optional Description

buddyName

 

 

The name of the buddy to be removed from the user's buddy list.

blocked

 

 

true if the buddy must be blocked; false if he must be unblocked.

See also
SmartFox#send
SFSBuddyEvent.BUDDY_BLOCK
SFSBuddyEvent.BUDDY_ERROR