Пример #1
0
        private bool RequestVoiceInternal(string me, CapsClient.CompleteCallback callback, string capsName)
        {
            if (Enabled && Client.Network.Connected)
            {
                if (Client.Network.CurrentSim != null && Client.Network.CurrentSim.Caps != null)
                {
                    Uri url = Client.Network.CurrentSim.Caps.CapabilityURI(capsName);

                    if (url != null)
                    {
                        CapsClient request = new CapsClient(url);
                        LLSDMap    body    = new LLSDMap();
                        request.OnComplete += new CapsClient.CompleteCallback(callback);
                        request.StartRequest(body);

                        return(true);
                    }
                    else
                    {
                        Logger.Log("VoiceManager." + me + "(): " + capsName + " capability is missing",
                                   Helpers.LogLevel.Info, Client);
                        return(false);
                    }
                }
            }

            Logger.Log("VoiceManager.RequestVoiceInternal(): Voice system is currently disabled",
                       Helpers.LogLevel.Info, Client);
            return(false);
        }
Пример #2
0
        private void MakeSeedRequest()
        {
            if (Simulator == null || !Simulator.Client.Network.Connected)
            {
                return;
            }

            // Create a request list
            LLSDArray req = new LLSDArray();

            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");

            _SeedRequest             = new CapsClient(new Uri(_SeedCapsURI));
            _SeedRequest.OnComplete += new CapsClient.CompleteCallback(SeedRequestCompleteHandler);
            _SeedRequest.StartRequest(req);
        }
Пример #3
0
        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
            LLSDMap query = new LLSDMap();

            query.Add("username", LLSD.FromString(firstName));
            query.Add("last_name_id", LLSD.FromInteger(lastName.ID));
            //byte[] postData = LLSDParser.SerializeXmlBytes(query);

            CapsClient request = new CapsClient(_caps.CheckName);

            request.OnComplete += new CapsClient.CompleteCallback(CheckNameResponse);
            request.StartRequest();

            // FIXME:
            return(false);
        }
Пример #4
0
        public bool RequestProvisionAccount()
        {
            if (Enabled && Client.Network.Connected)
            {
                if (Client.Network.CurrentSim != null && Client.Network.CurrentSim.Caps != null)
                {
                    Uri url = Client.Network.CurrentSim.Caps.CapabilityURI("ProvisionVoiceAccountRequest");

                    if (url != null)
                    {
                        CapsClient request = new CapsClient(url);
                        request.OnComplete += new CapsClient.CompleteCallback(ProvisionCapsResponse);
                        request.StartRequest();

                        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);
        }
Пример #5
0
        /// <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 UUID 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
            LLSDMap query = new LLSDMap();

            query.Add("username", LLSD.FromString(user.FirstName));
            query.Add("last_name_id", LLSD.FromInteger(user.LastName.ID));
            query.Add("email", LLSD.FromString(user.Email));
            query.Add("password", LLSD.FromString(user.Password));
            query.Add("dob", LLSD.FromString(user.Birthdate.ToString("yyyy-MM-dd")));

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

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

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

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

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

            // Make the request
            CapsClient request = new CapsClient(_caps.CreateUser);

            request.OnComplete += new CapsClient.CompleteCallback(CreateUserResponse);
            request.StartRequest();

            // FIXME: Block
            return(UUID.Zero);
        }
Пример #6
0
        private void GatherErrorMessages()
        {
            if (_caps.GetErrorCodes == null)
            {
                throw new InvalidOperationException("access denied");   // this should work even for not-approved users
            }
            CapsClient request = new CapsClient(_caps.GetErrorCodes);

            request.OnComplete += new CapsClient.CompleteCallback(GatherErrorMessagesResponse);
            request.StartRequest();
        }
Пример #7
0
        private void GatherCaps()
        {
            // build post data
            byte[] postData = Encoding.ASCII.GetBytes(
                String.Format("first_name={0}&last_name={1}&password={2}", _userInfo.FirstName, _userInfo.LastName,
                              _userInfo.Password));

            CapsClient request = new CapsClient(RegistrationApiCaps);

            request.OnComplete += new CapsClient.CompleteCallback(GatherCapsResponse);
            request.StartRequest(postData);
        }
Пример #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="layer"></param>
        public void RequestMapLayer(GridLayerType layer)
        {
            Uri url = Client.Network.CurrentSim.Caps.CapabilityURI("MapLayer");

            if (url != null)
            {
                LLSDMap body = new LLSDMap();
                body["Flags"] = LLSD.FromInteger((int)layer);

                CapsClient request = new CapsClient(url);
                request.OnComplete += new CapsClient.CompleteCallback(MapLayerResponseHandler);
                request.StartRequest(body);
            }
        }
Пример #9
0
        private void MakeSeedRequest()
        {
            if (Simulator == null || !Simulator.Client.Network.Connected)
            {
                return;
            }

            // Create a request list
            OSDArray req = new OSDArray();

            req.Add("ChatSessionRequest");
            req.Add("CopyInventoryFromNotecard");
            req.Add("DispatchRegionInfo");
            req.Add("EstateChangeInfo");
            req.Add("EventQueueGet");
            req.Add("FetchInventoryDescendents");
            req.Add("GroupProposalBallot");
            req.Add("MapLayer");
            req.Add("MapLayerGod");
            req.Add("NewFileAgentInventory");
            req.Add("ParcelPropertiesUpdate");
            req.Add("ParcelVoiceInfoRequest");
            req.Add("ProvisionVoiceAccountRequest");
            req.Add("RemoteParcelRequest");
            req.Add("RequestTextureDownload");
            req.Add("SearchStatRequest");
            req.Add("SearchStatTracking");
            req.Add("SendPostcard");
            req.Add("SendUserReport");
            req.Add("SendUserReportWithScreenshot");
            req.Add("ServerReleaseNotes");
            req.Add("StartGroupProposal");
            req.Add("UpdateGestureAgentInventory");
            req.Add("UpdateNotecardAgentInventory");
            req.Add("UpdateScriptAgent");
            req.Add("UpdateGestureTaskInventory");
            req.Add("UpdateNotecardTaskInventory");
            req.Add("UpdateScriptTask");
            req.Add("ViewerStartAuction");
            req.Add("UntrustedSimulatorMessage");
            req.Add("ViewerStats");

            _SeedRequest             = new CapsClient(new Uri(_SeedCapsURI));
            _SeedRequest.OnComplete += new CapsClient.CompleteCallback(SeedRequestCompleteHandler);
            _SeedRequest.StartRequest(req);
        }
Пример #10
0
        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");
            }

            CapsClient request = new CapsClient(_caps.GetLastNames);

            request.OnComplete += new CapsClient.CompleteCallback(GatherLastNamesResponse);
            request.StartRequest();

            // FIXME: Block
        }
