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

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

#include <ModeratorMessageRequest.h>

Public Member Functions

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

Detailed Description

Sends a moderator message to a specific user or a group of users.

The current user must have moderation 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::MODERATOR_MESSAGE event.

sfs.send(requests::ModeratorMessageRequest { "Please behave", *user });     // one user
sfs.send(requests::ModeratorMessageRequest { "Please behave", *room });     // one Room
sfs.send(requests::ModeratorMessageRequest { "Please behave", "games" });   // one Group
sfs.send(requests::ModeratorMessageRequest { "Please behave" });            // the whole Zone
See also
event::SFSEvent::MODERATOR_MESSAGE
entities::User::getPrivilegeId
AdminMessageRequest

Constructor & Destructor Documentation

◆ ModeratorMessageRequest() [1/4]

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

Creates a new ModeratorMessageRequest 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

◆ ModeratorMessageRequest() [2/4]

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

Creates a new ModeratorMessageRequest 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
ModeratorMessageRequest::ModeratorMessageRequest(std::string, const entities::User&, const entities::SFSObject*)

◆ ModeratorMessageRequest() [3/4]

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

Creates a new ModeratorMessageRequest 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
ModeratorMessageRequest::ModeratorMessageRequest(std::string, const entities::User&, const entities::SFSObject*)
entities::Room::getGroupId

◆ ModeratorMessageRequest() [4/4]

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

Creates a new ModeratorMessageRequest 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
ModeratorMessageRequest::ModeratorMessageRequest(std::string, const entities::User&, const entities::SFSObject*)

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