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

Search Users in the system by matching their variables and properties against a MatchExpression More...

#include <FindUsersRequest.h>

Inherits Sfs2X::Requests::BaseRequest.

Public Member Functions

 FindUsersRequest (boost::shared_ptr< MatchExpression > expr)
 FindUsersRequest(boost::shared_ptr<MatchExpression>, string, long int) More...
 
 FindUsersRequest (boost::shared_ptr< MatchExpression > expr, boost::shared_ptr< Room > target)
 FindUsersRequest(boost::shared_ptr<MatchExpression>, string, long int) More...
 
 FindUsersRequest (boost::shared_ptr< MatchExpression > expr, boost::shared_ptr< Room > target, long int limit)
 FindUsersRequest(boost::shared_ptr<MatchExpression>, string, long int) More...
 
 FindUsersRequest (boost::shared_ptr< MatchExpression > expr, string target)
 FindUsersRequest(boost::shared_ptr<MatchExpression>, string, long int) More...
 
 FindUsersRequest (boost::shared_ptr< MatchExpression > expr, string target, long int limit)
 Constructor More...
 

Detailed Description

Search Users in the system by matching their variables and properties against a MatchExpression

Constructor & Destructor Documentation

◆ FindUsersRequest() [1/5]

Sfs2X::Requests::FindUsersRequest::FindUsersRequest ( boost::shared_ptr< MatchExpression expr)

◆ FindUsersRequest() [2/5]

Sfs2X::Requests::FindUsersRequest::FindUsersRequest ( boost::shared_ptr< MatchExpression expr,
boost::shared_ptr< Room >  target 
)

◆ FindUsersRequest() [3/5]

Sfs2X::Requests::FindUsersRequest::FindUsersRequest ( boost::shared_ptr< MatchExpression expr,
boost::shared_ptr< Room >  target,
long int  limit 
)

◆ FindUsersRequest() [4/5]

Sfs2X::Requests::FindUsersRequest::FindUsersRequest ( boost::shared_ptr< MatchExpression expr,
string  target 
)

◆ FindUsersRequest() [5/5]

Sfs2X::Requests::FindUsersRequest::FindUsersRequest ( boost::shared_ptr< MatchExpression expr,
string  target,
long int  limit 
)

Constructor

Parameters
exprthe match expression
targetit can be a Room or String (the Group Id), if null the search will done in the whole Zone (default)
limitthe number of results wanted. Zero means no limit, we will get all results (default)

target can be –> Room: search in that room –> String: a valid groupId –> null: search the whole zone

ptrSmartFox->AddEventListener(SFSEvent::USER_FIND_RESULT, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnUserFindResult, (unsigned long long)this));
// Search for all Users whose 'age' User Variable is 29
boost::shared_ptr<MatchExpression> expr (new MatchExpression("age", NumberMatch::EQUALS, 29));
// Send request
boost::shared_ptr<IRequest> request (new FindUserRequest(expr));
ptrSmartFox->Send(request);
static void OnUserFindResult(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
void CMyClass::OnUserFindResult(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
CMyClass* ptrMyClass = (CMyClass*)ptrContext;
// Show the array of Users
boost::shared_ptr<map<string, boost::shared_ptr<void>>> ptrEventParams = ptrEvent->Params();
boost::shared_ptr<void> ptrEventParamValueUsers = (*ptrEventParams)["users"];
boost::shared_ptr<vector<boost::shared_ptr<User>>> ptrNotifiedUsers = ((boost::static_pointer_cast<vector<boost::shared_ptr<User>>>)(ptrEventParamValueUsers));
}
See also
Core.SFSEvent.USER_FIND_RESULT, UserProperties, MatchExpression