SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
sfs3::requests::AdminMessageRequest Class Reference

Sends an administrator message to a specific user or a group of users. More...

#include <AdminMessageRequest.h>

Public Member Functions

 AdminMessageRequest (std::string message, const entities::User &user, const entities::SFSObject *params=nullptr)
 Creates a new AdminMessageRequest targeting one specific user.
 AdminMessageRequest (std::string message, const entities::Room &room, const entities::SFSObject *params=nullptr)
 Creates a new AdminMessageRequest targeting all the users in a Room.
 AdminMessageRequest (std::string message, std::string groupId, const entities::SFSObject *params=nullptr)
 Creates a new AdminMessageRequest instance targeting all the clients who subscribed a specific Room Group.
 AdminMessageRequest (std::string message, const entities::SFSObject *params=nullptr)
 Creates a new AdminMessageRequest targeting every user in the Zone.

Detailed Description

Sends an administrator message to a specific user or a group of users.

The current user must have administration privileges to be able to send the message (see the User::getPrivilegeId() property).

Which constructor is used determines the message recipients: a single user, all the users in a Room or in a Group, or the entire Zone. Upon message delivery, the clients of the recipient users dispatch the event::SFSEvent::ADMIN_MESSAGE event.

sfs.send(requests::AdminMessageRequest { "Server restart in 5 minutes" });   // the whole Zone
See also
event::SFSEvent::ADMIN_MESSAGE
entities::User::getPrivilegeId
ModeratorMessageRequest

Constructor & Destructor Documentation

◆ AdminMessageRequest() [1/4]

sfs3::requests::AdminMessageRequest::AdminMessageRequest ( std::string message,
const entities::User & user,
const entities::SFSObject * params = nullptr )
inline

Creates a new AdminMessageRequest targeting one specific user.

Pass it to SmartFox::send for the request to be performed.

Parameters
messageThe message to be sent to the target user.
userThe user the message should be delivered to.
paramsCustom parameters to be sent to the recipient user; nullptr if none. Only borrowed: it is copied into the request before SmartFox::send returns.
See also
SmartFox::send
entities::SFSObject

◆ AdminMessageRequest() [2/4]

sfs3::requests::AdminMessageRequest::AdminMessageRequest ( std::string message,
const entities::Room & room,
const entities::SFSObject * params = nullptr )
inline

Creates a new AdminMessageRequest targeting all the users in a Room.

Parameters
messageThe message to be sent to the users in the target Room.
roomThe Room whose users the message should be delivered to.
paramsCustom parameters to be sent to the recipient users; nullptr if none.
See also
AdminMessageRequest::AdminMessageRequest(std::string, const entities::User&, const entities::SFSObject*)

◆ AdminMessageRequest() [3/4]

sfs3::requests::AdminMessageRequest::AdminMessageRequest ( std::string message,
std::string groupId,
const entities::SFSObject * params = nullptr )
inline

Creates a new AdminMessageRequest instance targeting all the clients who subscribed a specific Room Group.

Parameters
messageThe message to be sent to the clients subscribing the target Group.
groupIdThe id of the Room Group the message should be delivered to.
paramsCustom parameters to be sent to the recipient users; nullptr if none.
See also
AdminMessageRequest::AdminMessageRequest(std::string, const entities::User&, const entities::SFSObject*)
entities::Room::getGroupId

◆ AdminMessageRequest() [4/4]

sfs3::requests::AdminMessageRequest::AdminMessageRequest ( std::string message,
const entities::SFSObject * params = nullptr )
inline

Creates a new AdminMessageRequest targeting every user in the Zone.

Parameters
messageThe message to be sent to all the users in the Zone.
paramsCustom parameters to be sent to the recipient users; nullptr if none.
See also
AdminMessageRequest::AdminMessageRequest(std::string, const entities::User&, const entities::SFSObject*)

The documentation for this class was generated from the following file:
  • requests/AdminMessageRequest.h