diff options
author | Melanie Thielker | 2009-03-22 15:42:22 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-03-22 15:42:22 +0000 |
commit | e6bb86a22428c6ed9e3d97e5347835e5e5cff598 (patch) | |
tree | e4c82542e73b0e048f0f0d1c3b6352515f4ad326 | |
parent | Fox a null ref in the inventory give module (diff) | |
download | opensim-SC-e6bb86a22428c6ed9e3d97e5347835e5e5cff598.zip opensim-SC-e6bb86a22428c6ed9e3d97e5347835e5e5cff598.tar.gz opensim-SC-e6bb86a22428c6ed9e3d97e5347835e5e5cff598.tar.bz2 opensim-SC-e6bb86a22428c6ed9e3d97e5347835e5e5cff598.tar.xz |
Add QueryItem method to secure inventory and HG inventory, change method sig to
provide additional information the HG needs.
5 files changed, 61 insertions, 9 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 03569f6..4ea1e22 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -773,23 +773,30 @@ namespace OpenSim.Framework.Communications.Cache | |||
773 | // The item will be added tot he local cache. Returns true if the item | 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 | 774 | // was found and can be sent to the client |
775 | // | 775 | // |
776 | public bool QueryItem(UUID itemID) | 776 | public bool QueryItem(InventoryItemBase item) |
777 | { | 777 | { |
778 | if (m_hasReceivedInventory) | 778 | if (m_hasReceivedInventory) |
779 | { | 779 | { |
780 | InventoryItemBase item = RootFolder.FindItem(itemID); | 780 | InventoryItemBase invItem = RootFolder.FindItem(item.ID); |
781 | 781 | ||
782 | if (item != null) | 782 | if (invItem != null) |
783 | { | 783 | { |
784 | // Item is in local cache, just update client | 784 | // Item is in local cache, just update client |
785 | // | 785 | // |
786 | return true; | 786 | return true; |
787 | } | 787 | } |
788 | 788 | ||
789 | item = new InventoryItemBase(); | 789 | InventoryItemBase itemInfo = null; |
790 | item.ID = itemID; | 790 | |
791 | if (m_commsManager.SecureInventoryService != null) | ||
792 | { | ||
793 | m_commsManager.SecureInventoryService.QueryItem(item, m_session_id); | ||
794 | } | ||
795 | else | ||
796 | { | ||
797 | m_commsManager.InventoryService.QueryItem(item); | ||
798 | } | ||
791 | 799 | ||
792 | InventoryItemBase itemInfo = m_commsManager.InventoryService.QueryItem(item); | ||
793 | if (itemInfo != null) | 800 | if (itemInfo != null) |
794 | { | 801 | { |
795 | InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder); | 802 | InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder); |
@@ -804,7 +811,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
804 | AddRequest( | 811 | AddRequest( |
805 | new InventoryRequest( | 812 | new InventoryRequest( |
806 | Delegate.CreateDelegate(typeof(QueryItemDelegate), this, "QueryItem"), | 813 | Delegate.CreateDelegate(typeof(QueryItemDelegate), this, "QueryItem"), |
807 | new object[] { itemID })); | 814 | new object[] { item.ID })); |
808 | 815 | ||
809 | return true; | 816 | return true; |
810 | } | 817 | } |
diff --git a/OpenSim/Framework/Communications/ISecureInventoryService.cs b/OpenSim/Framework/Communications/ISecureInventoryService.cs index 6da13fe..d70dd0b 100644 --- a/OpenSim/Framework/Communications/ISecureInventoryService.cs +++ b/OpenSim/Framework/Communications/ISecureInventoryService.cs | |||
@@ -96,6 +96,8 @@ namespace OpenSim.Framework.Communications | |||
96 | /// <returns>true if the item was successfully deleted</returns> | 96 | /// <returns>true if the item was successfully deleted</returns> |
97 | bool DeleteItem(InventoryItemBase item, UUID session_id); | 97 | bool DeleteItem(InventoryItemBase item, UUID session_id); |
98 | 98 | ||
99 | InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id); | ||
100 | |||
99 | /// <summary> | 101 | /// <summary> |
100 | /// Does the given user have an inventory structure? | 102 | /// Does the given user have an inventory structure? |
101 | /// </summary> | 103 | /// </summary> |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs index 8296910..9d70c46 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs | |||
@@ -317,6 +317,29 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
317 | 317 | ||
318 | return false; | 318 | return false; |
319 | } | 319 | } |
320 | |||
321 | public InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id) | ||
322 | { | ||
323 | if (IsLocalStandaloneUser(item.Owner)) | ||
324 | { | ||
325 | return base.QueryItem(item); | ||
326 | } | ||
327 | |||
328 | try | ||
329 | { | ||
330 | string invServ = GetUserInventoryURI(item.Owner); | ||
331 | |||
332 | return SynchronousRestSessionObjectPoster<InventoryItemBase, InventoryItemBase>.BeginPostObject( | ||
333 | "POST", invServ + "/QueryItem/", item, session_id.ToString(), item.Owner.ToString()); | ||
334 | } | ||
335 | catch (WebException e) | ||
336 | { | ||
337 | m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}", | ||
338 | e.Source, e.Message); | ||
339 | } | ||
340 | |||
341 | return null; | ||
342 | } | ||
320 | #endregion | 343 | #endregion |
321 | 344 | ||
322 | #region Methods common to ISecureInventoryService and IInventoryService | 345 | #region Methods common to ISecureInventoryService and IInventoryService |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs index 0f4c732..0f50b01 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs | |||
@@ -296,6 +296,22 @@ namespace OpenSim.Region.Communications.OGS1 | |||
296 | return false; | 296 | return false; |
297 | } | 297 | } |
298 | 298 | ||
299 | public InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id) | ||
300 | { | ||
301 | try | ||
302 | { | ||
303 | return SynchronousRestSessionObjectPoster<InventoryItemBase, InventoryItemBase>.BeginPostObject( | ||
304 | "POST", _inventoryServerUrl + "/QueryItem/", item, session_id.ToString(), item.Owner.ToString()); | ||
305 | } | ||
306 | catch (WebException e) | ||
307 | { | ||
308 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}", | ||
309 | e.Source, e.Message); | ||
310 | } | ||
311 | |||
312 | return null; | ||
313 | } | ||
314 | |||
299 | public bool HasInventoryForUser(UUID userID) | 315 | public bool HasInventoryForUser(UUID userID) |
300 | { | 316 | { |
301 | return false; | 317 | return false; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 147d453..465167a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -433,10 +433,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
433 | else | 433 | else |
434 | { | 434 | { |
435 | UUID itemID = new UUID(msg.binaryBucket, 1); | 435 | UUID itemID = new UUID(msg.binaryBucket, 1); |
436 | InventoryItemBase item = new InventoryItemBase(); | ||
437 | |||
438 | item.ID = itemID; | ||
439 | item.Owner = user.ControllingClient.AgentId; | ||
436 | 440 | ||
437 | // Fetch from database | 441 | // Fetch from database |
438 | // | 442 | // |
439 | if (!userInfo.QueryItem(itemID)) | 443 | if (!userInfo.QueryItem(item)) |
440 | { | 444 | { |
441 | m_log.Debug("[INVENTORY TRANSFER] Can't find item to give"); | 445 | m_log.Debug("[INVENTORY TRANSFER] Can't find item to give"); |
442 | return; | 446 | return; |
@@ -444,7 +448,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
444 | 448 | ||
445 | // Get item info | 449 | // Get item info |
446 | // | 450 | // |
447 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 451 | item = userInfo.RootFolder.FindItem(item.ID); |
448 | if (item == null) | 452 | if (item == null) |
449 | { | 453 | { |
450 | m_log.Debug("[INVENTORY TRANSFER] Can't retrieve item to give"); | 454 | m_log.Debug("[INVENTORY TRANSFER] Can't retrieve item to give"); |