|
SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
|
Bans one or more users from a Room for a certain amount of time. More...
#include <BanUsersFromRoomRequest.h>
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. | |
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.
|
inline |
Creates a new BanUsersFromRoomRequest banning a group of users.
Pass it to SmartFox::send for the request to be performed.
| users | The users to ban; at most 10. A single user is banned by passing a one-element list: { user }. |
| theRoom | The Room the users should be banned from. |
| message | An optional message sent to the banned users before they are kicked out. |
| interval | The duration of the ban, in the passed unit of time. |
| timeUnit | The unit of time the duration is expressed in. |