From 412112acbafa6e1f111b12007fd3a81728d0b2f5 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 23 Mar 2009 00:11:34 +0000 Subject: Committing partial work on passing folders across instances. This may crash. --- .../Communications/Hypergrid/HGInventoryService.cs | 23 +++++++++++++++ .../Communications/OGS1/OGS1InventoryService.cs | 16 +++++++++++ .../OGS1/OGS1SecureInventoryService.cs | 16 +++++++++++ .../Inventory/Transfer/InventoryTransferModule.cs | 33 ++++++++++++++++++++-- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 7 +++++ 5 files changed, 93 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs index 9d70c46..a9e008c 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs @@ -340,6 +340,29 @@ namespace OpenSim.Region.Communications.Hypergrid return null; } + + public InventoryFolderBase QueryFolder(InventoryFolderBase item, UUID session_id) + { + if (IsLocalStandaloneUser(item.Owner)) + { + return base.QueryFolder(item); + } + + try + { + string invServ = GetUserInventoryURI(item.Owner); + + return SynchronousRestSessionObjectPoster.BeginPostObject( + "POST", invServ + "/QueryFolder/", item, session_id.ToString(), item.Owner.ToString()); + } + catch (WebException e) + { + m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}", + e.Source, e.Message); + } + + return null; + } #endregion #region Methods common to ISecureInventoryService and IInventoryService diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 56566a8..26e4a55 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -312,6 +312,22 @@ namespace OpenSim.Region.Communications.OGS1 return null; } + public InventoryFolderBase QueryFolder(InventoryFolderBase item) + { + try + { + return SynchronousRestObjectPoster.BeginPostObject( + "POST", _inventoryServerUrl + "/QueryFolder/", item); + } + catch (WebException e) + { + m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}", + e.Source, e.Message); + } + + return null; + } + public bool HasInventoryForUser(UUID userID) { return false; diff --git a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs index 0f50b01..03fb0d5 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs @@ -312,6 +312,22 @@ namespace OpenSim.Region.Communications.OGS1 return null; } + public InventoryFolderBase QueryFolder(InventoryFolderBase item, UUID session_id) + { + try + { + return SynchronousRestSessionObjectPoster.BeginPostObject( + "POST", _inventoryServerUrl + "/QueryFolder/", item, session_id.ToString(), item.Owner.ToString()); + } + catch (WebException e) + { + m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}", + e.Source, e.Message); + } + + return null; + } + public bool HasInventoryForUser(UUID userID) { return false; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 465167a..19b9b22 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -426,9 +426,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer if (AssetType.Folder == assetType) { - // Folders not implemented yet + UUID folderID = new UUID(msg.binaryBucket, 1); + InventoryFolderBase folder = new InventoryFolderBase(); + + folder.ID = folderID; + folder.Owner = user.ControllingClient.AgentId; + + // Fetch from database // - return; + if (!userInfo.QueryFolder(folder)) + { + m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give"); + return; + } + + // Get folder info + // + InventoryFolderImpl folderInfo = userInfo.RootFolder.FindFolder(folder.ID); + if (folderInfo == null) + { + m_log.Debug("[INVENTORY TRANSFER] Can't retrieve folder to give"); + return; + } + + user.ControllingClient.SendBulkUpdateInventory(folderInfo); + + // Deliver message + // + user.ControllingClient.SendInstantMessage( + new UUID(msg.fromAgentID), msg.message, + new UUID(msg.toAgentID), + msg.fromAgentName, msg.dialog, msg.timestamp, + folderID, false, msg.binaryBucket); } else { diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9528114..d129b93 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -618,6 +618,13 @@ namespace OpenSim.Region.Framework.Scenes return null; } + if (!recipientUserInfo.HasReceivedInventory) + { + recipientUserInfo.FetchInventory(); + if (!WaitForInventory(recipientUserInfo)) + return null; + } + if (recipientParentFolderId == UUID.Zero) recipientParentFolderId = recipientUserInfo.RootFolder.ID; -- cgit v1.1