예제 #1
0
        /// <summary>
        /// Gets everything (folders and items) inside a folder
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="folderID"></param>
        /// <returns></returns>
        public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
        {
            InventoryFolderImpl folder = null;
            InventoryCollection inv    = new InventoryCollection();

            inv.UserID = m_Library.Owner;

            if (folderID != m_Library.ID)
            {
                folder = m_Library.FindFolder(folderID);
                if (folder == null)
                {
                    inv.Folders = new List <InventoryFolderBase>();
                    inv.Items   = new List <InventoryItemBase>();
                    return(inv);
                }
            }
            else
            {
                folder = m_Library;
            }

            inv.Folders = folder.RequestListOfFolders();
            inv.Items   = folder.RequestListOfItems();

            m_log.DebugFormat("[LIBRARY MODULE]: Got content for folder {0}", folder.Name);
            return(inv);
        }
예제 #2
0
        /// <summary>
        /// Tell the client about the various child items and folders contained in the requested folder.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="folderID"></param>
        /// <param name="ownerID"></param>
        /// <param name="fetchFolders"></param>
        /// <param name="fetchItems"></param>
        /// <param name="sortOrder"></param>
        public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID,
                                                    bool fetchFolders, bool fetchItems, int sortOrder)
        {
            // TODO: This code for looking in the folder for the library should be folded back into the
            // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
            // can be handled transparently).
            InventoryFolderImpl fold = null;

            if ((fold = CommsManager.LibraryRoot.FindFolder(folderID)) != null)
            {
                remoteClient.SendInventoryFolderDetails(
                    fold.Owner, fold, fold.RequestListOfItems(),
                    fold.RequestListOfFolders(), fetchFolders, fetchItems);
                return;
            }

            CachedUserInfo userProfile = CommsManager.UserService.GetUserDetails(remoteClient.AgentId);

            if (null == userProfile)
            {
                m_log.ErrorFormat(
                    "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
                    remoteClient.Name, remoteClient.AgentId);
                return;
            }

            userProfile.SendInventoryDecendents(remoteClient, folderID, fetchFolders, fetchItems);
        }
예제 #3
0
        /// <summary>
        /// Tell the client about the various child items and folders contained in the requested folder.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="folderID"></param>
        /// <param name="ownerID"></param>
        /// <param name="fetchFolders"></param>
        /// <param name="fetchItems"></param>
        /// <param name="sortOrder"></param>
        public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID,
                                                    bool fetchFolders, bool fetchItems, int sortOrder)
        {
            // FIXME MAYBE: We're not handling sortOrder!

            // TODO: This code for looking in the folder for the library should be folded somewhere else
            // so that this class doesn't have to know the details (and so that multiple libraries, etc.
            // can be handled transparently).
            InventoryFolderImpl fold = null;

            if (LibraryService != null && LibraryService.LibraryRootFolder != null)
            {
                if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
                {
                    remoteClient.SendInventoryFolderDetails(
                        fold.Owner, folderID, fold.RequestListOfItems(),
                        fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems);
                    return;
                }
            }

            // We're going to send the reply async, because there may be
            // an enormous quantity of packets -- basically the entire inventory!
            // We don't want to block the client thread while all that is happening.
            SendInventoryDelegate d = SendInventoryAsync;

            d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d);
        }
예제 #4
0
        /// <summary>
        /// Tell the client about the various child items and folders contained in the requested folder.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="folderID"></param>
        /// <param name="ownerID"></param>
        /// <param name="fetchFolders"></param>
        /// <param name="fetchItems"></param>
        /// <param name="sortOrder"></param>
        public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID,
                                                    bool fetchFolders, bool fetchItems, int sortOrder)
        {
//            m_log.DebugFormat(
//                "[USER INVENTORY]: HandleFetchInventoryDescendents() for {0}, folder={1}, fetchFolders={2}, fetchItems={3}, sortOrder={4}",
//                remoteClient.Name, folderID, fetchFolders, fetchItems, sortOrder);

            if (folderID == UUID.Zero)
            {
                return;
            }

            // FIXME MAYBE: We're not handling sortOrder!

            // TODO: This code for looking in the folder for the library should be folded somewhere else
            // so that this class doesn't have to know the details (and so that multiple libraries, etc.
            // can be handled transparently).
            InventoryFolderImpl fold = null;

            if (LibraryService != null && LibraryService.LibraryRootFolder != null)
            {
                if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
                {
                    remoteClient.SendInventoryFolderDetails(
                        fold.Owner, folderID, fold.RequestListOfItems(),
                        fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems);
                    return;
                }
            }

            lock (m_descendentsRequestLock)
            {
                if (!m_descendentsRequestProcessing)
                {
                    m_descendentsRequestProcessing = true;

                    // We're going to send the reply async, because there may be
                    // an enormous quantity of packets -- basically the entire inventory!
                    // We don't want to block the client thread while all that is happening.
                    SendInventoryDelegate d = SendInventoryAsync;
                    d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d);

                    return;
                }

                DescendentsRequestData req = new DescendentsRequestData();
                req.RemoteClient = remoteClient;
                req.FolderID     = folderID;
                req.OwnerID      = ownerID;
                req.FetchFolders = fetchFolders;
                req.FetchItems   = fetchItems;
                req.SortOrder    = sortOrder;

                m_descendentsRequestQueue.Enqueue(req);
            }
        }
예제 #5
0
        /// <summary>
        /// Tell the client about the various child items and folders contained in the requested folder.
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="folderID"></param>
        /// <param name="ownerID"></param>
        /// <param name="fetchFolders"></param>
        /// <param name="fetchItems"></param>
        /// <param name="sortOrder"></param>
        public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID,
                                                    bool fetchFolders, bool fetchItems, int sortOrder)
        {
//            m_log.DebugFormat(
//                "[USER INVENTORY]: HandleFetchInventoryDescendents() for {0}, folder={1}, fetchFolders={2}, fetchItems={3}, sortOrder={4}",
//                remoteClient.Name, folderID, fetchFolders, fetchItems, sortOrder);

            if (folderID == UUID.Zero)
            {
                return;
            }

            // FIXME MAYBE: We're not handling sortOrder!

            // TODO: This code for looking in the folder for the library should be folded somewhere else
            // so that this class doesn't have to know the details (and so that multiple libraries, etc.
            // can be handled transparently).
            InventoryFolderImpl fold = null;

            if (LibraryService != null && LibraryService.LibraryRootFolder != null)
            {
                if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
                {
                    List <InventoryItemBase>   its = fold.RequestListOfItems();
                    List <InventoryFolderBase> fds = fold.RequestListOfFolders();
                    remoteClient.SendInventoryFolderDetails(
                        fold.Owner, folderID, its, fds,
                        fold.Version, its.Count + fds.Count, fetchFolders, fetchItems);
                    return;
                }
            }

            DescendentsRequestData req = new DescendentsRequestData();

            req.RemoteClient = remoteClient;
            req.FolderID     = folderID;
            //req.OwnerID = ownerID;
            req.FetchFolders = fetchFolders;
            req.FetchItems   = fetchItems;
            //req.SortOrder = sortOrder;

            m_descendentsRequestQueue.Enqueue(req);

            if (Monitor.TryEnter(m_descendentsRequestLock))
            {
                if (!m_descendentsRequestProcessing)
                {
                    m_descendentsRequestProcessing = true;
                    Util.FireAndForget(x => SendInventoryAsync());
                }
                Monitor.Exit(m_descendentsRequestLock);
            }
        }