Aw server world list

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 3.1
SDKbuild 18
Worldbuild 28


int aw_server_world_list (void)

Description

Lists all the world configurations in a world server.

Callback

AW_CALLBACK_ADMIN_WORLD_LIST

Notes

This method returns a list of all world configurations currently installed in a world server. The individual world configurations are returned via the event AW_EVENT_ADMIN_WORLD_INFO. The attribute AW_SERVER_ID must be set to 0 before the first call to aw_server_world_list.

A single call to this method may not be enough to return all the world configurations in a server. Applications should check the value of AW_SERVER_MORE to determine if more calls to aw_server_world_list are needed. Subsequent calls will use the value of AW_SERVER_ID to determine where to continue from.

Arguments

None

Argument attributes

AW_SERVER_ID
Used to determine where the listing should continue from. Must be set to 0 before the first call to this method.

Return values

RC_SUCCESS (1) (2)
RC_NOT_INITIALIZED (1)
RC_NO_INSTANCE (1)
RC_NO_CONNECTION (1)
The connection to the world is down.
RC_UNAUTHORIZED
Only world server administration instances may use this method.

(1) Possible return values when a callback is installed.

(2) Returned by the world server.

Returned attributes

AW_SERVER_ID

Usage

List the names of all worlds in this server.

void handle_world_info (void)
{
  printf ("%s\n", aw_string (AW_SERVER_NAME));
}

void list_worlds (void)
{
  int rc;
  
  aw_callback_set (AW_CALLBACK_ADMIN_WORLD_LIST, NULL);
  aw_event_set (AW_EVENT_ADMIN_WORLD_INFO, handle_world_info);
  
  aw_int_set (AW_SERVER_ID, 0);
  
  do
  {
    rc = aw_server_world_list ();
    if (rc != RC_SUCCESS)
    {
      printf ("Unable to query world list (reason %d)\n", rc);
      break;
    }
  }
  while (aw_bool (AW_SERVER_MORE));
}

See also