aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-01-21 21:14:17 +0000
committerJustin Clarke Casey2009-01-21 21:14:17 +0000
commit37fa6775488ab237a4537d49b92a8d52b0497b98 (patch)
tree805183f2f807a8a051ba64878c079fb0a8c7fe17 /OpenSim/Region/Environment/Scenes/Scene.cs
parent* Restore commented out isdone assertions in TextureSendTests.T010_SendPkg() (diff)
downloadopensim-SC_OLD-37fa6775488ab237a4537d49b92a8d52b0497b98.zip
opensim-SC_OLD-37fa6775488ab237a4537d49b92a8d52b0497b98.tar.gz
opensim-SC_OLD-37fa6775488ab237a4537d49b92a8d52b0497b98.tar.bz2
opensim-SC_OLD-37fa6775488ab237a4537d49b92a8d52b0497b98.tar.xz
* refactor: Extract caps related code from scene and put into a region module
* No functional changes in this revision
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs105
1 files changed, 9 insertions, 96 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 8a9d295..3a0bbc3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -113,11 +113,6 @@ namespace OpenSim.Region.Environment.Scenes
113 get { return m_sceneGridService; } 113 get { return m_sceneGridService; }
114 } 114 }
115 115
116 /// <summary>
117 /// Each agent has its own capabilities handler.
118 /// </summary>
119 protected Dictionary<UUID, Caps> m_capsHandlers = new Dictionary<UUID, Caps>();
120
121 /// <value> 116 /// <value>
122 /// All the region modules attached to this scene. 117 /// All the region modules attached to this scene.
123 /// </value> 118 /// </value>
@@ -147,7 +142,8 @@ namespace OpenSim.Region.Environment.Scenes
147 protected IInterregionCommsOut m_interregionCommsOut; 142 protected IInterregionCommsOut m_interregionCommsOut;
148 protected IInterregionCommsIn m_interregionCommsIn; 143 protected IInterregionCommsIn m_interregionCommsIn;
149 protected IDialogModule m_dialogModule; 144 protected IDialogModule m_dialogModule;
150 145 protected internal ICapabilitiesModule CapsModule;
146
151 // Central Update Loop 147 // Central Update Loop
152 148
153 protected int m_fps = 10; 149 protected int m_fps = 10;
@@ -342,7 +338,7 @@ namespace OpenSim.Region.Environment.Scenes
342 338
343 RegisterDefaultSceneEvents(); 339 RegisterDefaultSceneEvents();
344 340
345 m_dumpAssetsToFile = dumpAssetsToFile; 341 DumpAssetsToFile = dumpAssetsToFile;
346 342
347 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; 343 m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
348 344
@@ -780,6 +776,7 @@ namespace OpenSim.Region.Environment.Scenes
780 m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>(); 776 m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>();
781 m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>(); 777 m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>();
782 m_dialogModule = RequestModuleInterface<IDialogModule>(); 778 m_dialogModule = RequestModuleInterface<IDialogModule>();
779 CapsModule = RequestModuleInterface<ICapabilitiesModule>();
783 } 780 }
784 781
785 #endregion 782 #endregion
@@ -2578,7 +2575,7 @@ namespace OpenSim.Region.Environment.Scenes
2578 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); 2575 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName);
2579 2576
2580 m_sceneGraph.removeUserCount(!childagentYN); 2577 m_sceneGraph.removeUserCount(!childagentYN);
2581 RemoveCapsHandler(agentID); 2578 CapsModule.RemoveCapsHandler(agentID);
2582 2579
2583 if (avatar.Scene.NeedSceneCacheClear(avatar.UUID)) 2580 if (avatar.Scene.NeedSceneCacheClear(avatar.UUID))
2584 { 2581 {
@@ -2759,9 +2756,7 @@ namespace OpenSim.Region.Environment.Scenes
2759 /// <param name="agent"></param> 2756 /// <param name="agent"></param>
2760 public void NewUserConnection(AgentCircuitData agent) 2757 public void NewUserConnection(AgentCircuitData agent)
2761 { 2758 {
2762 /// Diva: Horrible stuff! 2759 CapsModule.NewUserConnection(agent);
2763 capsPaths[agent.AgentID] = agent.CapsPath;
2764 childrenSeeds[agent.AgentID] = ((agent.ChildrenCapSeeds == null) ? new Dictionary<ulong, string>() : agent.ChildrenCapSeeds);
2765 2760
2766 ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); 2761 ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID);
2767 if (sp != null) 2762 if (sp != null)
@@ -2786,8 +2781,8 @@ namespace OpenSim.Region.Environment.Scenes
2786 "[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user is on the region banlist", 2781 "[CONNECTION BEGIN]: Denied access to: {0} at {1} because the user is on the region banlist",
2787 agent.AgentID, RegionInfo.RegionName); 2782 agent.AgentID, RegionInfo.RegionName);
2788 } 2783 }
2789 2784
2790 AddCapsHandler(agent.AgentID); 2785 CapsModule.AddCapsHandler(agent.AgentID);
2791 2786
2792 if (!agent.child) 2787 if (!agent.child)
2793 { 2788 {
@@ -2860,88 +2855,6 @@ namespace OpenSim.Region.Environment.Scenes
2860 } 2855 }
2861 2856
2862 /// <summary> 2857 /// <summary>
2863 /// Add a caps handler for the given agent. If the CAPS handler already exists for this agent,
2864 /// then it is replaced by a new CAPS handler.
2865 ///
2866 /// FIXME: On login this is called twice, once for the login and once when the connection is made.
2867 /// This is somewhat innefficient and should be fixed. The initial login creation is necessary
2868 /// since the client asks for capabilities immediately after being informed of the seed.
2869 /// </summary>
2870 /// <param name="agentId"></param>
2871 /// <param name="capsObjectPath"></param>
2872 public void AddCapsHandler(UUID agentId)
2873 {
2874 if (RegionInfo.EstateSettings.IsBanned(agentId))
2875 return;
2876
2877 String capsObjectPath = GetCapsPath(agentId);
2878
2879 Caps cap = null;
2880 if (m_capsHandlers.TryGetValue(agentId, out cap))
2881 {
2882 m_log.DebugFormat("[CAPS] Attempt at registering twice for the same agent {0}. {1}. Ignoring.", agentId, capsObjectPath);
2883 //return;
2884 }
2885
2886 cap
2887 = new Caps(
2888 AssetCache, CommsManager.HttpServer, m_regInfo.ExternalHostName, CommsManager.HttpServer.Port,
2889 capsObjectPath, agentId, m_dumpAssetsToFile, RegionInfo.RegionName);
2890
2891 cap.RegisterHandlers();
2892
2893 EventManager.TriggerOnRegisterCaps(agentId, cap);
2894
2895 cap.AddNewInventoryItem = AddUploadedInventoryItem;
2896 cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
2897 cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset;
2898 cap.CAPSFetchInventoryDescendents = HandleFetchInventoryDescendentsCAPS;
2899 cap.GetClient = m_sceneGraph.GetControllingClient;
2900 m_capsHandlers[agentId] = cap;
2901 }
2902
2903 public Caps GetCapsHandlerForUser(UUID agentId)
2904 {
2905 lock (m_capsHandlers)
2906 {
2907 if (m_capsHandlers.ContainsKey(agentId))
2908 {
2909 return m_capsHandlers[agentId];
2910 }
2911 }
2912 return null;
2913 }
2914
2915 /// <summary>
2916 /// Remove the caps handler for a given agent.
2917 /// </summary>
2918 /// <param name="agentId"></param>
2919 public void RemoveCapsHandler(UUID agentId)
2920 {
2921 if (childrenSeeds.ContainsKey(agentId))
2922 {
2923 childrenSeeds.Remove(agentId);
2924 }
2925
2926 lock (m_capsHandlers)
2927 {
2928 if (m_capsHandlers.ContainsKey(agentId))
2929 {
2930 m_capsHandlers[agentId].DeregisterHandlers();
2931 EventManager.TriggerOnDeregisterCaps(agentId, m_capsHandlers[agentId]);
2932
2933 m_capsHandlers.Remove(agentId);
2934 }
2935 else
2936 {
2937 m_log.WarnFormat(
2938 "[CAPS]: Received request to remove CAPS handler for root agent {0} in {1}, but no such CAPS handler found!",
2939 agentId, RegionInfo.RegionName);
2940 }
2941 }
2942 }
2943
2944 /// <summary>
2945 /// Triggered when an agent crosses into this sim. Also happens on initial login. 2858 /// Triggered when an agent crosses into this sim. Also happens on initial login.
2946 /// </summary> 2859 /// </summary>
2947 /// <param name="agentID"></param> 2860 /// <param name="agentID"></param>
@@ -3740,7 +3653,7 @@ namespace OpenSim.Region.Environment.Scenes
3740 #region Script Engine 3653 #region Script Engine
3741 3654
3742 private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>(); 3655 private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
3743 private bool m_dumpAssetsToFile; 3656 public bool DumpAssetsToFile;
3744 3657
3745 /// <summary> 3658 /// <summary>
3746 /// 3659 ///