aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index 5e06580..9c6e1cd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -51,6 +51,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
51 // The cache proper 51 // The cache proper
52 protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; 52 protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache;
53 53
54 // A cache of userIDs --> ServiceURLs, for HGBroker only
55 protected Dictionary<UUID, string> m_InventoryURLs;
56
54 public virtual void Init(IConfigSource source, BaseInventoryConnector connector) 57 public virtual void Init(IConfigSource source, BaseInventoryConnector connector)
55 { 58 {
56 m_Scenes = new List<Scene>(); 59 m_Scenes = new List<Scene>();
@@ -89,8 +92,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
89 92
90 // If not, go get them and place them in the cache 93 // If not, go get them and place them in the cache
91 Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); 94 Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID);
95 CacheInventoryServiceURL(presence.Scene, presence.UUID);
96
92 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", 97 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
93 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); 98 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
99
94 } 100 }
95 101
96 void OnClientClosed(UUID clientID, Scene scene) 102 void OnClientClosed(UUID clientID, Scene scene)
@@ -113,6 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
113 "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", 119 "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders",
114 scene.RegionInfo.RegionName, clientID); 120 scene.RegionInfo.RegionName, clientID);
115 DropCachedSystemFolders(clientID); 121 DropCachedSystemFolders(clientID);
122 DropInventoryServiceURL(clientID);
116 } 123 }
117 } 124 }
118 125
@@ -174,5 +181,49 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
174 181
175 return null; 182 return null;
176 } 183 }
184
185 /// <summary>
186 /// Gets the user's inventory URL from its serviceURLs, if the user is foreign,
187 /// and sticks it in the cache
188 /// </summary>
189 /// <param name="userID"></param>
190 private void CacheInventoryServiceURL(Scene scene, UUID userID)
191 {
192 if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null)
193 {
194 // The user does not have a local account; let's cache its service URL
195 string inventoryURL = string.Empty;
196 ScenePresence sp = null;
197 scene.TryGetScenePresence(userID, out sp);
198 if (sp != null)
199 {
200 AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
201 if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
202 {
203 inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
204 if (inventoryURL != null && inventoryURL != string.Empty)
205 {
206 inventoryURL = inventoryURL.Trim(new char[] { '/' });
207 m_InventoryURLs.Add(userID, inventoryURL);
208 }
209 }
210 }
211 }
212 }
213
214 private void DropInventoryServiceURL(UUID userID)
215 {
216 lock (m_InventoryURLs)
217 if (m_InventoryURLs.ContainsKey(userID))
218 m_InventoryURLs.Remove(userID);
219 }
220
221 public string GetInventoryServiceURL(UUID userID)
222 {
223 if (m_InventoryURLs.ContainsKey(userID))
224 return m_InventoryURLs[userID];
225
226 return null;
227 }
177 } 228 }
178} 229}