function create_opensim_presence($scene, $userID, $circuitCode, $fullName, $appearance, $sessionID, $secureSessionID, $startPosition, &$seedCapability) { $config =& get_config(); $serviceurls = array('GatekeeperURI' => $config['hypergrid_uri'], 'HomeURI' => $config['hypergrid_uri'], 'InventoryServerURI' => $config['hg_inventory_service'], 'AssetServerURI' => $config['hg_asset_service'], 'ProfileServerURI' => $config['hg_user_service'], 'FriendsServerURI' => $config['hypergrid_uri'], 'IMServerURI' => $config['hypergrid_uri']); $capsPath = UUID::Random(); return create_opensim_presence_full($scene->Address, $scene->Name, $scene->SceneID, $scene->MinPosition->X, $scene->MinPosition->Y, $userID, $circuitCode, $fullName, $appearance, $sessionID, $secureSessionID, $startPosition, $capsPath, null, $serviceurls, 128, null, $seedCapability); }
function foreignagent_handler($path_tail, $data) { log_message('debug', "server method is " . $_SERVER['REQUEST_METHOD']); $userid = $path_tail[0]; log_message('info', "foreign_agent called for {$userid} with {$data}"); $osd = decode_recursive_json($data); $dest_x = $osd['destination_x']; $dest_y = $osd['destination_y']; if ($dest_x == null) { $dest_x = 0; } if ($dest_y == null) { $dest_y = 0; } $caps_path = $osd['caps_path']; $username = $osd['first_name'] . ' ' . $osd['last_name']; $circuit_code = $osd['circuit_code']; $session_id = $osd['session_id']; $secure_session_id = $osd['secure_session_id']; $service_session_id = $osd['service_session_id']; $start_pos = $osd['start_pos']; $appearance = $osd['wearables']; if (isset($osd['attachments'])) { $attachments = $osd['attachments']; } else { $attachments = array(); } $service_urls['HomeURI'] = $osd['service_urls'][1]; $service_urls['GatekeeperURI'] = $osd['service_urls'][3]; $service_urls['InventoryServerURI'] = $osd['service_urls'][5]; $service_urls['AssetServerURI'] = $osd['service_urls'][7]; $client_ip = $osd['client_ip']; $dest_uuid = $osd['destination_uuid']; $dest_name = $osd['destination_name']; if ($dest_uuid == null || $dest_name == null) { header("HTTP/1.1 400 Bad Request"); echo "missing destination_name and/or destination_uuid"; exit; } $scene = lookup_scene_by_id($dest_uuid); $username = $osd['first_name'] . ' ' . $osd['last_name'] . '@' . $service_urls['HomeURI']; bump_user($userid, $username, "{$username}@HG LOLOL"); create_session($userid, $session_id, $secure_session_id); $result = create_opensim_presence_full($scene->Address, $dest_name, $dest_uuid, $dest_x, $dest_y, $userid, $circuit_code, $username, $appearance, $attachments, $session_id, $secure_session_id, $start_pos, $caps_path, $client_ip, $service_urls, 1073741824, $service_session_id); echo "{'success': {$result}, 'reason': 'no reason set lol', 'your_ip': '" . $_SERVER['REMOTE_ADDR'] . "'}"; exit; }
function foreignagent_handler($path_tail, $data) { log_message('info', "[hypergrid] foreignagent_handler called"); $data = decodedata($data); $config =& get_config(); $userid = $path_tail[0]; log_message('info', "foreign_agent called for {$userid} with {$data}"); $osd = decode_recursive_json($data); if ($osd == null) { log_message('error', sprintf('[hypergrid] failed to decode foreignagent json string %s', $data)); sendresponse(false, 'failed to decode foreignagent string'); } $dest_x = $osd['destination_x']; $dest_y = $osd['destination_y']; if ($dest_x == null) { $dest_x = 0; } if ($dest_y == null) { $dest_y = 0; } $caps_path = $osd['caps_path']; $username = $osd['first_name'] . ' ' . $osd['last_name']; $circuit_code = $osd['circuit_code']; $session_id = $osd['session_id']; $secure_session_id = $osd['secure_session_id']; $service_session_id = $osd['service_session_id']; $start_pos = $osd['start_pos']; $appearance = $osd['packed_appearance']; //$service_urls['HomeURI'] = $osd['service_urls'][1]; //$service_urls['GatekeeperURI'] = $osd['service_urls'][3]; //$service_urls['InventoryServerURI'] = $osd['service_urls'][5]; //$service_urls['AssetServerURI'] = $osd['service_urls'][7]; if (isset($osd['client_ip'])) { $client_ip = $osd['client_ip']; } else { log_message('info', '[hypergrid] no client ip specified in foreignagent request'); $client_ip = null; } if (empty($osd['destination_uuid'])) { header("HTTP/1.1 400 Bad Request"); echo "missing destination_uuid"; exit; } $dest_uuid = $osd['destination_uuid']; $scene = lookup_scene_by_id($dest_uuid); if ($scene == null) { header("HTTP/1.1 400 Bad Request"); echo "invalid destination uuid"; exit; } $dest_name = $scene->Name; $homeuri = $osd['serviceurls']['HomeURI']; // $username = $osd['first_name'] . ' ' . $osd['last_name'] . '@' . $service_urls['HomeURI']; $username = $osd['first_name'] . ' ' . $osd['last_name']; log_message('info', "[hypergrid] check user name {$username} with homeuri {$homeuri}"); if ($homeuri != $config['hypergrid_uri']) { $username = $username . '@' . $homeuri; hg_register_user($userid, $username, $homeuri); } $extradata = null; if ($client_ip != null) { $extradata = array('ClientIP' => $client_ip); } log_message('info', "[hypergrid] create session for {$username}"); create_session($userid, $session_id, $secure_session_id, $extradata); $result = create_opensim_presence_full($scene->Address, $dest_name, $dest_uuid, $dest_x, $dest_y, $userid, $circuit_code, $username, $appearance, $session_id, $secure_session_id, $start_pos, $caps_path, $client_ip, $osd['serviceurls'], 1073741824, $service_session_id, $seedCaps); sendresponse($result, 'no reason given'); }