aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorMelanie2013-02-14 08:40:15 +0100
committerMelanie2013-02-14 09:11:57 +0000
commitef662fc959c7943e55c548c50c6b160d12e5c095 (patch)
treef359010f5a5e56dd9dc916e7c2e1f5358bb5619e /OpenSim/Region/ClientStack
parentFix a very unlikely-to-occur NullReferenceException race condition in llPushO... (diff)
downloadopensim-SC_OLD-ef662fc959c7943e55c548c50c6b160d12e5c095.zip
opensim-SC_OLD-ef662fc959c7943e55c548c50c6b160d12e5c095.tar.gz
opensim-SC_OLD-ef662fc959c7943e55c548c50c6b160d12e5c095.tar.bz2
opensim-SC_OLD-ef662fc959c7943e55c548c50c6b160d12e5c095.tar.xz
Add an event and some logic to allow customizing Simulator Features by avatar
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs25
1 files changed, 21 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index 8f38737..6ef8815 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>
@@ -158,7 +160,7 @@ namespace OpenSim.Region.ClientStack.Linden
158 IRequestHandler reqHandler 160 IRequestHandler reqHandler
159 = new RestHTTPHandler( 161 = new RestHTTPHandler(
160 "GET", "/CAPS/" + UUID.Random(), 162 "GET", "/CAPS/" + UUID.Random(),
161 HandleSimulatorFeaturesRequest, "SimulatorFeatures", agentID.ToString()); 163 x => { return HandleSimulatorFeaturesRequest(x, agentID); }, "SimulatorFeatures", agentID.ToString());
162 164
163 caps.RegisterHandler("SimulatorFeatures", reqHandler); 165 caps.RegisterHandler("SimulatorFeatures", reqHandler);
164 } 166 }
@@ -187,18 +189,33 @@ namespace OpenSim.Region.ClientStack.Linden
187 return new OSDMap(m_features); 189 return new OSDMap(m_features);
188 } 190 }
189 191
190 private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod) 192 private OSDMap DeepCopy()
193 {
194 // This isn't the cheapest way of doing this but the rate
195 // of occurrence is low (on sim entry only) and it's a sure
196 // way to get a true deep copy.
197 OSD copy = OSDParser.DeserializeLLSDXml(OSDParser.SerializeLLSDXmlString(m_features));
198
199 return (OSDMap)copy;
200 }
201
202 private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID)
191 { 203 {
192// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request"); 204// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
193 205
206 OSDMap copy = DeepCopy();
207
208 SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest;
209 if (handlerOnSimulatorFeaturesRequest != null)
210 handlerOnSimulatorFeaturesRequest(agentID, ref copy);
211
194 //Send back data 212 //Send back data
195 Hashtable responsedata = new Hashtable(); 213 Hashtable responsedata = new Hashtable();
196 responsedata["int_response_code"] = 200; 214 responsedata["int_response_code"] = 200;
197 responsedata["content_type"] = "text/plain"; 215 responsedata["content_type"] = "text/plain";
198 responsedata["keepalive"] = false; 216 responsedata["keepalive"] = false;
199 217
200 lock (m_features) 218 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(copy);
201 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features);
202 219
203 return responsedata; 220 return responsedata;
204 } 221 }