Пример #11
0
        private void BeginLogin()
        {
            LoginParams loginParams = CurrentContext.Value;

            // Sanity check
            if (loginParams.Options == null)
            {
                loginParams.Options = new List <string>();
            }

            // Convert the password to MD5 if it isn't already
            if (loginParams.Password.Length != 35 && !loginParams.Password.StartsWith("$1$"))
            {
                loginParams.Password = Utils.MD5(loginParams.Password);
            }

            // Override SSL authentication mechanisms. DO NOT convert this to the
            // .NET 2.0 preferred method, the equivalent function in Mono has a
            // different name and it will break compatibility!
            #pragma warning disable 0618
            ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();
            // TODO: At some point, maybe we should check the cert?

            // Create the CAPS login structure
            OSDMap loginLLSD = new OSDMap();
            loginLLSD["first"]         = OSD.FromString(loginParams.FirstName);
            loginLLSD["last"]          = OSD.FromString(loginParams.LastName);
            loginLLSD["passwd"]        = OSD.FromString(loginParams.Password);
            loginLLSD["start"]         = OSD.FromString(loginParams.Start);
            loginLLSD["channel"]       = OSD.FromString(loginParams.Channel);
            loginLLSD["version"]       = OSD.FromString(loginParams.Version);
            loginLLSD["platform"]      = OSD.FromString(loginParams.Platform);
            loginLLSD["mac"]           = OSD.FromString(loginParams.MAC);
            loginLLSD["agree_to_tos"]  = OSD.FromBoolean(true);
            loginLLSD["read_critical"] = OSD.FromBoolean(true);
            loginLLSD["viewer_digest"] = OSD.FromString(loginParams.ViewerDigest);
            loginLLSD["id0"]           = OSD.FromString(loginParams.id0);

            // Create the options LLSD array
            OSDArray optionsOSD = new OSDArray();
            for (int i = 0; i < loginParams.Options.Count; i++)
            {
                optionsOSD.Add(OSD.FromString(loginParams.Options[i]));
            }
            foreach (string[] callbackOpts in CallbackOptions.Values)
            {
                if (callbackOpts != null)
                {
                    for (int i = 0; i < callbackOpts.Length; i++)
                    {
                        if (!optionsOSD.Contains(callbackOpts[i]))
                        {
                            optionsOSD.Add(callbackOpts[i]);
                        }
                    }
                }
            }
            loginLLSD["options"] = optionsOSD;

            // Make the CAPS POST for login
            Uri loginUri;
            try
            {
                loginUri = new Uri(loginParams.URI);
            }
            catch (Exception ex)
            {
                Logger.Log(String.Format("Failed to parse login URI {0}, {1}", loginParams.URI, ex.Message),
                           Helpers.LogLevel.Error, Client);
                return;
            }

            CapsClient loginRequest = new CapsClient(loginUri);
            loginRequest.OnComplete += new CapsClient.CompleteCallback(LoginReplyHandler);
            loginRequest.UserData    = CurrentContext;
            UpdateLoginStatus(LoginStatus.ConnectingToLogin, String.Format("Logging in as {0} {1}...", loginParams.FirstName, loginParams.LastName));
            loginRequest.StartRequest(OSDParser.SerializeLLSDXmlBytes(loginLLSD), "application/xml+llsd");
        }