From 27a7391d6b3df7d5e3d688ae27fa3ff21dcf421f Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sat, 3 May 2008 23:33:20 +0000 Subject: * Add ability to defer item actions for AddItem() and DeleteItem(). This won't be useful until we let the client cache (again?) --- .../Communications/Cache/CachedUserInfo.cs | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework/Communications/Cache/CachedUserInfo.cs') diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 84e42a3..6f7c4da 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -35,6 +35,8 @@ using log4net; namespace OpenSim.Framework.Communications.Cache { + internal delegate void AddItemDelegate(InventoryItemBase itemInfo); + internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo); internal delegate void DeleteItemDelegate(LLUUID itemID); internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); @@ -532,13 +534,20 @@ namespace OpenSim.Framework.Communications.Cache /// Add an item to the user's inventory /// /// - public void AddItem(InventoryItemBase itemInfo) + public void AddItem(InventoryItemBase item) { if (HasInventory) { - ItemReceive(itemInfo); - m_commsManager.InventoryService.AddItem(itemInfo); + ItemReceive(item); + m_commsManager.InventoryService.AddItem(item); } + else + { + AddRequest( + new InventoryRequest( + Delegate.CreateDelegate(typeof(AddItemDelegate), this, "AddItem"), + new object[] { item })); + } } /// @@ -546,12 +555,19 @@ namespace OpenSim.Framework.Communications.Cache /// /// /// - public void UpdateItem(InventoryItemBase itemInfo) + public void UpdateItem(InventoryItemBase item) { if (HasInventory) { - m_commsManager.InventoryService.UpdateItem(itemInfo); + m_commsManager.InventoryService.UpdateItem(item); } + else + { + AddRequest( + new InventoryRequest( + Delegate.CreateDelegate(typeof(UpdateItemDelegate), this, "UpdateItem"), + new object[] { item })); + } } /// -- cgit v1.1