Пример #1
0
        /// <summary>
        /// Handle an inventory folder move request from the client.
        ///
        /// If the inventory service has not yet delievered the inventory
        /// for this user then the request will be queued.
        /// </summary>
        ///
        /// <param name="folderID"></param>
        /// <param name="parentID"></param>
        /// <returns>
        /// true if the delete was successful, or if it was queued pending folder receipt
        /// false if the folder to be deleted did not exist.
        /// </returns>
        public bool MoveFolder(UUID folderID, UUID parentID)
        {
            //            m_log.DebugFormat(
            //                "[AGENT INVENTORY]: Moving inventory folder {0} into folder {1} for {2} {3}",
            //                parentID, remoteClient.Name, remoteClient.Name, remoteClient.AgentId);

            if (m_hasReceivedInventory)
            {
                InventoryFolderBase baseFolder = new InventoryFolderBase();
                baseFolder.Owner    = m_userProfile.ID;
                baseFolder.ID       = folderID;
                baseFolder.ParentID = parentID;

                m_InventoryService.MoveFolder(baseFolder);

                InventoryFolderImpl folder       = RootFolder.FindFolder(folderID);
                InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID);
                if (parentFolder != null && folder != null)
                {
                    InventoryFolderImpl oldParentFolder = RootFolder.FindFolder(folder.ParentID);

                    if (oldParentFolder != null)
                    {
                        oldParentFolder.RemoveChildFolder(folderID);
                        parentFolder.AddChildFolder(folder);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }

                return(true);
            }
            else
            {
                AddRequest(
                    new InventoryRequest(
                        Delegate.CreateDelegate(typeof(MoveFolderDelegate), this, "MoveFolder"),
                        new object[] { folderID, parentID }));

                return(true);
            }
        }