SmartFoxServer 2X C++ API
Sfs2X::Requests::LeaveRoomRequest Class Reference

Leaves a currently joined Room More...

#include <LeaveRoomRequest.h>

Inherits Sfs2X::Requests::BaseRequest.

Public Member Functions

 LeaveRoomRequest (boost::shared_ptr< Room > room)
 Constructor More...
 
 LeaveRoomRequest ()
 LeaveRoomRequest(Room*) More...
 

Detailed Description

Leaves a currently joined Room

Constructor & Destructor Documentation

◆ LeaveRoomRequest() [1/2]

Sfs2X::Requests::LeaveRoomRequest::LeaveRoomRequest ( boost::shared_ptr< Room >  room)

Constructor

Parameters
roomany joined Room that you want to leave, if null the last joined Room will be left
ptrSmartFox->AddEventListener(SFSEvent::USER_EXIT_ROOM, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnUserExitRoom, (unsigned long long)this));
// Send request
boost::shared_ptr<IRequest> request (new LeaveRoomRequest());
ptrSmartFox->Send(request);
static void OnUserExitRoom(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
void CMyClass::OnUserExitRoom(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
CMyClass* ptrMyClass = (CMyClass*)ptrContext;
// Room was left
boost::shared_ptr<map<string, boost::shared_ptr<void>>> ptrEventParams = ptrEvent->Params();
boost::shared_ptr<void> ptrEventParamValueRoom = (*ptrEventParams)["room"];
boost::shared_ptr<Room> ptrNotifiedRoom = ((boost::static_pointer_cast<Room>)(ptrEventParamValueRoom));
}
See also
Core.SFSEvent.USER_EXIT_ROOM, JoinRoomRequest

◆ LeaveRoomRequest() [2/2]

Sfs2X::Requests::LeaveRoomRequest::LeaveRoomRequest ( )

LeaveRoomRequest(Room*)