diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 27a1e686b6..c257a67909 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -467,7 +467,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; } @@ -499,7 +499,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; } @@ -550,7 +550,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 56ec4742ff..2dde6dfc31 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 @@ -284,6 +295,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 54c51c00b6..e5d7a55d99 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2664,6 +2664,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);