HG: Moved User-level code down to the HGEntityTransferModule where it belongs.
parent
683cfc6f82
commit
cf1c34605b
|
@ -61,8 +61,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
set { m_MaxTransferDistance = value; }
|
set { m_MaxTransferDistance = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private int m_levelHGTeleport = 0;
|
|
||||||
|
|
||||||
protected bool m_Enabled = false;
|
protected bool m_Enabled = false;
|
||||||
protected Scene m_aScene;
|
protected Scene m_aScene;
|
||||||
protected List<Scene> m_Scenes = new List<Scene>();
|
protected List<Scene> m_Scenes = new List<Scene>();
|
||||||
|
@ -106,7 +104,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (transferConfig != null)
|
if (transferConfig != null)
|
||||||
{
|
{
|
||||||
MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
|
MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
|
||||||
m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_agentsInTransit = new List<UUID>();
|
m_agentsInTransit = new List<UUID>();
|
||||||
|
@ -240,16 +237,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
destinationRegionName = finalDestination.RegionName;
|
destinationRegionName = finalDestination.RegionName;
|
||||||
|
|
||||||
// check if HyperGrid teleport is allowed, based on user level
|
|
||||||
int flags = m_aScene.GridService.GetRegionFlags(sp.Scene.RegionInfo.ScopeID, reg.RegionID);
|
|
||||||
|
|
||||||
if (((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) && (sp.UserLevel < m_levelHGTeleport))
|
|
||||||
{
|
|
||||||
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent.");
|
|
||||||
sp.ControllingClient.SendTeleportFailed("HyperGrid teleport not permitted");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint curX = 0, curY = 0;
|
uint curX = 0, curY = 0;
|
||||||
Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
|
Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
|
||||||
int curCellX = (int)(curX / Constants.RegionSize);
|
int curCellX = (int)(curX / Constants.RegionSize);
|
||||||
|
@ -413,7 +400,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
bool logout = false;
|
bool logout = false;
|
||||||
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
|
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
|
||||||
{
|
{
|
||||||
sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
|
sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}",
|
||||||
reason));
|
reason));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private bool m_Initialized = false;
|
private bool m_Initialized = false;
|
||||||
|
private int m_levelHGTeleport = 0;
|
||||||
|
|
||||||
private GatekeeperServiceConnector m_GatekeeperConnector;
|
private GatekeeperServiceConnector m_GatekeeperConnector;
|
||||||
|
|
||||||
|
@ -68,6 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
string name = moduleConfig.GetString("EntityTransferModule", "");
|
string name = moduleConfig.GetString("EntityTransferModule", "");
|
||||||
if (name == Name)
|
if (name == Name)
|
||||||
{
|
{
|
||||||
|
IConfig transferConfig = source.Configs["EntityTransfer"];
|
||||||
|
if (transferConfig != null)
|
||||||
|
m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
|
||||||
|
|
||||||
InitialiseCommon(source);
|
InitialiseCommon(source);
|
||||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
|
||||||
}
|
}
|
||||||
|
@ -164,6 +169,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
|
||||||
{
|
{
|
||||||
// this user is going to another grid
|
// this user is going to another grid
|
||||||
|
// check if HyperGrid teleport is allowed, based on user level
|
||||||
|
if (sp.UserLevel < m_levelHGTeleport)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent.");
|
||||||
|
reason = "HyperGrid teleport not permitted";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (agentCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
if (agentCircuit.ServiceURLs.ContainsKey("HomeURI"))
|
||||||
{
|
{
|
||||||
string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
|
string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
|
||||||
|
|
Loading…
Reference in New Issue