/// <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); } }
/// <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); } }
void SendInventoryComplete(IAsyncResult iar) { SendInventoryDelegate d = (SendInventoryDelegate)iar.AsyncState; d.EndInvoke(iar); lock (m_descendentsRequestLock) { if (m_descendentsRequestQueue.Count > 0) { DescendentsRequestData req = m_descendentsRequestQueue.Dequeue(); d = SendInventoryAsync; d.BeginInvoke(req.RemoteClient, req.FolderID, req.OwnerID, req.FetchFolders, req.FetchItems, req.SortOrder, SendInventoryComplete, d); return; } m_descendentsRequestProcessing = false; } }
/// <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); } }