mirror of
https://github.com/opensim/opensim.git
synced 2026-06-09 21:45:49 +08:00
Add an event and some logic to allow customizing Simulator Features by avatar
This commit is contained in:
@@ -59,6 +59,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
// private static readonly ILog m_log =
|
||||
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public event SimulatorFeaturesRequestDelegate OnSimulatorFeaturesRequest;
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
/// <summary>
|
||||
@@ -158,7 +160,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
IRequestHandler reqHandler
|
||||
= new RestHTTPHandler(
|
||||
"GET", "/CAPS/" + UUID.Random(),
|
||||
HandleSimulatorFeaturesRequest, "SimulatorFeatures", agentID.ToString());
|
||||
x => { return HandleSimulatorFeaturesRequest(x, agentID); }, "SimulatorFeatures", agentID.ToString());
|
||||
|
||||
caps.RegisterHandler("SimulatorFeatures", reqHandler);
|
||||
}
|
||||
@@ -187,18 +189,33 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
return new OSDMap(m_features);
|
||||
}
|
||||
|
||||
private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod)
|
||||
private OSDMap DeepCopy()
|
||||
{
|
||||
// This isn't the cheapest way of doing this but the rate
|
||||
// of occurrence is low (on sim entry only) and it's a sure
|
||||
// way to get a true deep copy.
|
||||
OSD copy = OSDParser.DeserializeLLSDXml(OSDParser.SerializeLLSDXmlString(m_features));
|
||||
|
||||
return (OSDMap)copy;
|
||||
}
|
||||
|
||||
private Hashtable HandleSimulatorFeaturesRequest(Hashtable mDhttpMethod, UUID agentID)
|
||||
{
|
||||
// m_log.DebugFormat("[SIMULATOR FEATURES MODULE]: SimulatorFeatures request");
|
||||
|
||||
OSDMap copy = DeepCopy();
|
||||
|
||||
SimulatorFeaturesRequestDelegate handlerOnSimulatorFeaturesRequest = OnSimulatorFeaturesRequest;
|
||||
if (handlerOnSimulatorFeaturesRequest != null)
|
||||
handlerOnSimulatorFeaturesRequest(agentID, ref copy);
|
||||
|
||||
//Send back data
|
||||
Hashtable responsedata = new Hashtable();
|
||||
responsedata["int_response_code"] = 200;
|
||||
responsedata["content_type"] = "text/plain";
|
||||
responsedata["keepalive"] = false;
|
||||
|
||||
lock (m_features)
|
||||
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(m_features);
|
||||
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(copy);
|
||||
|
||||
return responsedata;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user