SmartFoxServer 2X C++ API
|
Sends an invitation to other users/players to join a specific Room. More...
#include <JoinRoomInvitationRequest.h>
Inherits Sfs2X::Requests::BaseRequest.
Public Member Functions | |
JoinRoomInvitationRequest (boost::shared_ptr< Room > targetRoom, boost::shared_ptr< list< string > > invitedUserNames, boost::shared_ptr< ISFSObject > parameters, long int expirySeconds, bool asSpectator) | |
Creates a new JoinRoomInvitationRequest instance. More... | |
JoinRoomInvitationRequest (boost::shared_ptr< Room > targetRoom, boost::shared_ptr< list< string > > invitedUserNames, boost::shared_ptr< ISFSObject > parameters, long int expirySeconds) | |
See JoinRoomInvitationRequest(boost::shared_ptr<Room>, boost::shared_ptr<list<string> >, boost::shared_ptr<ISFSObject>, long int, bool) constructor. More... | |
JoinRoomInvitationRequest (boost::shared_ptr< Room > targetRoom, boost::shared_ptr< list< string > > invitedUserNames, boost::shared_ptr< ISFSObject > parameters) | |
See JoinRoomInvitationRequest(boost::shared_ptr<Room>, boost::shared_ptr<list<string> >, boost::shared_ptr<ISFSObject>, long int, bool) constructor. More... | |
JoinRoomInvitationRequest (boost::shared_ptr< Room > targetRoom, boost::shared_ptr< list< string > > invitedUserNames) | |
See JoinRoomInvitationRequest(boost::shared_ptr<Room>, boost::shared_ptr<list<string> >, boost::shared_ptr<ISFSObject>, long int, bool) constructor. More... | |
Static Public Attributes | |
static boost::shared_ptr< string > | KEY_ROOM_ID |
<exclude> | |
static boost::shared_ptr< string > | KEY_EXPIRY_SECONDS |
<exclude> | |
static boost::shared_ptr< string > | KEY_INVITED_NAMES |
<exclude> | |
static boost::shared_ptr< string > | KEY_AS_SPECT |
<exclude> | |
static boost::shared_ptr< string > | KEY_OPTIONAL_PARAMS |
<exclude> | |
Sends an invitation to other users/players to join a specific Room.
Invited users receive the invitation as an Sfs2X.Core.SFSEvent.INVITATION event dispatched to their clients: they can accept or refuse it by means of the InvitationReplyRequest request, which must be sent within the specified amount of time.
Depending on the Room's settings this invitation can be sent by the Room's owner only or by any other user. This behavior can be set via the RoomSettings.AllowOwnerOnlyInvitation parameter.
NOTE: spectators in a Game Room are not allowed to invite other users; only players are.
An invitation can also specify the amount of time given to each invitee to reply. Default is 30 seconds. A positive answer will attempt to join the user in the designated Room. For Game Rooms the asSpectator flag can be toggled to join the invitee as player or spectator (default = player).
There aren't any specific notifications sent back to the inviter after the invitee's response. Users that have accepted the invitation will join the Room while those who didn't reply or turned down the invitation won't generate any event. In order to send specific messages (e.g. chat), just send a private message back to the inviter.
The following example invites two more users in the current game:
Sfs2X::Requests::Game::JoinRoomInvitationRequest::JoinRoomInvitationRequest | ( | boost::shared_ptr< Room > | targetRoom, |
boost::shared_ptr< list< string > > | invitedUserNames, | ||
boost::shared_ptr< ISFSObject > | parameters, | ||
long int | expirySeconds, | ||
bool | asSpectator | ||
) |
Creates a new JoinRoomInvitationRequest instance.
The instance must be passed to the SmartFox.Send method for the request to be performed.
targetRoom | The Room to join (must have free user/player slots). |
invitedUserNames | A list of user names to invite. |
parameters | An instance of Sfs2X.Entities.Data.SFSObject containing any relevant parameter or message to be sent to the invited users (for example an invitation message). Default is null . |
expirySeconds | The time given to the invitee to reply to the invitation. Default is 30. |
asSpectator | In Game Rooms only, indicates if the invited user(s) should join as spectator(s) instead of player(s). Default is false . |
Sfs2X::Requests::Game::JoinRoomInvitationRequest::JoinRoomInvitationRequest | ( | boost::shared_ptr< Room > | targetRoom, |
boost::shared_ptr< list< string > > | invitedUserNames, | ||
boost::shared_ptr< ISFSObject > | parameters, | ||
long int | expirySeconds | ||
) |
See JoinRoomInvitationRequest(boost::shared_ptr<Room>, boost::shared_ptr<list<string> >, boost::shared_ptr<ISFSObject>, long int, bool) constructor.
Sfs2X::Requests::Game::JoinRoomInvitationRequest::JoinRoomInvitationRequest | ( | boost::shared_ptr< Room > | targetRoom, |
boost::shared_ptr< list< string > > | invitedUserNames, | ||
boost::shared_ptr< ISFSObject > | parameters | ||
) |
See JoinRoomInvitationRequest(boost::shared_ptr<Room>, boost::shared_ptr<list<string> >, boost::shared_ptr<ISFSObject>, long int, bool) constructor.
Sfs2X::Requests::Game::JoinRoomInvitationRequest::JoinRoomInvitationRequest | ( | boost::shared_ptr< Room > | targetRoom, |
boost::shared_ptr< list< string > > | invitedUserNames | ||
) |
See JoinRoomInvitationRequest(boost::shared_ptr<Room>, boost::shared_ptr<list<string> >, boost::shared_ptr<ISFSObject>, long int, bool) constructor.