/// <summary> /// Create a folder in this agent's inventory. /// </summary> /// /// If the inventory service has not yet delievered the inventory /// for this user then the request will be queued. /// /// <param name="parentID"></param> /// <returns></returns> public bool CreateFolder(string folderName, UUID folderID, ushort folderType, UUID parentID) { // m_log.DebugFormat( // "[AGENT INVENTORY]: Creating inventory folder {0} {1} for {2} {3}", folderID, folderName, remoteClient.Name, remoteClient.AgentId); if (m_hasReceivedInventory) { InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID); if (null == parentFolder) { m_log.WarnFormat( "[AGENT INVENTORY]: Tried to create folder {0} {1} but the parent {2} does not exist", folderName, folderID, parentID); return(false); } InventoryFolderImpl createdFolder = parentFolder.CreateChildFolder(folderID, folderName, folderType); if (createdFolder != null) { InventoryFolderBase createdBaseFolder = new InventoryFolderBase(); createdBaseFolder.Owner = createdFolder.Owner; createdBaseFolder.ID = createdFolder.ID; createdBaseFolder.Name = createdFolder.Name; createdBaseFolder.ParentID = createdFolder.ParentID; createdBaseFolder.Type = createdFolder.Type; createdBaseFolder.Version = createdFolder.Version; m_InventoryService.AddFolder(createdBaseFolder); return(true); } else { m_log.WarnFormat( "[AGENT INVENTORY]: Tried to create folder {0} {1} but the folder already exists", folderName, folderID); return(false); } } else { AddRequest( new InventoryRequest( Delegate.CreateDelegate(typeof(CreateFolderDelegate), this, "CreateFolder"), new object[] { folderName, folderID, folderType, parentID })); return(true); } }
/// <summary> /// Add a new folder to the user's inventory /// </summary> /// <param name="folder"></param> /// <returns>true if the folder was successfully added</returns> public bool AddFolder(InventoryFolderBase folder) { //m_log.DebugFormat("[LIBRARY MODULE]: Adding folder {0} ({1}) to {2}", folder.Name, folder.ID, folder.ParentID); InventoryFolderImpl parent = m_Library; if (m_Library.ID != folder.ParentID) { parent = m_Library.FindFolder(folder.ParentID); } if (parent == null) { m_log.DebugFormat("[LIBRARY MODULE]: could not add folder {0} because parent folder {1} not found", folder.Name, folder.ParentID); return(false); } parent.CreateChildFolder(folder.ID, folder.Name, (ushort)folder.Type); return(true); }