aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Capabilities/LLSDEnvironmentSettings.cs68
-rw-r--r--OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs64
2 files changed, 40 insertions, 92 deletions
diff --git a/OpenSim/Capabilities/LLSDEnvironmentSettings.cs b/OpenSim/Capabilities/LLSDEnvironmentSettings.cs
deleted file mode 100644
index 39019af..0000000
--- a/OpenSim/Capabilities/LLSDEnvironmentSettings.cs
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31
32namespace OpenSim.Framework.Capabilities
33{
34 [OSDMap]
35 public class LLSDEnvironmentRequest
36 {
37 public UUID messageID;
38 public UUID regionID;
39 }
40
41 [OSDMap]
42 public class LLSDEnvironmentSetResponse
43 {
44 public UUID regionID;
45 public UUID messageID;
46 public Boolean success;
47 public String fail_reason;
48 }
49
50 public class EnvironmentSettings
51 {
52 /// <summary>
53 /// generates a empty llsd settings response for viewer
54 /// </summary>
55 /// <param name="messageID">the message UUID</param>
56 /// <param name="regionID">the region UUID</param>
57 public static string EmptySettings(UUID messageID, UUID regionID)
58 {
59 OSDArray arr = new OSDArray();
60 LLSDEnvironmentRequest msg = new LLSDEnvironmentRequest();
61 msg.messageID = messageID;
62 msg.regionID = regionID;
63 arr.Array.Add(msg);
64 return LLSDHelpers.SerialiseLLSDReply(arr);
65 }
66 }
67
68}
diff --git a/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs
index c3cea7a..02378f2 100644
--- a/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs
+++ b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using System.Text;
30using OpenMetaverse; 31using OpenMetaverse;
31using OpenSim.Framework; 32using OpenSim.Framework;
32using OpenSim.Framework.Capabilities; 33using OpenSim.Framework.Capabilities;
@@ -55,8 +56,6 @@ namespace OpenSim.Region.CoreModules.World.LightShare
55 private static readonly string capsName = "EnvironmentSettings"; 56 private static readonly string capsName = "EnvironmentSettings";
56 private static readonly string capsBase = "/CAPS/0020/"; 57 private static readonly string capsBase = "/CAPS/0020/";
57 58
58 private LLSDEnvironmentSetResponse setResponse = null;
59
60 #region INonSharedRegionModule 59 #region INonSharedRegionModule
61 public void Initialise(IConfigSource source) 60 public void Initialise(IConfigSource source)
62 { 61 {
@@ -105,7 +104,6 @@ namespace OpenSim.Region.CoreModules.World.LightShare
105 if (!Enabled) 104 if (!Enabled)
106 return; 105 return;
107 106
108 setResponse = new LLSDEnvironmentSetResponse();
109 scene.EventManager.OnRegisterCaps += OnRegisterCaps; 107 scene.EventManager.OnRegisterCaps += OnRegisterCaps;
110 } 108 }
111 109
@@ -179,7 +177,16 @@ namespace OpenSim.Region.CoreModules.World.LightShare
179 } 177 }
180 178
181 if (String.IsNullOrEmpty(env)) 179 if (String.IsNullOrEmpty(env))
182 env = EnvironmentSettings.EmptySettings(UUID.Zero, regionID); 180 {
181 StringBuilder sb = LLSDxmlEncode.Start();
182 LLSDxmlEncode.AddArray(sb);
183 LLSDxmlEncode.AddMap(sb);
184 LLSDxmlEncode.AddElem("messageID", UUID.Zero, sb);
185 LLSDxmlEncode.AddElem("regionID", regionID, sb);
186 LLSDxmlEncode.AddEndMap(sb);
187 LLSDxmlEncode.AddEndArray(sb);
188 env = LLSDxmlEncode.End(sb);
189 }
183 190
184 return env; 191 return env;
185 } 192 }
@@ -191,33 +198,42 @@ namespace OpenSim.Region.CoreModules.World.LightShare
191 // m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}", 198 // m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}",
192 // Name, agentID, caps.RegionName); 199 // Name, agentID, caps.RegionName);
193 200
194 setResponse.regionID = regionID; 201 bool success = false;
195 setResponse.success = false; 202 string fail_reason = "";
196 203
197 if (!m_scene.Permissions.CanIssueEstateCommand(agentID, false)) 204 if (!m_scene.Permissions.CanIssueEstateCommand(agentID, false))
198 { 205 {
199 setResponse.fail_reason = "Insufficient estate permissions, settings has not been saved."; 206 fail_reason = "Insufficient estate permissions, settings has not been saved.";
200 return LLSDHelpers.SerialiseLLSDReply(setResponse);
201 } 207 }
202 208 else
203 try
204 { 209 {
205 m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request); 210 try
206 setResponse.success = true; 211 {
207 212 m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request);
208 m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}", 213 success = true;
209 Name, agentID, caps.RegionName); 214
210 } 215 m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}",
211 catch (Exception e) 216 Name, agentID, caps.RegionName);
212 { 217 }
213 m_log.ErrorFormat("[{0}]: Environment settings has not been saved for region {1}, Exception: {2} - {3}", 218 catch (Exception e)
214 Name, caps.RegionName, e.Message, e.StackTrace); 219 {
215 220 m_log.ErrorFormat("[{0}]: Environment settings has not been saved for region {1}, Exception: {2} - {3}",
216 setResponse.success = false; 221 Name, caps.RegionName, e.Message, e.StackTrace);
217 setResponse.fail_reason = String.Format("Environment Set for region {0} has failed, settings has not been saved.", caps.RegionName); 222
223 success = false;
224 fail_reason = String.Format("Environment Set for region {0} has failed, settings not saved.", caps.RegionName);
225 }
218 } 226 }
219 227
220 return LLSDHelpers.SerialiseLLSDReply(setResponse); 228 StringBuilder sb = LLSDxmlEncode.Start();
229 LLSDxmlEncode.AddMap(sb);
230 LLSDxmlEncode.AddElem("messageID", UUID.Zero, sb);
231 LLSDxmlEncode.AddElem("regionID", regionID, sb);
232 LLSDxmlEncode.AddElem("success", success, sb);
233 if(!success)
234 LLSDxmlEncode.AddElem("fail_reason", fail_reason, sb);
235 LLSDxmlEncode.AddEndMap(sb);
236 return LLSDxmlEncode.End(sb);
221 } 237 }
222 } 238 }
223} 239}