From 41ad610f3e44d2c73451ab49b71e697259c8c965 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 12 Aug 2009 13:11:15 -0700 Subject: * Added two new packet handler implementations for inventory ops. This is starting to work! - but can't be activated incrementally, the flip needs to be global for all inventory ops. * Added a base inventory connector that does common processing of inventory among all reference connector implementations. E.g. AddItem requires additional processing before being forwarded to service. * Added if (m_Enabled) upon RemoveRegion --- OpenSim/Framework/InventoryFolderBase.cs | 19 +++ .../Inventory/BaseInventoryConnector.cs | 179 +++++++++++++++++++++ .../Inventory/HGInventoryBroker.cs | 52 +++--- .../Inventory/InventoryCache.cs | 9 +- .../Inventory/LocalInventoryServiceConnector.cs | 52 +++--- .../Inventory/RemoteInventoryServiceConnector.cs | 52 +++--- .../Framework/Scenes/Scene.PacketHandlers.cs | 31 +++- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +- 8 files changed, 323 insertions(+), 77 deletions(-) create mode 100644 OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs index e923f39..05f11a4 100644 --- a/OpenSim/Framework/InventoryFolderBase.cs +++ b/OpenSim/Framework/InventoryFolderBase.cs @@ -68,5 +68,24 @@ namespace OpenSim.Framework get { return _version; } set { _version = value; } } + + public InventoryFolderBase() + { + } + + public InventoryFolderBase(UUID id) + { + ID = id; + } + + public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version) + { + ID = id; + Name = name; + Owner = owner; + Type = type; + ParentID = parent; + Version = version; + } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs new file mode 100644 index 0000000..f2b736c --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; + +using OpenMetaverse; +using Nini.Config; +using log4net; + +using OpenSim.Framework; +using OpenSim.Services.Interfaces; + + +namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory +{ + public abstract class BaseInventoryConnector : IInventoryService + { + protected InventoryCache m_cache; + + protected virtual void Init(IConfigSource source) + { + m_cache = new InventoryCache(); + m_cache.Init(source, this); + } + + /// + /// Create the entire inventory for a given user + /// + /// + /// + public abstract bool CreateUserInventory(UUID user); + + /// + /// Gets the skeleton of the inventory -- folders only + /// + /// + /// + public abstract List GetInventorySkeleton(UUID userId); + + /// + /// Synchronous inventory fetch. + /// + /// + /// + public abstract InventoryCollection GetUserInventory(UUID userID); + + /// + /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the + /// inventory has been received + /// + /// + /// + public abstract void GetUserInventory(UUID userID, InventoryReceiptCallback callback); + + /// + /// Retrieve the root inventory folder for the given user. + /// + /// + /// null if no root folder was found + public abstract InventoryFolderBase GetRootFolder(UUID userID); + + public abstract Dictionary GetSystemFolders(UUID userID); + + /// + /// Gets the user folder for the given folder-type + /// + /// + /// + /// + public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) + { + return m_cache.GetFolderForType(userID, type); + } + + /// + /// Gets everything (folders and items) inside a folder + /// + /// + /// + /// + public abstract InventoryCollection GetFolderContent(UUID userID, UUID folderID); + + /// + /// Gets the items inside a folder + /// + /// + /// + /// + public abstract List GetFolderItems(UUID userID, UUID folderID); + + /// + /// Add a new folder to the user's inventory + /// + /// + /// true if the folder was successfully added + public abstract bool AddFolder(InventoryFolderBase folder); + + /// + /// Update a folder in the user's inventory + /// + /// + /// true if the folder was successfully updated + public abstract bool UpdateFolder(InventoryFolderBase folder); + + /// + /// Move an inventory folder to a new location + /// + /// A folder containing the details of the new location + /// true if the folder was successfully moved + public abstract bool MoveFolder(InventoryFolderBase folder); + + /// + /// Purge an inventory folder of all its items and subfolders. + /// + /// + /// true if the folder was successfully purged + public abstract bool PurgeFolder(InventoryFolderBase folder); + + /// + /// Add a new item to the user's inventory. + /// If the given item has to parent folder, it tries to find the most + /// suitable folder for it. + /// + /// + /// true if the item was successfully added + public bool AddItem(InventoryItemBase item) + { + if (item.Folder == UUID.Zero) + { + InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType); + if (f != null) + item.Folder = f.ID; + else + { + f = GetRootFolder(item.Owner); + if (f != null) + item.Folder = f.ID; + else + return false; + } + } + + return AddItemPlain(item); + } + + protected abstract bool AddItemPlain(InventoryItemBase item); + + /// + /// Update an item in the user's inventory + /// + /// + /// true if the item was successfully updated + public abstract bool UpdateItem(InventoryItemBase item); + + /// + /// Delete an item from the user's inventory + /// + /// + /// true if the item was successfully deleted + public abstract bool DeleteItem(InventoryItemBase item); + + public abstract InventoryItemBase QueryItem(InventoryItemBase item); + + public abstract InventoryFolderBase QueryFolder(InventoryFolderBase folder); + + /// + /// Does the given user have an inventory structure? + /// + /// + /// + public abstract bool HasInventoryForUser(UUID userID); + + /// + /// Get the active gestures of the agent. + /// + /// + /// + public abstract List GetActiveGestures(UUID userId); + + } +} diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index d4168fe..62b9bed 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -41,7 +41,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { - public class HGInventoryBroker : InventoryCache, ISharedRegionModule, IInventoryService + public class HGInventoryBroker : BaseInventoryConnector, ISharedRegionModule, IInventoryService { private static readonly ILog m_log = LogManager.GetLogger( @@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { } - public override void AddRegion(Scene scene) + public void AddRegion(Scene scene) { if (!m_Enabled) return; @@ -156,12 +156,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } scene.RegisterModuleInterface(this); - base.AddRegion(scene); + m_cache.AddRegion(scene); } - public override void RemoveRegion(Scene scene) + public void RemoveRegion(Scene scene) { - base.RemoveRegion(scene); + if (!m_Enabled) + return; + + m_cache.RemoveRegion(scene); } public void RegionLoaded(Scene scene) @@ -175,17 +178,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory #region IInventoryService - public bool CreateUserInventory(UUID userID) + public override bool CreateUserInventory(UUID userID) { return m_GridService.CreateUserInventory(userID); } - public List GetInventorySkeleton(UUID userId) + public override List GetInventorySkeleton(UUID userId) { return m_GridService.GetInventorySkeleton(userId); } - public InventoryCollection GetUserInventory(UUID userID) + public override InventoryCollection GetUserInventory(UUID userID) { if (IsLocalGridUser(userID)) return m_GridService.GetUserInventory(userID); @@ -193,7 +196,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return null; } - public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) + public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { if (IsLocalGridUser(userID)) m_GridService.GetUserInventory(userID, callback); @@ -220,7 +223,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory // } //} - public InventoryCollection GetFolderContent(UUID userID, UUID folderID) + public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) { if (IsLocalGridUser(userID)) return m_GridService.GetFolderContent(userID, folderID); @@ -271,12 +274,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return new Dictionary(); } - public List GetFolderItems(UUID userID, UUID folderID) + public override List GetFolderItems(UUID userID, UUID folderID) { return new List(); } - public bool AddFolder(InventoryFolderBase folder) + public override bool AddFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -291,7 +294,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool UpdateFolder(InventoryFolderBase folder) + public override bool UpdateFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -306,7 +309,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool MoveFolder(InventoryFolderBase folder) + public override bool MoveFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -321,7 +324,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool PurgeFolder(InventoryFolderBase folder) + public override bool PurgeFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -336,7 +339,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool AddItem(InventoryItemBase item) + // public bool AddItem(InventoryItemBase item) inherited + // Uses AddItemPlain + + protected override bool AddItemPlain(InventoryItemBase item) { if (item == null) return false; @@ -351,7 +357,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool UpdateItem(InventoryItemBase item) + public override bool UpdateItem(InventoryItemBase item) { if (item == null) return false; @@ -366,7 +372,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool DeleteItem(InventoryItemBase item) + public override bool DeleteItem(InventoryItemBase item) { if (item == null) return false; @@ -381,7 +387,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public InventoryItemBase QueryItem(InventoryItemBase item) + public override InventoryItemBase QueryItem(InventoryItemBase item) { if (item == null) return null; @@ -396,7 +402,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public InventoryFolderBase QueryFolder(InventoryFolderBase folder) + public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) { if (folder == null) return null; @@ -411,17 +417,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool HasInventoryForUser(UUID userID) + public override bool HasInventoryForUser(UUID userID) { return false; } - public InventoryFolderBase GetRootFolder(UUID userID) + public override InventoryFolderBase GetRootFolder(UUID userID) { return null; } - public List GetActiveGestures(UUID userId) + public override List GetActiveGestures(UUID userId) { return new List(); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 3afaba5..551a7eb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -12,21 +12,23 @@ using log4net; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { - public abstract class InventoryCache + public class InventoryCache { private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + protected BaseInventoryConnector m_Connector; protected List m_Scenes; // The cache proper protected Dictionary> m_InventoryCache; - protected virtual void Init(IConfigSource source) + public virtual void Init(IConfigSource source, BaseInventoryConnector connector) { m_Scenes = new List(); m_InventoryCache = new Dictionary>(); + m_Connector = connector; } public virtual void AddRegion(Scene scene) @@ -59,7 +61,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } // If not, go get them and place them in the cache - Dictionary folders = GetSystemFolders(presence.UUID); + Dictionary folders = m_Connector.GetSystemFolders(presence.UUID); m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); if (folders.Count > 0) @@ -95,7 +97,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public abstract Dictionary GetSystemFolders(UUID userID); public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 98e30ce..6efe903 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -41,7 +41,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { - public class LocalInventoryServicesConnector : InventoryCache, ISharedRegionModule, IInventoryService + public class LocalInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService { private static readonly ILog m_log = LogManager.GetLogger( @@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { } - public override void AddRegion(Scene scene) + public void AddRegion(Scene scene) { if (!m_Enabled) return; @@ -141,12 +141,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory // "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); scene.RegisterModuleInterface(this); - base.AddRegion(scene); + m_cache.AddRegion(scene); } - public override void RemoveRegion(Scene scene) + public void RemoveRegion(Scene scene) { - base.RemoveRegion(scene); + if (!m_Enabled) + return; + + m_cache.RemoveRegion(scene); } public void RegionLoaded(Scene scene) @@ -160,22 +163,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory #region IInventoryService - public bool CreateUserInventory(UUID user) + public override bool CreateUserInventory(UUID user) { return m_InventoryService.CreateUserInventory(user); } - public List GetInventorySkeleton(UUID userId) + public override List GetInventorySkeleton(UUID userId) { return m_InventoryService.GetInventorySkeleton(userId); } - public InventoryCollection GetUserInventory(UUID id) + public override InventoryCollection GetUserInventory(UUID id) { return m_InventoryService.GetUserInventory(id); } - public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) + public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { m_InventoryService.GetUserInventory(userID, callback); } @@ -207,13 +210,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return new Dictionary(); } - public InventoryCollection GetFolderContent(UUID userID, UUID folderID) + public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) { return m_InventoryService.GetFolderContent(userID, folderID); } - public List GetFolderItems(UUID userID, UUID folderID) + public override List GetFolderItems(UUID userID, UUID folderID) { return m_InventoryService.GetFolderItems(userID, folderID); } @@ -223,7 +226,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the folder was successfully added - public bool AddFolder(InventoryFolderBase folder) + public override bool AddFolder(InventoryFolderBase folder) { return m_InventoryService.AddFolder(folder); } @@ -233,7 +236,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the folder was successfully updated - public bool UpdateFolder(InventoryFolderBase folder) + public override bool UpdateFolder(InventoryFolderBase folder) { return m_InventoryService.UpdateFolder(folder); } @@ -243,7 +246,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// A folder containing the details of the new location /// true if the folder was successfully moved - public bool MoveFolder(InventoryFolderBase folder) + public override bool MoveFolder(InventoryFolderBase folder) { return m_InventoryService.MoveFolder(folder); } @@ -253,17 +256,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the folder was successfully purged - public bool PurgeFolder(InventoryFolderBase folder) + public override bool PurgeFolder(InventoryFolderBase folder) { return m_InventoryService.PurgeFolder(folder); } /// - /// Add a new item to the user's inventory + /// Add a new item to the user's inventory, plain + /// Called by base class AddItem /// /// /// true if the item was successfully added - public bool AddItem(InventoryItemBase item) + protected override bool AddItemPlain(InventoryItemBase item) { return m_InventoryService.AddItem(item); } @@ -273,7 +277,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the item was successfully updated - public bool UpdateItem(InventoryItemBase item) + public override bool UpdateItem(InventoryItemBase item) { return m_InventoryService.UpdateItem(item); } @@ -283,17 +287,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the item was successfully deleted - public bool DeleteItem(InventoryItemBase item) + public override bool DeleteItem(InventoryItemBase item) { return m_InventoryService.DeleteItem(item); } - public InventoryItemBase QueryItem(InventoryItemBase item) + public override InventoryItemBase QueryItem(InventoryItemBase item) { return m_InventoryService.QueryItem(item); } - public InventoryFolderBase QueryFolder(InventoryFolderBase folder) + public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) { return m_InventoryService.QueryFolder(folder); } @@ -303,7 +307,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// - public bool HasInventoryForUser(UUID userID) + public override bool HasInventoryForUser(UUID userID) { return m_InventoryService.HasInventoryForUser(userID); } @@ -313,12 +317,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// null if no root folder was found - public InventoryFolderBase GetRootFolder(UUID userID) + public override InventoryFolderBase GetRootFolder(UUID userID) { return m_InventoryService.GetRootFolder(userID); } - public List GetActiveGestures(UUID userId) + public override List GetActiveGestures(UUID userId) { return m_InventoryService.GetActiveGestures(userId); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index dceda38..f87aab9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -40,7 +40,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { - public class RemoteInventoryServicesConnector : InventoryCache, ISharedRegionModule, IInventoryService + public class RemoteInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { } - public override void AddRegion(Scene scene) + public void AddRegion(Scene scene) { if (!m_Enabled) return; @@ -117,12 +117,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } scene.RegisterModuleInterface(this); - base.AddRegion(scene); + m_cache.AddRegion(scene); } - public override void RemoveRegion(Scene scene) + public void RemoveRegion(Scene scene) { - base.RemoveRegion(scene); + if (!m_Enabled) + return; + + m_cache.RemoveRegion(scene); } public void RegionLoaded(Scene scene) @@ -138,22 +141,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory #region IInventoryService - public bool CreateUserInventory(UUID user) + public override bool CreateUserInventory(UUID user) { return false; } - public List GetInventorySkeleton(UUID userId) + public override List GetInventorySkeleton(UUID userId) { return new List(); } - public InventoryCollection GetUserInventory(UUID userID) + public override InventoryCollection GetUserInventory(UUID userID) { return null; } - public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) + public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { UUID sessionID = GetSessionID(userID); try @@ -180,7 +183,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID); } - public InventoryCollection GetFolderContent(UUID userID, UUID folderID) + public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) { UUID sessionID = GetSessionID(userID); try @@ -199,12 +202,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return nullCollection; } - public List GetFolderItems(UUID userID, UUID folderID) + public override List GetFolderItems(UUID userID, UUID folderID) { return new List(); } - public bool AddFolder(InventoryFolderBase folder) + public override bool AddFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -213,7 +216,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID); } - public bool UpdateFolder(InventoryFolderBase folder) + public override bool UpdateFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -222,7 +225,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID); } - public bool MoveFolder(InventoryFolderBase folder) + public override bool MoveFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -231,7 +234,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); } - public bool PurgeFolder(InventoryFolderBase folder) + public override bool PurgeFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -240,7 +243,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID); } - public bool AddItem(InventoryItemBase item) + // public bool AddItem(InventoryItemBase item) inherited + // Uses AddItemPlain + + protected override bool AddItemPlain(InventoryItemBase item) { if (item == null) return false; @@ -249,7 +255,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID); } - public bool UpdateItem(InventoryItemBase item) + public override bool UpdateItem(InventoryItemBase item) { if (item == null) return false; @@ -258,7 +264,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); } - public bool DeleteItem(InventoryItemBase item) + public override bool DeleteItem(InventoryItemBase item) { if (item == null) return false; @@ -267,7 +273,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); } - public InventoryItemBase QueryItem(InventoryItemBase item) + public override InventoryItemBase QueryItem(InventoryItemBase item) { if (item == null) return null; @@ -276,7 +282,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); } - public InventoryFolderBase QueryFolder(InventoryFolderBase folder) + public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) { if (folder == null) return null; @@ -285,17 +291,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID); } - public bool HasInventoryForUser(UUID userID) + public override bool HasInventoryForUser(UUID userID) { return false; } - public InventoryFolderBase GetRootFolder(UUID userID) + public override InventoryFolderBase GetRootFolder(UUID userID) { return null; } - public List GetActiveGestures(UUID userId) + public override List GetActiveGestures(UUID userId) { return new List(); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 9251aa6..113918d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -622,8 +622,26 @@ namespace OpenSim.Region.Framework.Scenes "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}", folderID, parentID, remoteClient.Name); } + } + + public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID) + { + InventoryFolderBase folder = new InventoryFolderBase(folderID); + folder = InventoryService.QueryFolder(folder); + if (folder != null) + { + folder.ParentID = parentID; + if (!InventoryService.MoveFolder(folder)) + m_log.WarnFormat("[AGENT INVENTORY]: could not move folder {0}", folderID); + else + m_log.DebugFormat("[AGENT INVENTORY]: folder {0} moved to parent {1}", folderID, parentID); + } + else + { + m_log.WarnFormat("[AGENT INVENTORY]: request to move folder {0} but folder not found", folderID); + } } - + /// /// This should delete all the items and folders in the given directory. /// @@ -647,6 +665,17 @@ namespace OpenSim.Region.Framework.Scenes "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}", remoteClient.Name, remoteClient.AgentId); } + } + + public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID) + { + InventoryFolderBase folder = new InventoryFolderBase(folderID); + + if (InventoryService.PurgeFolder(folder)) + m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); + else + m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID); } + } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7f1936e..919075c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2019,12 +2019,13 @@ namespace OpenSim.Region.Framework.Scenes client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; client.OnObjectPermissions += HandleObjectPermissionsUpdate; + client.OnCreateNewInventoryItem += CreateNewInventoryItem; client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; - client.OnMoveInventoryFolder += HandleMoveInventoryFolder; + client.OnMoveInventoryFolder += HandleMoveInventoryFolder; // 2; //!! client.OnFetchInventoryDescendents += HandleFetchInventoryDescendents; - client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; + client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; // 2; //!! client.OnFetchInventory += HandleFetchInventory; client.OnUpdateInventoryItem += UpdateInventoryItemAsset; client.OnCopyInventoryItem += CopyInventoryItem; @@ -2036,6 +2037,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnRemoveTaskItem += RemoveTaskInventory; client.OnUpdateTaskInventory += UpdateTaskInventory; client.OnMoveTaskItem += ClientMoveTaskInventoryItem; + client.OnGrabObject += ProcessObjectGrab; client.OnDeGrabObject += ProcessObjectDeGrab; client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; -- cgit v1.1