From 0c81966c0a8f69474fb542d7b4df1780ef756519 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 29 Jan 2010 09:12:22 -0800 Subject: Works for grid login. --- .../EntityTransfer/EntityTransferModule.cs | 6 +++- .../EntityTransfer/HGEntityTransferModule.cs | 39 ++++++++++++++++------ 2 files changed, 33 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/CoreModules/Framework') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 44f1191..ee6cb04 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -97,7 +97,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer scene.EventManager.OnNewClient += OnNewClient; } - protected void OnNewClient(IClientAPI client) + protected virtual void OnNewClient(IClientAPI client) { client.OnTeleportHomeRequest += TeleportHome; } @@ -268,6 +268,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (sp.ParentID != (uint)0) sp.StandUp(); + m_log.Debug("XXX HERE 1"); if (!sp.ValidateAttachments()) { sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); @@ -978,12 +979,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) { + AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); agent.BaseFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero; agent.startpos = new Vector3(128, 128, 70); agent.child = true; agent.Appearance = sp.Appearance; + if (currentAgentCircuit != null) + agent.ServiceURLs = currentAgentCircuit.ServiceURLs; if (newRegions.Contains(neighbour.RegionHandle)) { diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 85c2742..fbf8be9 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -85,8 +85,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } - void OnNewClient(IClientAPI client) + protected override void OnNewClient(IClientAPI client) { + base.OnNewClient(client); client.OnLogout += new Action(OnLogout); } @@ -118,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected override GridRegion GetFinalDestination(GridRegion region) { int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, region.RegionID); - //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); + m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: region {0} flags: {1}", region.RegionID, flags); if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) { m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); @@ -129,7 +130,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) { - return true; + if (base.NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) + return true; + + int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); + if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) + return true; + + return false; } protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) @@ -139,14 +147,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) { // this user is going to another grid - string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); - IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); - bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); - if (success) - // Log them out of this grid - m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat); - - return success; + if (agentCircuit.ServiceURLs.ContainsKey("HomeURI")) + { + string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); + IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); + bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); + if (success) + // Log them out of this grid + m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat); + + return success; + } + else + { + m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent does not have a HomeURI address"); + return false; + } } return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); @@ -220,6 +236,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer void OnLogout(IClientAPI obj) { + m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: client {0} logged out in {1}", obj.AgentId, obj.Scene.RegionInfo.RegionName); AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) -- cgit v1.1