Broke down Caps.cs into a generic Caps object that simply registers/unregisters capabilities and a specific bunch of capability implementations in Linden space called BunchOfCaps.

Renamed a few methods that were misnomers.
Compiles but doesn't work.
This commit is contained in:
Diva Canto
2011-05-01 18:22:53 -07:00
parent 275046cf02
commit f79400e94c
9 changed files with 1357 additions and 1283 deletions

View File

@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Framework
/// <summary>
/// Each agent has its own capabilities handler.
/// </summary>
protected Dictionary<UUID, Caps> m_capsHandlers = new Dictionary<UUID, Caps>();
protected Dictionary<UUID, Caps> m_capsObjects = new Dictionary<UUID, Caps>();
protected Dictionary<UUID, string> capsPaths = new Dictionary<UUID, string>();
protected Dictionary<UUID, Dictionary<ulong, string>> childrenSeeds
@@ -95,19 +95,19 @@ namespace OpenSim.Region.CoreModules.Framework
get { return null; }
}
public void AddCapsHandler(UUID agentId)
public void CreateCaps(UUID agentId)
{
if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId))
return;
String capsObjectPath = GetCapsPath(agentId);
if (m_capsHandlers.ContainsKey(agentId))
if (m_capsObjects.ContainsKey(agentId))
{
Caps oldCaps = m_capsHandlers[agentId];
Caps oldCaps = m_capsObjects[agentId];
m_log.DebugFormat(
"[CAPS]: Reregistering caps for agent {0}. Old caps path {1}, new caps path {2}. ",
"[CAPS]: Recreating caps for agent {0}. Old caps path {1}, new caps path {2}. ",
agentId, oldCaps.CapsObjectPath, capsObjectPath);
// This should not happen. The caller code is confused. We need to fix that.
// CAPs can never be reregistered, or the client will be confused.
@@ -115,39 +115,29 @@ namespace OpenSim.Region.CoreModules.Framework
//return;
}
Caps caps
= new Caps(m_scene,
m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
Caps caps = new Caps(MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
(MainServer.Instance == null) ? 0: MainServer.Instance.Port,
capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName);
capsObjectPath, agentId, m_scene.RegionInfo.RegionName);
caps.RegisterHandlers();
m_capsObjects[agentId] = caps;
m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
caps.AddNewInventoryItem = m_scene.AddUploadedInventoryItem;
caps.ItemUpdatedCall = m_scene.CapsUpdateInventoryItemAsset;
caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset;
caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS;
caps.GetClient = m_scene.SceneContents.GetControllingClient;
m_capsHandlers[agentId] = caps;
}
public void RemoveCapsHandler(UUID agentId)
public void RemoveCaps(UUID agentId)
{
if (childrenSeeds.ContainsKey(agentId))
{
childrenSeeds.Remove(agentId);
}
lock (m_capsHandlers)
lock (m_capsObjects)
{
if (m_capsHandlers.ContainsKey(agentId))
if (m_capsObjects.ContainsKey(agentId))
{
m_capsHandlers[agentId].DeregisterHandlers();
m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsHandlers[agentId]);
m_capsHandlers.Remove(agentId);
m_capsObjects[agentId].DeregisterHandlers();
m_scene.EventManager.TriggerOnDeregisterCaps(agentId, m_capsObjects[agentId]);
m_capsObjects.Remove(agentId);
}
else
{
@@ -158,20 +148,20 @@ namespace OpenSim.Region.CoreModules.Framework
}
}
public Caps GetCapsHandlerForUser(UUID agentId)
public Caps GetCapsForUser(UUID agentId)
{
lock (m_capsHandlers)
lock (m_capsObjects)
{
if (m_capsHandlers.ContainsKey(agentId))
if (m_capsObjects.ContainsKey(agentId))
{
return m_capsHandlers[agentId];
return m_capsObjects[agentId];
}
}
return null;
}
public void NewUserConnection(AgentCircuitData agent)
public void SetAgentCapsSeeds(AgentCircuitData agent)
{
capsPaths[agent.AgentID] = agent.CapsPath;
childrenSeeds[agent.AgentID]
@@ -241,7 +231,7 @@ namespace OpenSim.Region.CoreModules.Framework
System.Text.StringBuilder caps = new System.Text.StringBuilder();
caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName);
foreach (KeyValuePair<UUID, Caps> kvp in m_capsHandlers)
foreach (KeyValuePair<UUID, Caps> kvp in m_capsObjects)
{
caps.AppendFormat("** User {0}:\n", kvp.Key);
for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); )