sfs2x.client.requests.buddylist
Class RemoveBuddyRequest

java.lang.Object
  extended by sfs2x.client.requests.BaseRequest
      extended by sfs2x.client.requests.buddylist.RemoveBuddyRequest
All Implemented Interfaces:
sfs2x.client.requests.IRequest

public class RemoveBuddyRequest
extends BaseRequest

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

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

Example
The following example sends a request to remove a buddy:

 private void someMethod() {
     sfs.addEventListener(SFSBuddyEvent.BUDDY_REMOVE, new IEventListener() {
         public void dispatch(BaseEvent evt) throws SFSException {
             System.out.println("This buddy was removed:" + ((Buddy) evt.getArguments().get("buddy")).getName());
         }
     });
     
     sfs.addEventListener(SFSBuddyEvent.BUDDY_ERROR, new IEventListener() {
         public void dispatch(BaseEvent evt) throws SFSException {
             System.out.println("The following error occurred while executing a buddy-related request:" + evt.getArguments().get("errorMessage"));
         }
     });
     
     // Remove Jack from my buddies list
     sfs.send(new RemoveBuddyRequest("Jack"));
 }
 

See Also:
SFSBuddyEvent.BUDDY_REMOVE, SFSBuddyEvent.BUDDY_ERROR, AddBuddyRequest, InitBuddyListRequest

Field Summary
static java.lang.String KEY_BUDDY_NAME
          * API internal usage only *
 
Fields inherited from class sfs2x.client.requests.BaseRequest
AddBuddy, AdminMessage, AutoJoin, BanUser, BlockBuddy, CallExtension, ChangeRoomCapacity, ChangeRoomName, ChangeRoomPassword, CreateRoom, CreateSFSGame, FindRooms, FindUsers, GenericMessage, GetRoomList, GoOnline, Handshake, InitBuddyList, InvitationReply, InviteUser, JoinRoom, JoinRoomInvite, KEY_ERROR_CODE, KEY_ERROR_PARAMS, KickUser, LeaveRoom, Login, Logout, ManualDisconnection, ModeratorMessage, ObjectMessage, PingPong, PlayerToSpectator, PrivateMessage, PublicMessage, QuickJoinGame, RemoveBuddy, SetBuddyVariables, SetRoomVariables, SetUserPosition, SetUserVariables, SpectatorToPlayer, SubscribeRoomGroup, UnsubscribeRoomGroup
 
Constructor Summary
RemoveBuddyRequest(java.lang.String buddyName)
          Creates a new RemoveBuddyRequest instance.
 
Method Summary
 void execute(ISmartFox sfs)
          * API internal usage only *
 void validate(ISmartFox sfs)
          * API internal usage only *
 
Methods inherited from class sfs2x.client.requests.BaseRequest
getId, getMessage, getTargetController, isEncrypted, setEncrypted, setId, setTargetController
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_BUDDY_NAME

public static final java.lang.String KEY_BUDDY_NAME
* API internal usage only *

See Also:
Constant Field Values
Constructor Detail

RemoveBuddyRequest

public RemoveBuddyRequest(java.lang.String buddyName)
Creates a new RemoveBuddyRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

Parameters:
buddyName - The name of the buddy to be removed from the user's buddies list.
See Also:
SmartFox.send(sfs2x.client.requests.IRequest)
Method Detail

validate

public void validate(ISmartFox sfs)
              throws sfs2x.client.exceptions.SFSValidationException
* API internal usage only *

Throws:
sfs2x.client.exceptions.SFSValidationException

execute

public void execute(ISmartFox sfs)
* API internal usage only *