aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs100
1 files changed, 99 insertions, 1 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 86c24bc..f55b492 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -28,11 +28,16 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Threading;
32
31using libsecondlife; 33using libsecondlife;
32using log4net; 34using log4net;
33 35
34namespace OpenSim.Framework.Communications.Cache 36namespace OpenSim.Framework.Communications.Cache
35{ 37{
38 internal delegate void CreateInventoryFolderDelegate(
39 string folderName, LLUUID folderID, ushort folderType, LLUUID parentID);
40
36 /// <summary> 41 /// <summary>
37 /// Stores user profile and inventory data received from backend services for a particular user. 42 /// Stores user profile and inventory data received from backend services for a particular user.
38 /// </summary> 43 /// </summary>
@@ -297,6 +302,99 @@ namespace OpenSim.Framework.Communications.Cache
297 } 302 }
298 } 303 }
299 } 304 }
305
306 /// <summary>
307 /// Create a folder in this agent's inventory
308 /// </summary>
309 /// <param name="parentID"></param>
310 /// <returns></returns>
311 public bool CreateFolder(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID)
312 {
313// m_log.DebugFormat(
314// "[AGENT INVENTORY]: Creating inventory folder {0} {1} for {2} {3}", folderID, folderName, remoteClient.Name, remoteClient.AgentId);
315
316 if (HasInventory)
317 {
318 if (RootFolder.ID == parentID)
319 {
320 InventoryFolderImpl createdFolder = RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
321
322 if (createdFolder != null)
323 {
324 InventoryFolderBase createdBaseFolder = new InventoryFolderBase();
325 createdBaseFolder.Owner = createdFolder.Owner;
326 createdBaseFolder.ID = createdFolder.ID;
327 createdBaseFolder.Name = createdFolder.Name;
328 createdBaseFolder.ParentID = createdFolder.ParentID;
329 createdBaseFolder.Type = createdFolder.Type;
330 createdBaseFolder.Version = createdFolder.Version;
331
332 m_commsManager.InventoryService.AddFolder(createdBaseFolder);
333
334 return true;
335 }
336 else
337 {
338 m_log.WarnFormat(
339 "[INVENTORY CACHE]: Tried to create folder {0} {1} but the folder already exists",
340 folderName, folderID);
341
342 return false;
343 }
344 }
345 else
346 {
347 InventoryFolderImpl folder = RootFolder.GetDescendentFolder(parentID);
348
349 if (folder != null)
350 {
351 InventoryFolderImpl createdFolder = folder.CreateNewSubFolder(folderID, folderName, folderType);
352
353 if (createdFolder != null)
354 {
355 InventoryFolderBase createdBaseFolder = new InventoryFolderBase();
356 createdBaseFolder.Owner = createdFolder.Owner;
357 createdBaseFolder.ID = createdFolder.ID;
358 createdBaseFolder.Name = createdFolder.Name;
359 createdBaseFolder.ParentID = createdFolder.ParentID;
360 createdBaseFolder.Type = createdFolder.Type;
361 createdBaseFolder.Version = createdFolder.Version;
362
363 m_commsManager.InventoryService.AddFolder(createdBaseFolder);
364
365 return true;
366 }
367 else
368 {
369 m_log.WarnFormat(
370 "[INVENTORY CACHE]: Tried to create folder {0} {1} but the folder already exists",
371 folderName, folderID);
372
373 return false;
374 }
375 }
376 else
377 {
378 m_log.WarnFormat(
379 "[INVENTORY CACHE]: Could not find parent folder with id {0} in order to create folder {1} {2}",
380 parentID, folderName, folderID);
381
382 return false;
383 }
384 }
385 }
386 else
387 {
388 AddRequest(
389 new InventoryRequest(
390 Delegate.CreateDelegate(typeof(CreateInventoryFolderDelegate), this, "CreateFolder"),
391 new object[] { folderName, folderID, folderType, parentID }));
392
393 return true;
394 }
395
396 return false;
397 }
300 398
301 /// <summary> 399 /// <summary>
302 /// Add an item to the user's inventory 400 /// Add an item to the user's inventory
@@ -360,7 +458,7 @@ namespace OpenSim.Framework.Communications.Cache
360 /// <summary> 458 /// <summary>
361 /// Generic inventory request 459 /// Generic inventory request
362 /// </summary> 460 /// </summary>
363 public class InventoryRequest : IInventoryRequest 461 class InventoryRequest : IInventoryRequest
364 { 462 {
365 private Delegate m_delegat; 463 private Delegate m_delegat;
366 private Object[] m_args; 464 private Object[] m_args;