コード例 #1
0
ファイル: Capabilities.cs プロジェクト: RavenB/gridsearch
        private void MakeSeedRequest()
        {
            if (Simulator == null || !Simulator.Client.Network.Connected)
                return;

            // Create a request list
            List<object> req = new List<object>();
            req.Add("MapLayer");
            req.Add("MapLayerGod");
            req.Add("NewFileAgentInventory");
            req.Add("EventQueueGet");
            req.Add("UpdateGestureAgentInventory");
            req.Add("UpdateNotecardAgentInventory");
            req.Add("UpdateScriptAgentInventory");
            req.Add("UpdateGestureTaskInventory");
            req.Add("UpdateNotecardTaskInventory");
            req.Add("UpdateScriptTaskInventory");
            req.Add("SendPostcard");
            req.Add("ViewerStartAuction");
            req.Add("ParcelGodReserveForNewbie");
            req.Add("SendUserReport");
            req.Add("SendUserReportWithScreenshot");
            req.Add("RequestTextureDownload");
            req.Add("UntrustedSimulatorMessage");
            req.Add("ParcelVoiceInfoRequest");
            req.Add("ChatSessionRequest");
            req.Add("ProvisionVoiceAccountRequest");

            byte[] postData = LLSDParser.SerializeXmlBytes(req);

            Simulator.Client.DebugLog("Making initial capabilities connection for " + Simulator.ToString());

            _SeedRequest = new CapsRequest(_SeedCapsURI, String.Empty, null);
            _SeedRequest.OnCapsResponse += new CapsRequest.CapsResponseCallback(seedRequest_OnCapsResponse);
            _SeedRequest.MakeRequest(postData, "application/xml", 0, null);
        }
コード例 #2
0
ファイル: InventoryManager.cs プロジェクト: RavenB/gridsearch
        private void CreateItemFromAssetResponse(object response, HttpRequestState state)
        {
            Dictionary<string, object> contents = (Dictionary<string, object>)response;
            KeyValuePair<ItemCreatedFromAssetCallback, byte[]> kvp = (KeyValuePair<ItemCreatedFromAssetCallback, byte[]>)state.State;
            ItemCreatedFromAssetCallback callback = kvp.Key;
            byte[] itemData = (byte[])kvp.Value;

            string status = (string)contents["state"];

            if (status == "upload")
            {
                string uploadURL = (string)contents["uploader"];

                // This makes the assumption that all uploads go to CurrentSim, to avoid
                // the problem of HttpRequestState not knowing anything about simulators
                CapsRequest upload = new CapsRequest(uploadURL, _Client.Network.CurrentSim);
                upload.OnCapsResponse += new CapsRequest.CapsResponseCallback(CreateItemFromAssetResponse);
                upload.MakeRequest(itemData, "application/octet-stream", 0, kvp);
            }
            else if (status == "complete")
            {
                if (contents.ContainsKey("new_inventory_item") && contents.ContainsKey("new_asset"))
                {
                    try { callback(true, String.Empty, (LLUUID)contents["new_inventory_item"], (LLUUID)contents["new_asset"]); }
                    catch (Exception e) { _Client.Log(e.ToString(), Helpers.LogLevel.Error); }
                }
                else
                {
                    try { callback(false, "Failed to parse asset and item UUIDs", LLUUID.Zero, LLUUID.Zero); }
                    catch (Exception e) { _Client.Log(e.ToString(), Helpers.LogLevel.Error); }
                }
            }
            else
            {
                // Failure
                try { callback(false, status, LLUUID.Zero, LLUUID.Zero); }
                catch (Exception e) { _Client.Log(e.ToString(), Helpers.LogLevel.Error); }
            }
        }
