From 8a8c89a0f32b528bd588715bdbfc875c852e7187 Mon Sep 17 00:00:00 2001 From: Brian McBee Date: Sat, 15 Dec 2007 04:57:14 +0000 Subject: Grid Inventory feature upgrade: renaming folders should now be correct, subfolders work, moving folders works. Tested only in MYSQL, but may work in MSSQL and sqlite. Probably not working in standalone mode. --- .../Communications/Cache/InventoryFolderImpl.cs | 10 +++++++ .../Cache/UserProfileCacheService.cs | 32 +++++++++++++++++----- .../Framework/Communications/IInventoryServices.cs | 1 + .../Communications/InventoryServiceBase.cs | 20 ++++++++++++++ 4 files changed, 56 insertions(+), 7 deletions(-) (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs index c07a15b..1d2c920 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs @@ -142,5 +142,15 @@ namespace OpenSim.Framework.Communications.Cache } return itemList; } + + public List RequestListOfFolders() + { + List folderList = new List(); + foreach (InventoryFolderBase folder in SubFolders.Values) + { + folderList.Add(folder); + } + return folderList; + } } } diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 32d941c..bf7f5c1 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -147,6 +147,23 @@ namespace OpenSim.Framework.Communications.Cache } } + public void HandleMoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID) + { + CachedUserInfo userProfile; + + if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) + { + if (userProfile.RootFolder != null) + { + InventoryFolderBase baseFolder = new InventoryFolderBase(); + baseFolder.agentID = remoteClient.AgentId; + baseFolder.folderID = folderID; + baseFolder.parentID = parentID; + m_parent.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder); + } + } + } + /// /// Tell the client about the various child items and folders contained in the requested folder. /// @@ -163,14 +180,15 @@ namespace OpenSim.Framework.Communications.Cache if (folderID == libraryRoot.folderID) { remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, - libraryRoot.RequestListOfItems(), libraryRoot.SubFoldersCount); + libraryRoot.RequestListOfItems(), libraryRoot.RequestListOfFolders(), libraryRoot.SubFoldersCount); return; } if ((fold = libraryRoot.HasSubFolder(folderID)) != null) { - remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems(), fold.SubFoldersCount); + System.Console.WriteLine("fetching librarysubfolder"); + remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fold.SubFoldersCount); return; } @@ -182,19 +200,19 @@ namespace OpenSim.Framework.Communications.Cache { if (userProfile.RootFolder.folderID == folderID) { + System.Console.Write("fetching root folder"); if (fetchItems) { remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, - userProfile.RootFolder.RequestListOfItems(), userProfile.RootFolder.SubFoldersCount); + userProfile.RootFolder.RequestListOfItems(), userProfile.RootFolder.RequestListOfFolders(), userProfile.RootFolder.SubFoldersCount); } } else { - InventoryFolderImpl folder = userProfile.RootFolder.HasSubFolder(folderID); - - if (fetchItems && folder != null) + if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null) { - remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems(), folder.SubFoldersCount); + remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fold.SubFoldersCount); + return; } } } diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index 191cdf2..9c493d4 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs @@ -40,6 +40,7 @@ namespace OpenSim.Framework.Communications { void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); + void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder); void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); void CreateNewUserInventory(LLUUID user); diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 28b81d4..1e13031 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -130,6 +130,17 @@ namespace OpenSim.Framework.Communications /// /// /// + public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) + { + foreach (KeyValuePair plugin in m_plugins) + { + plugin.Value.moveInventoryFolder(folder); + } + } + + /// + /// + /// /// /// public List RequestSubFolders(LLUUID parentFolderID) @@ -161,6 +172,14 @@ namespace OpenSim.Framework.Communications } } + public void MoveFolder(InventoryFolderBase folder) + { + foreach (KeyValuePair plugin in m_plugins) + { + plugin.Value.moveInventoryFolder(folder); + } + } + public void AddItem(InventoryItemBase item) { foreach (KeyValuePair plugin in m_plugins) @@ -251,6 +270,7 @@ namespace OpenSim.Framework.Communications InventoryItemInfo itemCallBack); public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); + public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder); public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); } -- cgit v1.1