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

Block/Unblock a Buddy in the User's BuddyList More...

#include <BlockBuddyRequest.h>

Inherits Sfs2X::Requests::BaseRequest.

Public Member Functions

 BlockBuddyRequest (string buddyName, bool blocked)
 Constructor More...
 

Detailed Description

Block/Unblock a Buddy in the User's BuddyList

Blocked buddies won't be able to see the the User online status and send messages or events

Constructor & Destructor Documentation

◆ BlockBuddyRequest()

Sfs2X::Requests::Buddylist::BlockBuddyRequest::BlockBuddyRequest ( string  buddyName,
bool  blocked 
)

Constructor

Parameters
buddyNamethe name of the buddy to add
blockedthe blocked status
ptrSmartFox->AddEventListener(SFSEvent::BUDDY_BLOCK, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnBuddyBlock, (unsigned long long)this));
ptrSmartFox->AddEventListener(SFSEvent::BUDDY_ERROR, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnBuddyError, (unsigned long long)this));
// Block a buddy in the current buddy list
boost::shared_ptr<IRequest> request (new BlockBuddyRequest("Swedish Cook", true));
ptrSmartFox->Send(request);
static void OnBuddyBlock(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
static void OnBuddyError(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
void CMyClass::OnBuddyBlock(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
CMyClass* ptrMyClass = (CMyClass*)ptrContext;
// Buddy block status was changed
boost::shared_ptr<map<string, boost::shared_ptr<void>>> ptrEventParams = ptrEvent->Params();
boost::shared_ptr<void> ptrEventParamValueBuddy = (*ptrEventParams)["buddy"];
boost::shared_ptr<Buddy> ptrNotifiedBuddy = ((boost::static_pointer_cast<Buddy>)(ptrEventParamValueBuddy));
}
void CMyClass::OnBuddyError(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
CMyClass* ptrMyClass = (CMyClass*)ptrContext;
// Buddy error
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_BLOCK, Core.SFSBuddyEvent.BUDDY_ERROR, AddBuddyRequest, RemoveBuddyRequest