From f79400e94ca6f8b609f5d4cbe25c5bbc04b61b77 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 1 May 2011 18:22:53 -0700 Subject: 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. --- .../Framework/Caps/CapabilitiesModule.cs | 50 +++++++++------------- .../InterGrid/OpenGridProtocolModule.cs | 4 +- 2 files changed, 22 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index e684a0d..5e22c8c 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Framework /// /// Each agent has its own capabilities handler. /// - protected Dictionary m_capsHandlers = new Dictionary(); + protected Dictionary m_capsObjects = new Dictionary(); protected Dictionary capsPaths = new Dictionary(); protected Dictionary> 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 kvp in m_capsHandlers) + foreach (KeyValuePair kvp in m_capsObjects) { caps.AppendFormat("** User {0}:\n", kvp.Key); for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.CapsDetails.GetEnumerator(); kvp2.MoveNext(); ) diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 2dd7767..07999d1 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.InterGrid string derezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar/derez"; // Get a reference to the user's cap so we can pull out the Caps Object Path Caps userCap - = homeScene.CapsModule.GetCapsHandlerForUser(agentData.AgentID); + = homeScene.CapsModule.GetCapsForUser(agentData.AgentID); string rezHttpProtocol = "http://"; string regionCapsHttpProtocol = "http://"; @@ -700,7 +700,7 @@ namespace OpenSim.Region.CoreModules.InterGrid { // Get a referenceokay - to their Cap object so we can pull out the capobjectroot Caps userCap - = homeScene.CapsModule.GetCapsHandlerForUser(userData.AgentID); + = homeScene.CapsModule.GetCapsForUser(userData.AgentID); //Update the circuit data in the region so this user is authorized homeScene.UpdateCircuitData(userData); -- cgit v1.1