diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/InventoryService/InventoryService.cs | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index ea34195..a9ecda4 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Services.InventoryService | |||
60 | { | 60 | { |
61 | m_log.DebugFormat("[INVENTORY SERVICE]: Getting inventory skeleton for {0}", userId); | 61 | m_log.DebugFormat("[INVENTORY SERVICE]: Getting inventory skeleton for {0}", userId); |
62 | 62 | ||
63 | InventoryFolderBase rootFolder = RequestRootFolder(userId); | 63 | InventoryFolderBase rootFolder = GetRootFolder(userId); |
64 | 64 | ||
65 | // Agent has no inventory structure yet. | 65 | // Agent has no inventory structure yet. |
66 | if (null == rootFolder) | 66 | if (null == rootFolder) |
@@ -86,7 +86,7 @@ namespace OpenSim.Services.InventoryService | |||
86 | } | 86 | } |
87 | 87 | ||
88 | // See IInventoryServices | 88 | // See IInventoryServices |
89 | public virtual InventoryFolderBase RequestRootFolder(UUID userID) | 89 | public virtual InventoryFolderBase GetRootFolder(UUID userID) |
90 | { | 90 | { |
91 | // Retrieve the first root folder we get from the DB. | 91 | // Retrieve the first root folder we get from the DB. |
92 | InventoryFolderBase rootFolder = m_Database.getUserRootFolder(userID); | 92 | InventoryFolderBase rootFolder = m_Database.getUserRootFolder(userID); |
@@ -100,7 +100,7 @@ namespace OpenSim.Services.InventoryService | |||
100 | // See IInventoryServices | 100 | // See IInventoryServices |
101 | public bool CreateUserInventory(UUID user) | 101 | public bool CreateUserInventory(UUID user) |
102 | { | 102 | { |
103 | InventoryFolderBase existingRootFolder = RequestRootFolder(user); | 103 | InventoryFolderBase existingRootFolder = GetRootFolder(user); |
104 | 104 | ||
105 | if (null != existingRootFolder) | 105 | if (null != existingRootFolder) |
106 | { | 106 | { |
@@ -233,6 +233,67 @@ namespace OpenSim.Services.InventoryService | |||
233 | callback.BeginInvoke(folders, items, null, null); | 233 | callback.BeginInvoke(folders, items, null, null); |
234 | } | 234 | } |
235 | 235 | ||
236 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
237 | { | ||
238 | m_log.Info("[INVENTORY SERVICE]: Processing request for folder " + folderID); | ||
239 | |||
240 | // Uncomment me to simulate a slow responding inventory server | ||
241 | //Thread.Sleep(16000); | ||
242 | |||
243 | InventoryCollection invCollection = new InventoryCollection(); | ||
244 | |||
245 | List<InventoryItemBase> items = GetFolderItems(userID, folderID); | ||
246 | List<InventoryFolderBase> folders = RequestSubFolders(folderID); | ||
247 | |||
248 | invCollection.UserID = userID; | ||
249 | invCollection.Folders = folders; | ||
250 | invCollection.Items = items; | ||
251 | |||
252 | m_log.DebugFormat("[INVENTORY SERVICE]: Found {0} items and {1} folders", items.Count, folders.Count); | ||
253 | |||
254 | return invCollection; | ||
255 | } | ||
256 | |||
257 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
258 | { | ||
259 | InventoryFolderBase root = m_Database.getUserRootFolder(userID); | ||
260 | if (root != null) | ||
261 | { | ||
262 | List<InventoryFolderBase> folders = RequestSubFolders(root.ID); | ||
263 | |||
264 | foreach (InventoryFolderBase folder in folders) | ||
265 | { | ||
266 | if (folder.Type == (short)type) | ||
267 | return folder; | ||
268 | } | ||
269 | } | ||
270 | |||
271 | // we didn't find any folder of that type. Return the root folder | ||
272 | // hopefully the root folder is not null. If it is, too bad | ||
273 | return root; | ||
274 | } | ||
275 | |||
276 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
277 | { | ||
278 | InventoryFolderBase root = GetRootFolder(userID); | ||
279 | if (root != null) | ||
280 | { | ||
281 | InventoryCollection content = GetFolderContent(userID, root.ID); | ||
282 | if (content != null) | ||
283 | { | ||
284 | Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
285 | foreach (InventoryFolderBase folder in content.Folders) | ||
286 | { | ||
287 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | ||
288 | folders[(AssetType)folder.Type] = folder; | ||
289 | } | ||
290 | return folders; | ||
291 | } | ||
292 | } | ||
293 | m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID); | ||
294 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
295 | } | ||
296 | |||
236 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | 297 | public List<InventoryItemBase> GetActiveGestures(UUID userId) |
237 | { | 298 | { |
238 | List<InventoryItemBase> activeGestures = new List<InventoryItemBase>(); | 299 | List<InventoryItemBase> activeGestures = new List<InventoryItemBase>(); |