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

Banishes a user from the server. More...

#include <BanUserRequest.h>

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

Public Member Functions

 BanUserRequest (int32_t userId, std::string message="", BanMode banMode=BanMode::ByName, int32_t delaySeconds=5, int32_t durationHours=DEFAULT_DURATION_HOURS)

Static Public Attributes

static const int32_t MAX_DELAY_SECONDS = 10
 The longest delay the server accepts, in seconds.
static const int32_t DEFAULT_DURATION_HOURS = 24
 The ban duration applied when the caller states none.

Detailed Description

Banishes a user from the server.

The current user must have administration or moderation privileges to ban another user (see User::getPrivilegeId()). The user is banned by name or by IP address, as told by the BanMode. The request can carry a message explaining the reason of the disconnection, which reaches the banned user as a MODERATOR_MESSAGE event.

Unlike a kicked user, a banned user cannot connect again until the ban expires or an administrator takes his name or address off the list of banned users, through the SmartFoxServer 3 Administration Tool.

See also
event::SFSEvent::MODERATOR_MESSAGE
entities::User::getPrivilegeId
BanMode
KickUserRequest

Constructor & Destructor Documentation

◆ BanUserRequest()

sfs3::requests::BanUserRequest::BanUserRequest ( int32_t userId,
std::string message = "",
BanMode banMode = BanMode::ByName,
int32_t delaySeconds = 5,
int32_t durationHours = DEFAULT_DURATION_HOURS )
inline
Parameters
userIdthe id of the user to ban
messagethe message delivered to the user before banning him; when empty, the default message set in the SmartFoxServer 3 Administration Tool is used
banModewhether the user is banned by name or by IP address
delaySecondsthe number of seconds between the ban message and the actual disconnection; must be within 0 and 10
durationHourshow long the ban lasts, in hours; must be greater than 0

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