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

Bans one or more users from a Room for a certain amount of time. More...

#include <BanUsersFromRoomRequest.h>

Inheritance diagram for sfs3::requests::BanUsersFromRoomRequest:
[legend]

Public Member Functions

 BanUsersFromRoomRequest (std::vector< std::shared_ptr< entities::User > > users, std::shared_ptr< entities::Room > theRoom, std::optional< std::string > message=std::nullopt, int32_t interval=1, BanTimeUnit timeUnit=BanTimeUnit::Hours)
 Creates a new BanUsersFromRoomRequest banning a group of users.

Detailed Description

Bans one or more users from a Room for a certain amount of time.

To be able to ban a user the requester must be the Room's owner, or have Moderator or Administrator privileges. Up to 10 users can be banned with a single request, for a duration of 1 to 60 minutes or 1 to 24 hours.

NOTE: if no message is provided the ban happens immediately. If a message is provided, it is sent first (as a moderator message) and the users are kicked out with a short delay (2-3 seconds).

The server does not acknowledge this request: there is no success or error event to listen for. A ban that the server refuses (unknown Room, insufficient privileges, more than 10 users) is logged server-side and silently dropped. The only visible effect of a successful ban is the userExitRoom event fired when each banned user is kicked out. The requester itself is ignored if included in the list, as is the Room's owner.

See also
UnbanUsersFromRoomRequest
event::SFSEvent::USER_EXIT_ROOM

Constructor & Destructor Documentation

◆ BanUsersFromRoomRequest()

sfs3::requests::BanUsersFromRoomRequest::BanUsersFromRoomRequest ( std::vector< std::shared_ptr< entities::User > > users,
std::shared_ptr< entities::Room > theRoom,
std::optional< std::string > message = std::nullopt,
int32_t interval = 1,
BanTimeUnit timeUnit = BanTimeUnit::Hours )
inline

Creates a new BanUsersFromRoomRequest banning a group of users.

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

Parameters
usersThe users to ban; at most 10. A single user is banned by passing a one-element list: { user }.
theRoomThe Room the users should be banned from.
messageAn optional message sent to the banned users before they are kicked out.
intervalThe duration of the ban, in the passed unit of time.
timeUnitThe unit of time the duration is expressed in.
See also
SmartFox::send

The documentation for this class was generated from the following files:
  • requests/BanUsersFromRoomRequest.h
  • requests/BanUsersFromRoomRequest.cpp