Beispiel #1
0
        private void GetEnvironmentSettings(IOSHttpResponse response, UUID agentID)
        {
            // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}",
            //      Name, agentID, caps.RegionName);

            ViewerEnvironment VEnv = null;
            ScenePresence     sp   = m_scene.GetScenePresence(agentID);

            if (sp == null)
            {
                response.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
                response.AddHeader("Retry-After", "5");
                return;
            }

            if (sp.Environment != null)
            {
                VEnv = sp.Environment;
            }
            else
            {
                if (m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride)
                {
                    ILandObject land = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
                    if (land != null && land.LandData != null && land.LandData.Environment != null)
                    {
                        VEnv = land.LandData.Environment;
                    }
                }
            }
            if (VEnv == null)
            {
                VEnv = GetRegionEnvironment();
            }

            byte[] envBytes = VEnv.ToCapWLBytes(UUID.Zero, regionID);
            if (envBytes == null)
            {
                osUTF8 sb = LLSDxmlEncode2.Start();
                LLSDxmlEncode2.AddArray(sb);
                LLSDxmlEncode2.AddMap(sb);
                LLSDxmlEncode2.AddElem("messageID", UUID.Zero, sb);
                LLSDxmlEncode2.AddElem("regionID", regionID, sb);
                LLSDxmlEncode2.AddEndMap(sb);
                LLSDxmlEncode2.AddEndArray(sb);
                response.RawBuffer = LLSDxmlEncode2.EndToBytes(sb);
            }
            else
            {
                response.RawBuffer = envBytes;
            }

            response.StatusCode = (int)HttpStatusCode.OK;
        }
Beispiel #2
0
        private void GetEnvironmentSettings(IOSHttpResponse response, UUID agentID)
        {
            // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}",
            //      Name, agentID, caps.RegionName);

            ViewerEnvironment VEnv = null;
            ScenePresence     sp   = m_scene.GetScenePresence(agentID);

            if (sp != null && sp.Environment != null)
            {
                VEnv = sp.Environment;
            }
            else
            {
                if (m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride)
                {
                    ILandObject land = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
                    if (land != null && land.LandData != null && land.LandData.Environment != null)
                    {
                        VEnv = land.LandData.Environment;
                    }
                }
                if (VEnv == null)
                {
                    VEnv = GetRegionEnvironment();
                }
            }

            //OSD d = VEnv.ToWLOSD(UUID.Zero, regionID);
            //string env = OSDParser.SerializeLLSDXmlString(d);

            //if (String.IsNullOrEmpty(env))
            byte[] envBytes = VEnv.ToCapWLBytes(UUID.Zero, regionID);
            if (envBytes == null)
            {
                StringBuilder sb = LLSDxmlEncode.Start();
                LLSDxmlEncode.AddArray(sb);
                LLSDxmlEncode.AddMap(sb);
                LLSDxmlEncode.AddElem("messageID", UUID.Zero, sb);
                LLSDxmlEncode.AddElem("regionID", regionID, sb);
                LLSDxmlEncode.AddEndMap(sb);
                LLSDxmlEncode.AddEndArray(sb);
                response.RawBuffer = LLSDxmlEncode.EndToNBBytes(sb);
            }
            else
            {
                response.RawBuffer = envBytes;
            }

            response.StatusCode = (int)HttpStatusCode.OK;
        }