Merge branch 'master' into careminster

avinationmerge
Melanie 2009-12-29 18:41:45 +00:00
commit 67cfac0cf1
13 changed files with 44 additions and 26 deletions

View File

@ -268,7 +268,7 @@ namespace OpenSim.Client.Linden
else else
{ {
string reason; string reason;
if (scene.NewUserConnection(agentData, out reason)) if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
{ {
success = true; success = true;
} }

View File

@ -199,7 +199,7 @@ namespace OpenSim.Client.Linden
Scene scene; Scene scene;
if (TryGetRegion(regionHandle, out 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."; reason = "Region not found.";
return false; return false;

View File

@ -609,7 +609,7 @@ namespace OpenSim.Client.MXP.PacketHandler
agent.Appearance = new AvatarAppearance(); agent.Appearance = new AvatarAppearance();
} }
return scene.NewUserConnection(agent, out reason); return scene.NewUserConnection(agent, 0, out reason);
} }
public void PrintDebugInformation() public void PrintDebugInformation()

View File

@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Clients
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 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; reason = String.Empty;
@ -84,6 +84,7 @@ namespace OpenSim.Framework.Communications.Clients
// Add the regionhandle of the destination region // Add the regionhandle of the destination region
ulong regionHandle = GetRegionHandle(region.RegionHandle); 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 = ""; string strBuffer = "";
byte[] buffer = new byte[1]; byte[] buffer = new byte[1];

View File

@ -557,7 +557,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
// Call 'new user' event handler // Call 'new user' event handler
string reason; string reason;
if (!homeScene.NewUserConnection(agentData, out reason)) if (!homeScene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
{ {
responseMap["connect"] = OSD.FromBoolean(false); responseMap["connect"] = OSD.FromBoolean(false);
responseMap["message"] = OSD.FromString(String.Format("Connection refused: {0}", reason)); responseMap["message"] = OSD.FromString(String.Format("Connection refused: {0}", reason));

View File

@ -144,7 +144,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
* Agent-related communications * 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) foreach (Scene s in m_sceneList)
@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
if (s.RegionInfo.RegionHandle == regionHandle) if (s.RegionInfo.RegionHandle == regionHandle)
{ {
// m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", 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);
} }
} }

View File

@ -157,10 +157,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
* Agent-related communications * 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 // Try local first
if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, out reason)) if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, teleportFlags, out reason))
return true; return true;
// else do the remote thing // else do the remote thing
@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{ {
m_regionClient.SendUserInformation(regInfo, aCircuit); 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 //else
// m_log.Warn("[REST COMMS]: Region not found " + regionHandle); // m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
@ -436,10 +436,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
OSDMap resp = new OSDMap(2); 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 // This is the meaning of POST agent
m_regionClient.AdjustUserInformation(aCircuit); 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["reason"] = OSD.FromString(reason);
resp["success"] = OSD.FromBoolean(result); resp["success"] = OSD.FromBoolean(result);

View File

@ -37,7 +37,7 @@ namespace OpenSim.Region.Framework.Interfaces
{ {
#region Agents #region Agents
bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason); bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason);
/// <summary> /// <summary>
/// Full child agent update. /// Full child agent update.

View File

@ -203,7 +203,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
string reason = String.Empty; string reason = String.Empty;
//if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) //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}", avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
reason)); reason));

View File

@ -3343,12 +3343,16 @@ namespace OpenSim.Region.Framework.Scenes
/// Use NewUserConnection() directly if possible so the return type can refuse connections. /// Use NewUserConnection() directly if possible so the return type can refuse connections.
/// At the moment nothing actually seems to use this event, /// At the moment nothing actually seems to use this event,
/// as everything is switching to calling the NewUserConnection method directly. /// as everything is switching to calling the NewUserConnection method directly.
///
/// Now obsoleting this because it doesn't handle teleportFlags propertly
///
/// </summary> /// </summary>
/// <param name="agent"></param> /// <param name="agent"></param>
[Obsolete("Please call NewUserConnection directly.")]
public void HandleNewUserConnection(AgentCircuitData agent) public void HandleNewUserConnection(AgentCircuitData agent)
{ {
string reason; string reason;
NewUserConnection(agent, out reason); NewUserConnection(agent, 0, out reason);
} }
/// <summary> /// <summary>
@ -3361,8 +3365,16 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="reason">Outputs the reason for the false response on this string</param> /// <param name="reason">Outputs the reason for the false response on this string</param>
/// <returns>True if the region accepts this agent. False if it does not. False will /// <returns>True if the region accepts this agent. False if it does not. False will
/// also return a reason.</returns> /// also return a reason.</returns>
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) if (loginsdisabled)
{ {
reason = "Logins Disabled"; reason = "Logins Disabled";
@ -3370,9 +3382,9 @@ namespace OpenSim.Region.Framework.Scenes
} }
// Don't disable this log message - it's too helpful // Don't disable this log message - it's too helpful
m_log.InfoFormat( 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, RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
agent.AgentID, agent.circuitcode); agent.AgentID, agent.circuitcode, teleportFlags);
reason = String.Empty; reason = String.Empty;
if (!AuthenticateUser(agent, out reason)) if (!AuthenticateUser(agent, out reason))

View File

@ -286,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes
string reason = String.Empty; 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) if (regionAccepted && newAgent)
{ {
@ -835,7 +835,7 @@ namespace OpenSim.Region.Framework.Scenes
// Let's create an agent there if one doesn't exist yet. // Let's create an agent there if one doesn't exist yet.
//if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit)) //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}", avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
reason)); reason));

View File

@ -117,7 +117,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
agent.child = true; agent.child = true;
string reason; string reason;
scene.NewUserConnection(agent, out reason); scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
testclient = new TestClient(agent, scene); testclient = new TestClient(agent, scene);
scene.AddNewClient(testclient); scene.AddNewClient(testclient);
@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
if (acd1 == null) if (acd1 == null)
fixNullPresence(); fixNullPresence();
scene.NewUserConnection(acd1, out reason); scene.NewUserConnection(acd1, 0, out reason);
if (testclient == null) if (testclient == null)
testclient = new TestClient(acd1, scene); testclient = new TestClient(acd1, scene);
scene.AddNewClient(testclient); scene.AddNewClient(testclient);
@ -242,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Adding child agent to region 1001 // Adding child agent to region 1001
string reason; string reason;
scene2.NewUserConnection(acd1, out reason); scene2.NewUserConnection(acd1,0, out reason);
scene2.AddNewClient(testclient); scene2.AddNewClient(testclient);
ScenePresence presence = scene.GetScenePresence(agent1); ScenePresence presence = scene.GetScenePresence(agent1);

View File

@ -382,7 +382,7 @@ namespace OpenSim.Tests.Common.Setup
// We emulate the proper login sequence here by doing things in three stages // 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 // 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 // Stage 2: add the new client as a child agent to the scene
TestClient client = new TestClient(agentData, scene); TestClient client = new TestClient(agentData, scene);