Class SFS2X.Requests.BuddyList.RemoveBuddyRequest

Removes a buddy from the current user's buddy list.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new RemoveBuddyRequest instance.

Class Detail

SFS2X.Requests.BuddyList.RemoveBuddyRequest(buddyName)
Creates a new RemoveBuddyRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

In order to remove a buddy, the current user must be online in the Buddy List system. If the buddy is removed successfully, the operation is confirmed by a buddyRemove event; 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).

The following example sends a request to remove a buddy:

function someMethod()
{
	sfs.addEventListener(SFS2X.SFSBuddyEvent.BUDDY_REMOVE, onBuddyRemoved, this);
	sfs.addEventListener(SFS2X.SFSBuddyEvent.BUDDY_ERROR, onBuddyError, this);
	
	// Remove Jack from my buddies list
	sfs.send(new SFS2X.Requests.BuddyList.RemoveBuddyRequest("Jack"));
}

function onBuddyRemoved(evtParams)
{
	console.log("This buddy was removed: " + evtParams.buddy.name);
}

function onBuddyError(evtParams)
{
	console.log("The following error occurred while executing a buddy-related request: " + evtParams.errorMessage);
}
Parameters:
{String} buddyName
The name of the buddy to be removed from the user's buddy list.
See also:
SFS2X.SmartFox#send
SFS2X.SFSBuddyEvent.BUDDY_REMOVE
SFS2X.SFSBuddyEvent.BUDDY_ERROR
SFS2X.Requests.BuddyList.AddBuddyRequest