Aw world eject

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13


int aw_world_eject (void)

Description

Ejects a user from the world.

Callback

None (returns immediately)

Notes

Up to 3 different ejection types will be added to the world ejection database for each user ejected:

  • Every eject adds an IP address block (AW_EJECT_BY_ADDRESS) for the IP address of the user being ejected.

For world server version 3.3 and later:

  • If the user is on a computer with a unique ID (not every computer has one), a second ejection of type AW_EJECT_BY_COMPUTER is also added. This type of ejection will keep the user out even if they change their IP address.
  • If the ejected user is a citizen then a third ejection of type AW_EJECT_BY_CITIZEN is added. This type of ejection will keep the user out as long as they remain on that citizen account.

Only world server administration instances or those owned by a caretaker (i.e. aw_bool (AW_WORLD_CARETAKER_CAPABILITY) returns 1) or those with eject capability (i.e. aw_bool (AW_WORLD_EJECT_CAPABILITY) returns 1) may use this method.

Arguments

None

Argument attributes

AW_EJECT_SESSION
Session number of the user to be ejected.
AW_EJECT_DURATION
Number of seconds the ejection will persist. If set to 0 (zero) then it will never expire.

Return values

RC_SUCCESS
RC_NOT_INITIALIZED
RC_NO_INSTANCE
RC_NO_CONNECTION
The connection to the world is down.

Returned attributes

None

Usage

Eject a user for saying a bad word.

#define BAD_WORD "fiddlesticks"

void handle_chat (void)
{
  if (strstr (aw_string (AW_CHAT_MESSAGE), BAD_WORD))
  {
    aw_int_set (AW_EJECT_SESSION, aw_int (AW_CHAT_SESSION));
    aw_int_set (AW_EJECT_DURATION, 5 * 60); /* eject for 5 minutes */
    if (aw_world_eject ())
      printf ("Unable to eject session %d\n", aw_int (AW_CHAT_SESSION));
    else
      printf ("Session %d ejected\n", aw_int (AW_CHAT_SESSION));
  }
}

aw_event_set (AW_EVENT_CHAT, handle_chat);

See also