com.threerings.parlor.client
Class Invitation

java.lang.Object
  extended by com.threerings.parlor.client.Invitation
All Implemented Interfaces:
ParlorService.InviteListener, ParlorCodes, InvocationService.InvocationListener, InvocationCodes

public class Invitation
extends Object
implements ParlorCodes, ParlorService.InviteListener

The invitation class is used to track information related to outstanding invitations generated by or targeted to this client.


Field Summary
protected  boolean _cancelled
          A flag indicating that we were requested to cancel this invitation before we even heard back with an acknowledgement that it was received by the server.
protected  ParlorContext _ctx
          Provides access to client services.
protected  InvitationResponseObserver _observer
          The entity to notify when we receive a response for this invitation.
protected  ParlorService _pservice
          Provides access to parlor services.
 GameConfig config
          The configuration of the game to be created.
 int inviteId
          The unique id for this invitation (as assigned by the server).
 Name opponent
          The name of the other user involved in this invitation.
 
Fields inherited from interface com.threerings.parlor.data.ParlorCodes
ALREADY_AT_TABLE, BANNED_FROM_TABLE, GAME_ALREADY_STARTED, INVALID_TABLE_POSITION, INVITATION_ACCEPTED, INVITATION_COUNTERED, INVITATION_REFUSED, INVITEE_NOT_ONLINE, MUST_BE_CREATOR, NO_SELF_BOOT, NO_SUCH_TABLE, NOT_AT_TABLE, PARLOR_GROUP, TABLE_POSITION_OCCUPIED
 
Fields inherited from interface com.threerings.presents.data.InvocationCodes
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR
 
Constructor Summary
Invitation(ParlorContext ctx, ParlorService pservice, Name opponent, GameConfig config, InvitationResponseObserver observer)
          Constructs a new invitation record.
 
Method Summary
 void accept()
          Accepts this invitation.
 void cancel()
          Cancels this invitation.
 void counter(GameConfig config, InvitationResponseObserver observer)
          Counters this invitation with an invitation with different game configuration parameters.
 void inviteReceived(int inviteId)
          Called in response to a successful ParlorService.invite(com.threerings.util.Name, com.threerings.parlor.game.data.GameConfig, com.threerings.parlor.client.ParlorService.InviteListener) request.
protected  void receivedResponse(int code, Object arg)
          Called by the parlor director when we receive a response to an invitation initiated by this client.
 void refuse(String message)
          Refuses this invitation.
 void requestFailed(String reason)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inviteId

public int inviteId
The unique id for this invitation (as assigned by the server). This is -1 until we receive an acknowledgement from the server that our invitation was delivered.


opponent

public Name opponent
The name of the other user involved in this invitation.


config

public GameConfig config
The configuration of the game to be created.


_ctx

protected ParlorContext _ctx
Provides access to client services.


_pservice

protected ParlorService _pservice
Provides access to parlor services.


_observer

protected InvitationResponseObserver _observer
The entity to notify when we receive a response for this invitation.


_cancelled

protected boolean _cancelled
A flag indicating that we were requested to cancel this invitation before we even heard back with an acknowledgement that it was received by the server.

Constructor Detail

Invitation

public Invitation(ParlorContext ctx,
                  ParlorService pservice,
                  Name opponent,
                  GameConfig config,
                  InvitationResponseObserver observer)
Constructs a new invitation record.

Method Detail

accept

public void accept()
Accepts this invitation.


refuse

public void refuse(String message)
Refuses this invitation.

Parameters:
message - the message to deliver to the inviting user explaining the reason for the refusal or null if no message is to be provided.

cancel

public void cancel()
Cancels this invitation.


counter

public void counter(GameConfig config,
                    InvitationResponseObserver observer)
Counters this invitation with an invitation with different game configuration parameters.

Parameters:
config - the updated game configuration.
observer - the entity that will be notified if this counter-invitation is accepted, refused or countered.

inviteReceived

public void inviteReceived(int inviteId)
Description copied from interface: ParlorService.InviteListener
Called in response to a successful ParlorService.invite(com.threerings.util.Name, com.threerings.parlor.game.data.GameConfig, com.threerings.parlor.client.ParlorService.InviteListener) request.

Specified by:
inviteReceived in interface ParlorService.InviteListener

requestFailed

public void requestFailed(String reason)
Specified by:
requestFailed in interface InvocationService.InvocationListener

receivedResponse

protected void receivedResponse(int code,
                                Object arg)
Called by the parlor director when we receive a response to an invitation initiated by this client.


toString

public String toString()
Overrides:
toString in class Object