SmartFoxServer 2X C++ API
Sfs2X::Requests::Game::InvitationReplyRequest Class Reference

Send a reply to an Invitation. More...

#include <InvitationReplyRequest.h>

Inherits Sfs2X::Requests::BaseRequest.

Public Member Functions

 InvitationReplyRequest (boost::shared_ptr< Sfs2X::Entities::Invitation::Invitation > invitation, boost::shared_ptr< InvitationReply > reply)
 InvitationReplyRequest(Invitation*, InvitationReply*, ISFSObject*) More...
 
 InvitationReplyRequest (boost::shared_ptr< Sfs2X::Entities::Invitation::Invitation > invitation, boost::shared_ptr< InvitationReply > reply, boost::shared_ptr< ISFSObject > parameters)
 Constructor More...
 

Detailed Description

Send a reply to an Invitation.

The reply can be either an ACCEPT or REFUSE. If the reply doesn't get to the inviter within the expected amount of time the system will handle it as a REFUSE.

Constructor & Destructor Documentation

◆ InvitationReplyRequest() [1/2]

Sfs2X::Requests::Game::InvitationReplyRequest::InvitationReplyRequest ( boost::shared_ptr< Sfs2X::Entities::Invitation::Invitation invitation,
boost::shared_ptr< InvitationReply >  reply 
)

InvitationReplyRequest(Invitation*, InvitationReply*, ISFSObject*)

◆ InvitationReplyRequest() [2/2]

Sfs2X::Requests::Game::InvitationReplyRequest::InvitationReplyRequest ( boost::shared_ptr< Sfs2X::Entities::Invitation::Invitation invitation,
boost::shared_ptr< InvitationReply >  reply,
boost::shared_ptr< ISFSObject parameters 
)

Constructor

Parameters
invitationa reference to the received invitation
replythe reply code
parameterscustom reply parameters
ptrSmartFox->AddEventListener(SFSEvent::INVITATION, boost::shared_ptr<EventListenerDelegate> (new EventListenerDelegate(CMyClass::OnInvitationReceived, (unsigned long long)this)));
ptrSmartFox->AddEventListener(SFSEvent::INVITATION_REPLY_ERROR, boost::shared_ptr<EventListenerDelegate> (new EventListenerDelegate(CMyClass::OnInvitationReplyError, (unsigned long long)this)));
static void OnInvitationReceived(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
static void OnInvitationReplyError(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
void CMyClass::OnInvitationReceived(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent)
{
// Get the pointer to my class
CMyClass* instance = (CMyClass*)ptrContext;
// Let's accept this invitation
boost::shared_ptr<map<string, boost::shared_ptr<void>>> ptrEventParams = ptrEvent->Params();
boost::shared_ptr<void> ptrEventParamValueInvitation = (*ptrEventParams)["invitation"];
boost::shared_ptr<Invitation> ptrNotifiedInvitation = ((boost::static_pointer_cast<User>))(ptrEventParamValueInvitation);
boost::shared_ptr<IRequest> request (new InvitationReplyRequest(ptrNotifiedInvitation, INVITATIONREPLY_ACCEPT));
ptrSmartFox->Send(request);
}
void CMyClass::OnInvitationReceived(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent)
{
// Get the pointer to my class
CMyClass* instance = (CMyClass*)ptrContext;
// Handle problems with the invitation reply
boost::shared_ptr<void> ptrEventParamValueMessage = (*ptrEventParams)["errorMessage"];
boost::shared_ptr<string> ptrNotifiedMessage = ((boost::static_pointer_cast<string>))(ptrEventParamValueMessage);
}
See also
Core.SFSEvent.INVITATION_REPLY_ERROR, SFSInvitation, InvitationReply