com.threerings.parlor.client

## Class Invitation

- java.lang.Object
- - com.threerings.parlor.client.Invitation

All Implemented Interfaces:
  ParlorService.InviteListener, ParlorCodes, com.threerings.presents.client.InvocationService.InvocationListener, com.threerings.presents.data.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

Fields
`GameConfig` `config` The configuration of the game to be created.
`int` `inviteId` The unique id for this invitation (as assigned by the server).
`com.threerings.util.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

Constructors
Constructor and Description
`Invitation(ParlorContext ctx, ParlorService pservice, com.threerings.util.Name opponent, GameConfig config, InvitationResponseObserver observer)` Constructs a new invitation record.

### Method Summary

All Methods Instance Methods Concrete Methods
`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.
`void` `refuse(String message)` Refuses this invitation.
`void` `requestFailed(String reason)`
`String` `toString()`

### Methods inherited from class java.lang.Object

`equals, 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 com.threerings.util.Name opponent

The name of the other user involved in this invitation.

#### config

    public GameConfig config

The configuration of the game to be created.

### Constructor Detail

#### Invitation

    public Invitation(ParlorContext ctx,
                      ParlorService pservice,
                      com.threerings.util.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 `com.threerings.presents.client.InvocationService.InvocationListener`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`