diff --git a/OpenSim/Client/Linden/LLProxyLoginModule.cs b/OpenSim/Client/Linden/LLProxyLoginModule.cs index efae23495a..9075f15f43 100644 --- a/OpenSim/Client/Linden/LLProxyLoginModule.cs +++ b/OpenSim/Client/Linden/LLProxyLoginModule.cs @@ -268,7 +268,7 @@ namespace OpenSim.Client.Linden else { string reason; - if (scene.NewUserConnection(agentData, out reason)) + if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) { success = true; } diff --git a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs index 8739ce5e52..8047f74c8e 100644 --- a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs +++ b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs @@ -199,7 +199,7 @@ namespace OpenSim.Client.Linden Scene scene; if (TryGetRegion(regionHandle, out scene)) { - return scene.NewUserConnection(agent, out reason); + return scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); } reason = "Region not found."; return false; diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs index 63381a403b..7d71f18d58 100644 --- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs +++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs @@ -609,7 +609,7 @@ namespace OpenSim.Client.MXP.PacketHandler agent.Appearance = new AvatarAppearance(); } - return scene.NewUserConnection(agent, out reason); + return scene.NewUserConnection(agent, 0, out reason); } public void PrintDebugInformation() diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs index 297b0464ad..5ceaf39dcf 100644 --- a/OpenSim/Framework/Communications/Clients/RegionClient.cs +++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs @@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Clients { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public bool DoCreateChildAgentCall(GridRegion region, AgentCircuitData aCircuit, string authKey, out string reason) + public bool DoCreateChildAgentCall(GridRegion region, AgentCircuitData aCircuit, string authKey, uint teleportFlags, out string reason) { reason = String.Empty; @@ -83,7 +83,8 @@ namespace OpenSim.Framework.Communications.Clients } // Add the regionhandle of the destination region ulong regionHandle = GetRegionHandle(region.RegionHandle); - args["destination_handle"] = OSD.FromString(regionHandle.ToString()); + args["destination_handle"] = OSD.FromString(regionHandle.ToString()); + args["teleport_flags"] = OSD.FromString(teleportFlags.ToString()); string strBuffer = ""; byte[] buffer = new byte[1]; diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index c727cec860..10a3232019 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -557,7 +557,7 @@ namespace OpenSim.Region.CoreModules.InterGrid // Call 'new user' event handler string reason; - if (!homeScene.NewUserConnection(agentData, out reason)) + if (!homeScene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) { responseMap["connect"] = OSD.FromBoolean(false); responseMap["message"] = OSD.FromString(String.Format("Connection refused: {0}", reason)); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs index bdfe3b17d7..d68c683143 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs @@ -144,7 +144,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion * Agent-related communications */ - public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason) + public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason) { foreach (Scene s in m_sceneList) @@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion if (s.RegionInfo.RegionHandle == regionHandle) { // m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle); - return s.NewUserConnection(aCircuit, out reason); + return s.NewUserConnection(aCircuit, teleportFlags, out reason); } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs index 39e2413751..0357c60060 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs @@ -157,10 +157,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion * Agent-related communications */ - public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason) + public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason) { // Try local first - if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, out reason)) + if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, teleportFlags, out reason)) return true; // else do the remote thing @@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion { m_regionClient.SendUserInformation(regInfo, aCircuit); - return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None", out reason); + return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None", teleportFlags, out reason); } //else // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); @@ -435,11 +435,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion } OSDMap resp = new OSDMap(2); - string reason = String.Empty; - + string reason = String.Empty; + uint teleportFlags = 0; + if (args.ContainsKey("teleport_flags")) + { + teleportFlags = args["teleport_flags"].AsUInteger(); + } + // This is the meaning of POST agent m_regionClient.AdjustUserInformation(aCircuit); - bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit, out reason); + bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit, teleportFlags, out reason); resp["reason"] = OSD.FromString(reason); resp["success"] = OSD.FromBoolean(result); diff --git a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs index 8f4d3d54eb..2d6287f87d 100644 --- a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs +++ b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs @@ -37,7 +37,7 @@ namespace OpenSim.Region.Framework.Interfaces { #region Agents - bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason); + bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason); /// /// Full child agent update. diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs index 0f9c190265..416826c3be 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs @@ -203,7 +203,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid string reason = String.Empty; //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) - if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, out reason)) + if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason)) { avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", reason)); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 37734f40eb..2091bf0ef2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3343,12 +3343,16 @@ namespace OpenSim.Region.Framework.Scenes /// Use NewUserConnection() directly if possible so the return type can refuse connections. /// At the moment nothing actually seems to use this event, /// as everything is switching to calling the NewUserConnection method directly. + /// + /// Now obsoleting this because it doesn't handle teleportFlags propertly + /// /// /// + [Obsolete("Please call NewUserConnection directly.")] public void HandleNewUserConnection(AgentCircuitData agent) { string reason; - NewUserConnection(agent, out reason); + NewUserConnection(agent, 0, out reason); } /// @@ -3361,8 +3365,16 @@ namespace OpenSim.Region.Framework.Scenes /// Outputs the reason for the false response on this string /// True if the region accepts this agent. False if it does not. False will /// also return a reason. - public bool NewUserConnection(AgentCircuitData agent, out string reason) + public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) { + //Teleport flags: + // + // TeleportFlags.ViaGodlikeLure - Border Crossing + // TeleportFlags.ViaLogin - Login + // TeleportFlags.TeleportFlags.ViaLure - Teleport request sent by another user + // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport + + if (loginsdisabled) { reason = "Logins Disabled"; @@ -3370,9 +3382,9 @@ namespace OpenSim.Region.Framework.Scenes } // Don't disable this log message - it's too helpful m_log.InfoFormat( - "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5})", + "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, - agent.AgentID, agent.circuitcode); + agent.AgentID, agent.circuitcode, teleportFlags); reason = String.Empty; if (!AuthenticateUser(agent, out reason)) diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 0a02d3942f..8c808ab91c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -286,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes string reason = String.Empty; - bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason); + bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason); if (regionAccepted && newAgent) { @@ -835,7 +835,7 @@ namespace OpenSim.Region.Framework.Scenes // Let's create an agent there if one doesn't exist yet. //if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) - if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, out reason)) + if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason)) { avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}", reason)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index f495022177..f00dd66157 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -117,7 +117,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests agent.child = true; string reason; - scene.NewUserConnection(agent, out reason); + scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); testclient = new TestClient(agent, scene); scene.AddNewClient(testclient); @@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests if (acd1 == null) fixNullPresence(); - scene.NewUserConnection(acd1, out reason); + scene.NewUserConnection(acd1, 0, out reason); if (testclient == null) testclient = new TestClient(acd1, scene); scene.AddNewClient(testclient); @@ -242,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Adding child agent to region 1001 string reason; - scene2.NewUserConnection(acd1, out reason); + scene2.NewUserConnection(acd1,0, out reason); scene2.AddNewClient(testclient); ScenePresence presence = scene.GetScenePresence(agent1); diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 8b18d07fb8..b13e8dd208 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -382,7 +382,7 @@ namespace OpenSim.Tests.Common.Setup // We emulate the proper login sequence here by doing things in three stages // Stage 1: simulate login by telling the scene to expect a new user connection - scene.NewUserConnection(agentData, out reason); + scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason); // Stage 2: add the new client as a child agent to the scene TestClient client = new TestClient(agentData, scene);