SmartFoxServer 2X C++ API
Sfs2X::Requests::Buddylist::InitBuddyListRequest Class Reference

Initializes the BuddyList system. More...

#include <InitBuddyListRequest.h>

Inherits Sfs2X::Requests::BaseRequest.

Public Member Functions

 InitBuddyListRequest ()
 Initializes the Buddy List. The initialization process is complete when the SFSBuddyEvent.BUDDY_LIST_INIT event is received. More...
 

Detailed Description

Initializes the BuddyList system.

This involves loading any previously stored Buddy data from the server, such as the User's Buddy List, his previous state and his persistent Buddy Variables. The init request is the first operation required to initialize the BuddyList system. Once the Init is executed the User can have access to all his previous data and start to interact with his Buddies.

Constructor & Destructor Documentation

◆ InitBuddyListRequest()

Sfs2X::Requests::Buddylist::InitBuddyListRequest::InitBuddyListRequest ( )

Initializes the Buddy List. The initialization process is complete when the SFSBuddyEvent.BUDDY_LIST_INIT event is received.

ptrSmartFox->AddEventListener(SFSEvent::BUDDY_LIST_INIT, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnBuddyInited, (unsigned long long)this));
ptrSmartFox->AddEventListener(SFSEvent::BUDDY_ERROR, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnBuddyError, (unsigned long long)this));
// Initialize buddy list
boost::shared_ptr<IRequest> request (new InitBuddyListRequest());
ptrSmartFox->Send(request);
static void OnBuddyInited(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
static void OnBuddyError(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
void CMyClass::OnBuddyInited(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
// Buddy list was inited with success!
}
void CMyClass::OnBuddyError(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
CMyClass* ptrMyClass = (CMyClass*)ptrContext;
boost::shared_ptr<map<string, boost::shared_ptr<void>>> ptrEventParams = ptrEvent->Params();
boost::shared_ptr<void> ptrEventParamValueErrorMessage = (*ptrEventParams)["errorMessage"];
boost::shared_ptr<string> ptrErrorMessage = ((boost::static_pointer_cast<string>)(ptrEventParamValueErrorMessage));
}
See also
Core.SFSBuddyEvent.BUDDY_LIST_INIT, Core.SFSBuddyEvent.BUDDY_ERROR, SFSBuddy, Entities.Variables.SFSBuddyVariable