From 0b5cdc539c767b526f14cb7e7d97fd83bea14424 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 29 Dec 2009 18:35:06 +0000 Subject: [PATCH 1/2] Change teleports so the TeleportFlags are sent to the destination sim. It can now determine if a connection is from login, teleport or crossing. Needed for a meaningful banlines implementation --- OpenSim/Client/Linden/LLProxyLoginModule.cs | 2 +- .../Client/Linden/LLStandaloneLoginModule.cs | 2 +- .../MXP/PacketHandler/MXPPacketServer.cs | 2 +- .../Communications/Clients/RegionClient.cs | 5 +++-- .../InterGrid/OpenGridProtocolModule.cs | 2 +- .../Interregion/LocalInterregionComms.cs | 4 ++-- .../Interregion/RESTInterregionComms.cs | 17 ++++++++++------ .../Framework/Interfaces/IInterregionComms.cs | 2 +- .../Hypergrid/HGSceneCommunicationService.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 20 +++++++++++++++---- .../Scenes/SceneCommunicationService.cs | 4 ++-- .../Scenes/Tests/ScenePresenceTests.cs | 6 +++--- .../Tests/Common/Setup/SceneSetupHelpers.cs | 2 +- 13 files changed, 44 insertions(+), 26 deletions(-) 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 710e3ca5d9..44458d175f 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); @@ -436,11 +436,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 f79eb5decb..0e1e2be434 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3316,12 +3316,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); } /// @@ -3334,8 +3338,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"; @@ -3343,9 +3355,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 e649139332..f49d072087 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) { @@ -810,7 +810,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); From 917fad40da98dc0485b43e9af363d04708570e27 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Dec 2009 00:36:16 +0000 Subject: [PATCH 2/2] Fix an omission in LSL that causes a viewer crash --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2b6d9bd67c..6102504891 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6260,6 +6260,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSLError("First parameter to llDialog needs to be a key"); return; } + if (buttons.Length < 1) + { + LSLError("No less than 1 button can be shown"); + return; + } if (buttons.Length > 12) { LSLError("No more than 12 buttons can be shown");