BanUserRequest

Banishes a User from the server.


The current User must have administration or moderation privileges in order to ban another User (see the SFSUser#privilegeId property).

A User can be banned by name or by IP address (see the BanMode class). Also, this request allows sending a message to the banned User (i.e. to explain the reason of the upcoming disconnection), which is delivered by means of the SFSEvent.MODERATOR_MESSAGE event.

Differently from a User being kicked (see the KickUserRequest), a banned User won't be able to connect to the SmartFoxServer instance until the banishment expires or an administrator removes its name/IP address from the list of banned Users in the Ban Manager module of the SmartFoxServer Administration Tool.

Constructor

new BanUserRequest(userId, messageopt, banModeopt, delaySecondsopt, durationHoursopt)

Creates a new instance of the BanUserRequest class.
Pass the instance to the SmartFox#send method to validate and execute the request.
Parameters:
NameTypeAttributesDefaultDescription
userIdnumberThe id of the User to be banned.
messagestring<optional>
nullA custom message to be delivered to the User before the banning occurs; if null, the preset message configured in the SmartFoxServer Administration Tool is used.
banModenumber<optional>
BanMode.BY_NAMEOne of the ban modes defined in the BanMode class.
delaySecondsnumber<optional>
5The delay in seconds before the User is banned after receiving the ban message.
durationHoursnumber<optional>
24The duration of the banishment, expressed in hours.