From 0b5cdc539c767b526f14cb7e7d97fd83bea14424 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 29 Dec 2009 18:35:06 +0000
Subject: 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
---
.../Scenes/Hypergrid/HGSceneCommunicationService.cs | 2 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 20 ++++++++++++++++----
.../Framework/Scenes/SceneCommunicationService.cs | 4 ++--
.../Framework/Scenes/Tests/ScenePresenceTests.cs | 6 +++---
4 files changed, 22 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGSceneCommunicationService.cs
index 0f9c190..416826c 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 f79eb5d..0e1e2be 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 e649139..f49d072 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 f495022..f00dd66 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);
--
cgit v1.1