コード例 #3
0
ファイル: NetworkManager.cs プロジェクト: RavenB/gridsearch
 public void SendCapsRequest(string uri, Hashtable body, CapsRequest.CapsResponseCallback callback)
 {
     CapsRequest request = new CapsRequest(uri, Client.Network.CurrentSim);
     request.OnCapsResponse += new CapsRequest.CapsResponseCallback(callback);
     request.MakeRequest();
 }
コード例 #4
0
ファイル: RegistrationApi.cs プロジェクト: RavenB/gridsearch
        /// <summary>
        /// Returns the new user ID or throws an exception containing the error code
        /// The error codes can be found here: https://wiki.secondlife.com/wiki/RegAPIError
        /// </summary>
        /// <param name="user">New user account to create</param>
        /// <returns>The UUID of the new user account</returns>
        public LLUUID CreateUser(CreateUserParam user)
        {
            if (Initializing)
                throw new InvalidOperationException("still initializing");

            if (_caps.CreateUser == null)
                throw new InvalidOperationException("access denied; only approved developers have access to the registration api");

            // Create the POST data
            Dictionary<string, object> query = new Dictionary<string, object>();
            query.Add("username", user.FirstName);
            query.Add("last_name_id", user.LastName.ID);
            query.Add("email", user.Email);
            query.Add("password", user.Password);
            query.Add("dob", user.Birthdate.ToString("yyyy-MM-dd"));

            if (user.LimitedToEstate != null)
                query.Add("limited_to_estate", user.LimitedToEstate.Value);

            if (!string.IsNullOrEmpty(user.StartRegionName))
                query.Add("start_region_name", user.LimitedToEstate.Value);

            if (user.StartLocation != null)
            {
                query.Add("start_local_x", user.StartLocation.Value.X);
                query.Add("start_local_y", user.StartLocation.Value.Y);
                query.Add("start_local_z", user.StartLocation.Value.Z);
            }

            if (user.StartLookAt != null)
            {
                query.Add("start_look_at_x", user.StartLookAt.Value.X);
                query.Add("start_look_at_y", user.StartLookAt.Value.Y);
                query.Add("start_look_at_z", user.StartLookAt.Value.Z);
            }

            byte[] postData = LLSDParser.SerializeXmlBytes(query);

            // Make the request
            CapsRequest request = new CapsRequest(_caps.CreateUser.AbsoluteUri, String.Empty, null);
            request.OnCapsResponse += new CapsRequest.CapsResponseCallback(CreateUserResponse);
            request.MakeRequest(postData, "application/xml", 0, null);

            // FIXME: Block
            return LLUUID.Zero;
        }
コード例 #5
0
ファイル: InventoryManager.cs プロジェクト: RavenB/gridsearch
        public void RequestCreateItemFromAsset(byte[] data, string name, string description, AssetType assetType,
            InventoryType invType, LLUUID folderID, ItemCreatedFromAssetCallback callback)
        {
            if (_Client.Network.CurrentSim == null || _Client.Network.CurrentSim.Caps == null)
                throw new Exception("NewFileAgentInventory capability is not currently available");

            string url = _Client.Network.CurrentSim.Caps.CapabilityURI("NewFileAgentInventory");

            if (url != String.Empty)
            {
                Dictionary<string, object> query = new Dictionary<string, object>();
                query.Add("folder_id", folderID);
                query.Add("asset_type", AssetTypeToString(assetType));
                query.Add("inventory_type", InventoryTypeToString(invType));
                query.Add("name", name);
                query.Add("description", description);

                byte[] postData = LLSD.LLSDParser.SerializeXmlBytes(query);

                // Make the request
                CapsRequest request = new CapsRequest(url, _Client.Network.CurrentSim);
                request.OnCapsResponse += new CapsRequest.CapsResponseCallback(CreateItemFromAssetResponse);
                request.MakeRequest(postData, "application/xml", 0, new KeyValuePair<ItemCreatedFromAssetCallback, byte[]>(callback, data));
            }
            else
            {
                throw new Exception("NewFileAgentInventory capability is not currently available");
            }
        }
