Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie Thielker 2010-08-31 22:26:17 +02:00
commit aca10cb027
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()
@ -563,7 +563,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);
@ -576,14 +581,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);
@ -597,8 +602,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

View File

@ -345,7 +345,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
if (!s.IsChildAgent)
{
m_scene.TeleportClientHome(user, s.ControllingClient);
if (!m_scene.TeleportClientHome(user, s.ControllingClient))
{
s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out.");
s.ControllingClient.Close();
}
}
}
@ -479,7 +483,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
ScenePresence s = m_scene.GetScenePresence(prey);
if (s != null)
{
m_scene.TeleportClientHome(prey, s.ControllingClient);
if (!m_scene.TeleportClientHome(prey, s.ControllingClient))
{
s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out.");
s.ControllingClient.Close();
}
}
}
}
@ -498,7 +506,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
// Also make sure they are actually in the region
if (p != null && !p.IsChildAgent)
{
m_scene.TeleportClientHome(p.UUID, p.ControllingClient);
if (!m_scene.TeleportClientHome(p.UUID, p.ControllingClient))
{
p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out.");
p.ControllingClient.Close();
}
}
}
});

View File

@ -40,7 +40,7 @@ namespace OpenSim.Region.Framework.Interfaces
void Teleport(ScenePresence agent, ulong regionHandle, Vector3 position,
Vector3 lookAt, uint teleportFlags);
void TeleportHome(UUID id, IClientAPI client);
bool TeleportHome(UUID id, IClientAPI client);
void Cross(ScenePresence agent, bool isFlying);

View File

@ -3009,15 +3009,16 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
/// <param name="agentId">The avatar's Unique ID</param>
/// <param name="client">The IClientAPI for the client</param>
public virtual void TeleportClientHome(UUID agentId, IClientAPI client)
public virtual bool TeleportClientHome(UUID agentId, IClientAPI client)
{
if (m_teleportModule != null)
m_teleportModule.TeleportHome(agentId, client);
return m_teleportModule.TeleportHome(agentId, client);
else
{
m_log.DebugFormat("[SCENE]: Unable to teleport user home: no AgentTransferModule is active");
client.SendTeleportFailed("Unable to perform teleports on this simulator.");
}
return false;
}
/// <summary>