Change handling of the FetchInventoryDescendents2 capability configuration to allow

for external handlers.
varregion
Mic Bowman 2013-09-11 12:15:16 -07:00
parent 8bcf753127
commit b29e9d37e7
1 changed files with 36 additions and 23 deletions

View File

@ -63,7 +63,7 @@ namespace OpenSim.Region.ClientStack.Linden
public List<UUID> folders; public List<UUID> folders;
} }
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene; private Scene m_scene;
@ -115,7 +115,7 @@ namespace OpenSim.Region.ClientStack.Linden
m_scene.EventManager.OnRegisterCaps -= RegisterCaps; m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
foreach (Thread t in m_workerThreads) foreach (Thread t in m_workerThreads)
Watchdog.AbortThread(t.ManagedThreadId); Watchdog.AbortThread(t.ManagedThreadId);
m_scene = null; m_scene = null;
} }
@ -296,36 +296,49 @@ namespace OpenSim.Region.ClientStack.Linden
requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null); requestinfo.request["body"].ToString(), String.Empty, String.Empty, null, null);
lock (responses) lock (responses)
responses[requestID] = response; responses[requestID] = response;
} }
} }
private void RegisterCaps(UUID agentID, Caps caps) private void RegisterCaps(UUID agentID, Caps caps)
{ {
if (m_fetchInventoryDescendents2Url == "") RegisterFetchDescendentsCap(agentID, caps, "FetchInventoryDescendents2", m_fetchInventoryDescendents2Url);
}
private void RegisterFetchDescendentsCap(UUID agentID, Caps caps, string capName, string url)
{
string capUrl;
// disable the cap clause
if (url == "")
{
return; return;
}
// handled by the simulator
else if (url == "localhost")
{
capUrl = "/CAPS/" + UUID.Random() + "/";
// Register this as a poll service // Register this as a poll service
PollServiceInventoryEventArgs args PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, capUrl, agentID);
= new PollServiceInventoryEventArgs(m_scene, "/CAPS/" + UUID.Random() + "/", agentID); args.Type = PollServiceEventArgs.EventType.Inventory;
args.Type = PollServiceEventArgs.EventType.Inventory;
caps.RegisterPollHandler("FetchInventoryDescendents2", args); caps.RegisterPollHandler(capName, args);
}
// external handler
else
{
capUrl = url;
IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>();
if (handler != null)
handler.RegisterExternalUserCapsHandler(agentID,caps,capName,capUrl);
else
caps.RegisterHandler(capName, capUrl);
}
// MainServer.Instance.AddPollServiceHTTPHandler(capUrl, args); // m_log.DebugFormat(
// // "[FETCH INVENTORY DESCENDENTS2 MODULE]: Registered capability {0} at {1} in region {2} for {3}",
// string hostName = m_scene.RegionInfo.ExternalHostName; // capName, capUrl, m_scene.RegionInfo.RegionName, agentID);
// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
// string protocol = "http";
//
// if (MainServer.Instance.UseSSL)
// {
// hostName = MainServer.Instance.SSLCommonName;
// port = MainServer.Instance.SSLPort;
// protocol = "https";
// }
//
// caps.RegisterHandler("FetchInventoryDescendents2", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
} }
// private void DeregisterCaps(UUID agentID, Caps caps) // private void DeregisterCaps(UUID agentID, Caps caps)