diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 191bccf..7d9f935 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs | |||
@@ -59,6 +59,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
59 | // private static readonly ILog m_log = | 59 | // private static readonly ILog m_log = |
60 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 60 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
61 | 61 | ||
62 | public event SimulatorFeaturesRequestDelegate OnSimulatorFeaturesRequest; | ||
63 | |||
62 | private Scene m_scene; | 64 | private Scene m_scene; |
63 | 65 | ||
64 | /// <summary> | 66 | /// <summary> |
@@ -68,6 +70,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
68 | 70 | ||
69 | private string m_MapImageServerURL = string.Empty; | 71 | private string m_MapImageServerURL = string.Empty; |
70 | private string m_SearchURL = string.Empty; | 72 | private string m_SearchURL = string.Empty; |
73 | private bool m_ExportSupported = false; | ||
71 | 74 | ||
72 | #region ISharedRegionModule Members | 75 | #region ISharedRegionModule Members |
73 | 76 | ||
@@ -85,6 +88,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
85 | } | 88 | } |
86 | 89 | ||
87 | m_SearchURL = config.GetString("SearchServerURI", string.Empty); | 90 | m_SearchURL = config.GetString("SearchServerURI", string.Empty); |
91 | |||
92 | m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); | ||
88 | } | 93 | } |
89 | 94 | ||
90 | AddDefaultFeatures(); | 95 | AddDefaultFeatures(); |
@@ -94,6 +99,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
94 | { | 99 | { |
95 | m_scene = s; | 100 | m_scene = s; |
96 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 101 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; |
102 | |||
103 | m_scene.RegisterModuleInterface<ISimulatorFeaturesModule>(this); | ||
97 | } | 104 | } |
98 | 105 | ||
99 | public void RemoveRegion(Scene s) | 106 | public void RemoveRegion(Scene s) |
@@ -148,6 +155,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
148 | if (m_SearchURL != string.Empty) | 155 | if (m_SearchURL != string.Empty) |
149 | gridServicesMap["search"] = m_SearchURL; | 156 | gridServicesMap["search"] = m_SearchURL; |
150 | m_features["GridServices"] = gridServicesMap; | 157 | m_features["GridServices"] = gridServicesMap; |
158 | |||
159 | if (m_ExportSupported) | ||
160 | m_features["ExportSupported"] = true; | ||
151 | } | 161 | } |
152 | } | 162 | } |
153 | 163 | ||
@@ -156,7 +166,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
156 | IRequestHandler reqHandler | 166 | IRequestHandler reqHandler |
157 | = new RestHTTPHandler( | 167 | = new RestHTTPHandler( |
158 | "GET", "/CAPS/" + UUID.Random(), | 168 | "GET", "/CAPS/" + UUID.Random(), |
159 | HandleSimulatorFeaturesRequest, "SimulatorFeatures", agentID.ToString()); | 169 | x => { return HandleSimulatorFeaturesRequest(x, agentID); }, "SimulatorFeatures", agentID.ToString()); |
160 | 170 | ||
161 | caps.RegisterHandler("SimulatorFeatures", reqHandler); | 171 | caps.RegisterHandler("SimulatorFeatures", reqHandler); |
162 | } | 172 | } |
@@ -185,18 +195,33 @@ namespace OpenSim.Region.ClientStack.Linden | |||
185 | return new OSDMap(m_features); | 195 | return new OSDMap(m_features); |
186 | } | 196 | } |
187 | 197 | ||
188 | private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod) | 198 | private OSDMap DeepCopy() |
199 | { | ||
200 | // This isn't the cheapest way of doing this but the rate | ||
201 | // of occurrence is low (on sim entry only) and it's a sure | ||
202 | // way to get a true deep copy. | ||
203 | OSD copy = OSDParser.DeserializeLLSDXml(OSDParser.SerializeLLSDXmlString(m_features)); | ||
204 | |||
205 | return (OSDMap)copy; | ||
206 | } | ||
207 | |||
208 | private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID) | ||
189 | { | 209 | { |
190 | // m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); | 210 | // m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); |
191 | 211 | ||
212 | OSDMap copy = DeepCopy(); | ||
213 | |||
214 | SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest; | ||
215 | if (handlerOnSimulatorFeaturesRequest != null) | ||
216 | handlerOnSimulatorFeaturesRequest(agentID, ref copy); | ||
217 | |||
192 | //Send back data | 218 | //Send back data |
193 | Hashtable responsedata = new Hashtable(); | 219 | Hashtable responsedata = new Hashtable(); |
194 | responsedata["int_response_code"] = 200; | 220 | responsedata["int_response_code"] = 200; |
195 | responsedata["content_type"] = "text/plain"; | 221 | responsedata["content_type"] = "text/plain"; |
196 | responsedata["keepalive"] = false; | 222 | responsedata["keepalive"] = false; |
197 | 223 | ||
198 | lock (m_features) | 224 | responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(copy); |
199 | responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features); | ||
200 | 225 | ||
201 | return responsedata; | 226 | return responsedata; |
202 | } | 227 | } |