コード例 #6
0
ファイル: RegistrationApi.cs プロジェクト: RavenB/gridsearch
        public bool CheckName(string firstName, LastName lastName)
        {
            if (Initializing)
                throw new InvalidOperationException("still initializing");

            if (_caps.CheckName == null)
                throw new InvalidOperationException("access denied; only approved developers have access to the registration api");

            // Create the POST data
            Dictionary<string, object> query = new Dictionary<string, object>();
            query.Add("username", firstName);
            query.Add("last_name_id", lastName.ID);
            byte[] postData = LLSDParser.SerializeXmlBytes(query);

            CapsRequest request = new CapsRequest(_caps.CheckName.AbsoluteUri, String.Empty, null);
            request.OnCapsResponse += new CapsRequest.CapsResponseCallback(CheckNameResponse);
            request.MakeRequest(postData, "application/xml", 0, null);

            // FIXME:
            return false;
        }
コード例 #7
0
ファイル: RegistrationApi.cs プロジェクト: RavenB/gridsearch
        public void GatherLastNames()
        {
            if (Initializing)
                throw new InvalidOperationException("still initializing");

            if (_caps.GetLastNames == null)
                throw new InvalidOperationException("access denied: only approved developers have access to the registration api");

            CapsRequest request = new CapsRequest(_caps.GetLastNames.AbsoluteUri, String.Empty, null);
            request.OnCapsResponse += new CapsRequest.CapsResponseCallback(GatherLastNamesResponse);
            request.MakeRequest();

            // FIXME: Block
        }
コード例 #8
0
ファイル: RegistrationApi.cs プロジェクト: RavenB/gridsearch
        private void GatherErrorMessages()
        {
            if (_caps.GetErrorCodes == null)
                throw new InvalidOperationException("access denied");	// this should work even for not-approved users

            CapsRequest request = new CapsRequest(_caps.GetErrorCodes.AbsoluteUri, String.Empty, null);
            request.OnCapsResponse += new CapsRequest.CapsResponseCallback(GatherErrorMessagesResponse);
            request.MakeRequest();
        }
コード例 #9
0
ファイル: RegistrationApi.cs プロジェクト: RavenB/gridsearch
        private void GatherCaps()
        {
            CapsRequest request = new CapsRequest(RegistrationApiCaps.AbsoluteUri, String.Empty, null);
            request.OnCapsResponse += new CapsRequest.CapsResponseCallback(GatherCapsResponse);

            // build post data
            byte[] postData = Encoding.ASCII.GetBytes(
                String.Format("first_name={0}&last_name={1}&password={2}", _userInfo.FirstName, _userInfo.LastName, 
                _userInfo.Password));

            // send
            request.MakeRequest(postData, "application/xml", 0, null);
        }
コード例 #10
0
ファイル: VoiceManager.cs プロジェクト: RavenB/gridsearch
        public bool RequestProvisionAccount()
        {
            if (Enabled && Client.Network.Connected)
            {
                if (Client.Network.CurrentSim != null && Client.Network.CurrentSim.Caps != null)
                {
                    string requestURI = Client.Network.CurrentSim.Caps.CapabilityURI("ProvisionVoiceAccountRequest");

                    if (requestURI != String.Empty)
                    {
                        CapsRequest request = new CapsRequest(requestURI, Client.Network.CurrentSim);
                        request.OnCapsResponse += new CapsRequest.CapsResponseCallback(ProvisionCapsResponse);
                        request.MakeRequest();

                        return true;
                    }
                    else
                    {
                        Client.Log("VoiceManager.RequestProvisionAccount(): ProvisionVoiceAccountRequest capability is missing", 
                            Helpers.LogLevel.Info);
                        return false;
                    }
                }
            }

            Client.Log("VoiceManager.RequestProvisionAccount(): Voice system is currently disabled", Helpers.LogLevel.Info);
            return false;
        }