diff options
author | Melanie Thielker | 2009-03-21 17:46:58 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-03-21 17:46:58 +0000 |
commit | 1121a214b9258487dae0d84dad1a0b495d2f80bd (patch) | |
tree | 10576cab4d44bbe39f4f759f8ffac68530e40055 /OpenSim/Framework | |
parent | Move a check for null PhysActor in applyImpulse so that attachments can move ... (diff) | |
download | opensim-SC_OLD-1121a214b9258487dae0d84dad1a0b495d2f80bd.zip opensim-SC_OLD-1121a214b9258487dae0d84dad1a0b495d2f80bd.tar.gz opensim-SC_OLD-1121a214b9258487dae0d84dad1a0b495d2f80bd.tar.bz2 opensim-SC_OLD-1121a214b9258487dae0d84dad1a0b495d2f80bd.tar.xz |
Add a QueryItem method to the inventory subsystem. Currently implemented for
MySQL only, stubs for the others. This allows updating the cache with a single
item from the database.
Diffstat (limited to 'OpenSim/Framework')
3 files changed, 64 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index c5bbd6a..57c3ece 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -36,6 +36,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
36 | internal delegate void AddItemDelegate(InventoryItemBase itemInfo); | 36 | internal delegate void AddItemDelegate(InventoryItemBase itemInfo); |
37 | internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo); | 37 | internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo); |
38 | internal delegate void DeleteItemDelegate(UUID itemID); | 38 | internal delegate void DeleteItemDelegate(UUID itemID); |
39 | internal delegate void QueryItemDelegate(UUID itemID); | ||
39 | 40 | ||
40 | internal delegate void CreateFolderDelegate(string folderName, UUID folderID, ushort folderType, UUID parentID); | 41 | internal delegate void CreateFolderDelegate(string folderName, UUID folderID, ushort folderType, UUID parentID); |
41 | internal delegate void MoveFolderDelegate(UUID folderID, UUID parentID); | 42 | internal delegate void MoveFolderDelegate(UUID folderID, UUID parentID); |
@@ -767,6 +768,47 @@ namespace OpenSim.Framework.Communications.Cache | |||
767 | 768 | ||
768 | return RootFolder.FindFolderForType(type); | 769 | return RootFolder.FindFolderForType(type); |
769 | } | 770 | } |
771 | |||
772 | // Load additional items that other regions have put into the database | ||
773 | // The item will be added tot he local cache. Returns true if the item | ||
774 | // was found and can be sent to the client | ||
775 | // | ||
776 | public bool QueryItem(UUID itemID) | ||
777 | { | ||
778 | if (m_hasReceivedInventory) | ||
779 | { | ||
780 | InventoryItemBase item = RootFolder.FindItem(itemID); | ||
781 | |||
782 | if (item != null) | ||
783 | { | ||
784 | // Item is in local cache, just update client | ||
785 | // | ||
786 | return true; | ||
787 | } | ||
788 | |||
789 | InventoryItemBase itemInfo = m_commsManager.InventoryService.QueryItem(item); | ||
790 | if (itemInfo != null) | ||
791 | { | ||
792 | InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder); | ||
793 | ItemReceive(itemInfo, folder); | ||
794 | return true; | ||
795 | } | ||
796 | |||
797 | return false; | ||
798 | } | ||
799 | else | ||
800 | { | ||
801 | AddRequest( | ||
802 | new InventoryRequest( | ||
803 | Delegate.CreateDelegate(typeof(QueryItemDelegate), this, "QueryItem"), | ||
804 | new object[] { itemID })); | ||
805 | |||
806 | return true; | ||
807 | } | ||
808 | |||
809 | return false; | ||
810 | } | ||
811 | |||
770 | } | 812 | } |
771 | 813 | ||
772 | /// <summary> | 814 | /// <summary> |
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index aead3be..fc9d8af 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs | |||
@@ -105,6 +105,14 @@ namespace OpenSim.Framework.Communications | |||
105 | bool DeleteItem(InventoryItemBase item); | 105 | bool DeleteItem(InventoryItemBase item); |
106 | 106 | ||
107 | /// <summary> | 107 | /// <summary> |
108 | /// Query the server for an item that may have been added by | ||
109 | /// another region | ||
110 | /// </summary> | ||
111 | /// <param name="item"></param> | ||
112 | /// <returns>true if the item was found in local cache</returns> | ||
113 | InventoryItemBase QueryItem(InventoryItemBase item); | ||
114 | |||
115 | /// <summary> | ||
108 | /// Does the given user have an inventory structure? | 116 | /// Does the given user have an inventory structure? |
109 | /// </summary> | 117 | /// </summary> |
110 | /// <param name="userID"></param> | 118 | /// <param name="userID"></param> |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 8068080..cad7989 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -278,6 +278,20 @@ namespace OpenSim.Framework.Communications | |||
278 | return true; | 278 | return true; |
279 | } | 279 | } |
280 | 280 | ||
281 | public virtual InventoryItemBase QueryItem(InventoryItemBase item) | ||
282 | { | ||
283 | foreach (IInventoryDataPlugin plugin in m_plugins) | ||
284 | { | ||
285 | InventoryItemBase result = plugin.queryInventoryItem(item.ID); | ||
286 | if (result != null) | ||
287 | { | ||
288 | return result; | ||
289 | } | ||
290 | } | ||
291 | |||
292 | return null; | ||
293 | } | ||
294 | |||
281 | /// <summary> | 295 | /// <summary> |
282 | /// Purge a folder of all items items and subfolders. | 296 | /// Purge a folder of all items items and subfolders. |
283 | /// | 297 | /// |