Package sfs2x.client.requests.game
Class InvitationReplyRequest
- java.lang.Object
-
- sfs2x.client.requests.BaseRequest
-
- sfs2x.client.requests.game.InvitationReplyRequest
-
- All Implemented Interfaces:
sfs2x.client.requests.IRequest
public class InvitationReplyRequest extends BaseRequest
Replies to an invitation received by the current user.
Users who receive an invitation sent by means of the InviteUsersRequest request can either accept or refuse it using this request. The reply causes an invitationReply event to be dispatched to the inviter; if a reply is not sent, or it is sent after the invitation expiration, the system will react as if the invitation was refused.
If an error occurs while the reply is delivered to the inviter user (for example the invitation is already expired), an invitationReplyError event is returned to the current user.
Example
The following example receives an invitation and accepts it automatically; in a real case scenario, the application interface usually allows the user choosing to accept or refuse the invitation, or even ignore it:private void someMethod() { sfs.addEventListener(SFSEvent.INVITATION, new IEventListener() { public void dispatch(BaseEvent evt) throws SFSException { // Let's accept this invitation sfs.send(new InvitationReplyRequest((Invitation) evt.getArguments().get("invitation"), InvitationReply.ACCEPT)); } }); sfs.addEventListener(SFSEvent.INVITATION_REPLY_ERROR, new IEventListener() { public void dispatch(BaseEvent evt) throws SFSException { System.out.println("Failed to reply to invitation due to the following problem: " + evt.getArguments().get("errorMessage")); } }); }
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
KEY_INVITATION_ID
* API internal usage only *static java.lang.String
KEY_INVITATION_PARAMS
* API internal usage only *static java.lang.String
KEY_INVITATION_REPLY
* API internal usage only *-
Fields inherited from class sfs2x.client.requests.BaseRequest
AddBuddy, AdminMessage, AutoJoin, BanUser, BlockBuddy, CallExtension, ChangeRoomCapacity, ChangeRoomName, ChangeRoomPassword, ClusterInviteUsers, ClusterJoinOrCreate, CreateRoom, CreateSFSGame, FindRooms, FindUsers, GameServerConnectionRequired, 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, QuickJoinOrCreateRoom, RemoveBuddy, SetBuddyVariables, SetRoomVariables, SetUserPosition, SetUserVariables, SpectatorToPlayer, SubscribeRoomGroup, UnsubscribeRoomGroup
-
-
Constructor Summary
Constructors Constructor Description InvitationReplyRequest(Invitation invitation, int invitationReply)
InvitationReplyRequest(Invitation invitation, int invitationReply, com.smartfoxserver.v2.entities.data.ISFSObject params)
Creates a new InvitationReplyRequest instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
-
-
-
Field Detail
-
KEY_INVITATION_ID
public static final java.lang.String KEY_INVITATION_ID
* API internal usage only *- See Also:
- Constant Field Values
-
KEY_INVITATION_REPLY
public static final java.lang.String KEY_INVITATION_REPLY
* API internal usage only *- See Also:
- Constant Field Values
-
KEY_INVITATION_PARAMS
public static final java.lang.String KEY_INVITATION_PARAMS
* API internal usage only *- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InvitationReplyRequest
public InvitationReplyRequest(Invitation invitation, int invitationReply, com.smartfoxserver.v2.entities.data.ISFSObject params)
Creates a new InvitationReplyRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.- Parameters:
invitation
- An instance of the Invitation class containing the invitation details (inviter, custom parameters, etc).invitationReply
- The answer to be sent to the inviter, among those available as constants in the InvitationReply class.params
- An instance of SFSObject containing custom parameters to be returned to the inviter together with the reply (for example a message describing the reason of refusal).- See Also:
SmartFox.send(sfs2x.client.requests.IRequest)
,InvitationReply
,SFSObject
-
InvitationReplyRequest
public InvitationReplyRequest(Invitation invitation, int invitationReply)
-
-