Aw url send

From ActiveWiki
Jump to navigation Jump to search
Minimum requirements
Added in version 2.2
SDKbuild 14
Worldbuild 21
Browserbuild 303


int aw_url_send (int session_id, const char *url, const char *target)

Description

Sends a URL to the web browser of another user.

Callback

None (returns immediately)

Notes

The URL is sent via the world server. Thus, URLs can only be sent to users who are in the same world as the calling SDK application.

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

Arguments

session_id
Session number of the recepient of the URL. If set to 0 then the URL will be sent to everyone in the world.
url
URL to send.
target
Optional target frame. If no target frame is desired then this argument can be set to NULL. Note that If target specifies a nonexistent frame, the URL will be displayed in a new, standalone window on the user's PC.

Argument attributes

AW_URL_POST
If set then the browser will perform a post request using the specified data.
AW_URL_TARGET_3D
If set to 1 (true) then the browser will display the page in its viewport. This is the same as using "aw_3d" as the target frame for the object action "url" command (e.g. "activate url www.activeworlds.com target=aw_3d").

Return values

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

Returned attributes

None

Usage

Send the user's web browser to the Active Worlds home page if they click on the bot's avatar.

void handle_avatar_click (void)
{
  /* For version 3.5 and later: target the aw_3d view and specify post data */
  aw_bool_set (AW_URL_TARGET_3D, 1);
  aw_string_set (AW_URL_POST, "foo=bar&text=hello%20world");
  
  if (aw_int (AW_CLICKED_SESSION) == aw_session ())
    aw_url_send (aw_int (AW_AVATAR_SESSION), "www.activeworlds.com", NULL);
}

aw_event_set (AW_EVENT_AVATAR_CLICK, handle_avatar_click);

See also