From 16903ec488f53fe1bab6b4c4408dde31d03367ff Mon Sep 17 00:00:00 2001 From: Brian McBee Date: Tue, 11 Dec 2007 03:51:32 +0000 Subject: Implementing updateinventoryfolder: Should now be able to rename folders in inventory --- .../Communications/Cache/UserProfileCacheService.cs | 20 ++++++++++++++++++++ OpenSim/Framework/IClientAPI.cs | 4 ++++ OpenSim/Region/ClientStack/ClientView.cs | 14 ++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 1 + OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 1 + 5 files changed, 40 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 70aec47..32d941c 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -127,6 +127,26 @@ namespace OpenSim.Framework.Communications.Cache } } + public void HandleUpdateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort type, string name, 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.name = name; + baseFolder.parentID = parentID; + baseFolder.type = (short)type; + baseFolder.version = userProfile.RootFolder.version; + m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder); + } + } + } + /// /// Tell the client about the various child items and folders contained in the requested folder. /// diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 98c7a18..8075d0d 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -327,6 +327,9 @@ namespace OpenSim.Framework public delegate void CreateInventoryFolder( IClientAPI remoteClient, LLUUID folderID, ushort folderType, string folderName, LLUUID parentID); + public delegate void UpdateInventoryFolder( + IClientAPI remoteClient, LLUUID folderID, ushort type, string name, LLUUID parentID); + public delegate void CreateNewInventoryItem( IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask); @@ -428,6 +431,7 @@ namespace OpenSim.Framework event CreateNewInventoryItem OnCreateNewInventoryItem; event CreateInventoryFolder OnCreateNewInventoryFolder; + event UpdateInventoryFolder OnUpdateInventoryFolder; event FetchInventoryDescendents OnFetchInventoryDescendents; event PurgeInventoryDescendents OnPurgeInventoryDescendents; event FetchInventory OnFetchInventory; diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index db25ee6..a94c5da 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -430,6 +430,7 @@ namespace OpenSim.Region.ClientStack public event CreateNewInventoryItem OnCreateNewInventoryItem; public event CreateInventoryFolder OnCreateNewInventoryFolder; + public event UpdateInventoryFolder OnUpdateInventoryFolder; public event FetchInventoryDescendents OnFetchInventoryDescendents; public event PurgeInventoryDescendents OnPurgeInventoryDescendents; public event FetchInventory OnFetchInventory; @@ -2809,6 +2810,19 @@ namespace OpenSim.Region.ClientStack invFolder.FolderData.ParentID); } break; + case PacketType.UpdateInventoryFolder: + if (OnUpdateInventoryFolder != null) + { + UpdateInventoryFolderPacket invFolder = (UpdateInventoryFolderPacket)Pack; + for (int i = 0; i < invFolder.FolderData.Length; i++) + { + OnUpdateInventoryFolder(this, invFolder.FolderData[i].FolderID, + (ushort)invFolder.FolderData[i].Type, + Util.FieldToString(invFolder.FolderData[i].Name), + invFolder.FolderData[i].ParentID); + } + } + break; case PacketType.CreateInventoryItem: CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack; if (OnCreateNewInventoryItem != null) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d808a88..fd743c9 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1036,6 +1036,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnCreateNewInventoryItem += CreateNewInventoryItem; client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder; + client.OnUpdateInventoryFolder += CommsManager.UserProfileCacheService.HandleUpdateInventoryFolder; client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFetchInventoryDescendents; client.OnPurgeInventoryDescendents += CommsManager.UserProfileCacheService.HandlePurgeInventoryDescendents; client.OnRequestTaskInventory += RequestTaskInventory; diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 530b933..9864074 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -107,6 +107,7 @@ namespace SimpleApp public event CreateNewInventoryItem OnCreateNewInventoryItem; public event CreateInventoryFolder OnCreateNewInventoryFolder; + public event UpdateInventoryFolder OnUpdateInventoryFolder; public event FetchInventoryDescendents OnFetchInventoryDescendents; public event PurgeInventoryDescendents OnPurgeInventoryDescendents; public event FetchInventory OnFetchInventory; -- cgit v1.1