diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index bef012d665..2d73594189 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -447,7 +447,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.", sp.Name, finalDestination.RegionName); - Fail(sp, finalDestination); + Fail(sp, finalDestination, logout); return; } @@ -479,7 +479,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.", sp.Name, finalDestination.RegionName); - Fail(sp, finalDestination); + Fail(sp, finalDestination, logout); return; } @@ -530,7 +530,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } - private void Fail(ScenePresence sp, GridRegion finalDestination) + protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) { // Client never contacted destination. Let's restore everything back sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 38a7805b3d..b2770956bd 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer private bool m_Initialized = false; + private bool m_RestrictInventoryAccessAbroad = false; + private GatekeeperServiceConnector m_GatekeeperConnector; #region ISharedRegionModule @@ -68,6 +70,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (name == Name) { InitialiseCommon(source); + IConfig transferConfig = source.Configs["HGEntityTransfer"]; + if (transferConfig != null) + m_RestrictInventoryAccessAbroad = transferConfig.GetBoolean("RestrictInventoryAccessAbroad", false); + m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); } } @@ -170,6 +176,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); logout = success; // flag for later logout from this grid; this is an HG TP + if (success && m_RestrictInventoryAccessAbroad) + { + // TODO tell the viewer to remove the root folder + } + return success; } else @@ -283,6 +294,21 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } + protected override void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) + { + base.Fail(sp, finalDestination, logout); + if (logout && m_RestrictInventoryAccessAbroad) + { + // Restore the user's inventory, because we removed it earlier on + InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(sp.UUID); + if (root != null) + { + m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring"); + sp.ControllingClient.SendBulkUpdateInventory(root); + } + } + } + #endregion #region IUserAgentVerificationModule diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0dcbcdba3d..c95c151030 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2675,6 +2675,14 @@ namespace OpenSim.Region.Framework.Scenes // Cache the user's name CacheUserName(sp, aCircuit); + // Let's send the Suitcase folder for incoming HG agents + if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) + { + m_log.DebugFormat("[SCENE]: Sending root folder to viewer..."); + InventoryFolderBase suitcase = InventoryService.GetRootFolder(client.AgentId); + client.SendBulkUpdateInventory(suitcase); + } + EventManager.TriggerOnNewClient(client); if (vialogin) EventManager.TriggerOnClientLogin(client);