Kick the user from the region in the circumstance that the TP home failed - ONLY if it was triggered by an estate ban. This makes baby jesus cry, and should be fixed to search for alternative regions if the home region is unavailable.

This commit is contained in:
meta7
2010-08-30 11:41:20 -07:00
parent 8a1640f0a1
commit 4cf5ef3cd4
5 changed files with 42 additions and 18 deletions

View File

@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected virtual void OnNewClient(IClientAPI client)
{
client.OnTeleportHomeRequest += TeleportHome;
client.OnTeleportHomeRequest += TeleportHomeFired;
}
public virtual void Close()
@@ -552,7 +552,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
#region Teleport Home
public virtual void TeleportHome(UUID id, IClientAPI client)
public void TeleportHomeFired(UUID id, IClientAPI client)
{
TeleportHome(id, client);
}
public virtual bool TeleportHome(UUID id, IClientAPI client)
{
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
@@ -565,14 +570,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
// can't find the Home region: Tell viewer and abort
client.SendTeleportFailed("You don't have a home position set.");
return;
return false;
}
GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID);
if (regionInfo == null)
{
// can't find the Home region: Tell viewer and abort
client.SendTeleportFailed("Your home region could not be found.");
return;
return false;
}
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})",
regionInfo.RegionName, regionInfo.RegionID, regionInfo.RegionLocX / Constants.RegionSize, regionInfo.RegionLocY / Constants.RegionSize);
@@ -586,8 +591,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
// can't find the Home region: Tell viewer and abort
client.SendTeleportFailed("Your home region could not be found.");
return;
return false;
}
return true;
}
#endregion

View File

@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected override void OnNewClient(IClientAPI client)
{
client.OnTeleportHomeRequest += TeleportHome;
client.OnTeleportHomeRequest += TeleportHomeFired;
client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed);
}
@@ -174,7 +174,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason);
}
public override void TeleportHome(UUID id, IClientAPI client)
public void TeleportHomeFired(UUID id, IClientAPI client)
{
TeleportHome(id, client);
}
public override bool TeleportHome(UUID id, IClientAPI client)
{
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName);
@@ -184,8 +189,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
// local grid user
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local");
base.TeleportHome(id, client);
return;
return base.TeleportHome(id, client);
}
// Foreign user wants to go home
@@ -195,7 +199,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
client.SendTeleportFailed("Your information has been lost");
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information");
return;
return false;
}
IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString());
@@ -205,7 +209,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
client.SendTeleportFailed("Your home region could not be found");
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found");
return;
return false;
}
ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId);
@@ -213,7 +217,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
client.SendTeleportFailed("Internal error");
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be");
return;
return false;
}
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
@@ -223,6 +227,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName);
DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq);
return true;
}
#endregion