aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2012-04-24 22:17:10 -0700
committerDiva Canto2012-04-24 22:17:10 -0700
commitcf1c34605bf58ee783c2a7d0c63f51ecf6d3288a (patch)
treeb04510fc672510514fd15808dc456b467bc64092
parentrefactor: Combine ScenePresence.Teleport() and TeleportWithMomentum() (diff)
downloadopensim-SC_OLD-cf1c34605bf58ee783c2a7d0c63f51ecf6d3288a.zip
opensim-SC_OLD-cf1c34605bf58ee783c2a7d0c63f51ecf6d3288a.tar.gz
opensim-SC_OLD-cf1c34605bf58ee783c2a7d0c63f51ecf6d3288a.tar.bz2
opensim-SC_OLD-cf1c34605bf58ee783c2a7d0c63f51ecf6d3288a.tar.xz
HG: Moved User-level code down to the HGEntityTransferModule where it belongs.
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs13
2 files changed, 14 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 221e0bd..8d810fc 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -61,8 +61,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
61 set { m_MaxTransferDistance = value; } 61 set { m_MaxTransferDistance = value; }
62 } 62 }
63 63
64 private int m_levelHGTeleport = 0;
65
66 protected bool m_Enabled = false; 64 protected bool m_Enabled = false;
67 protected Scene m_aScene; 65 protected Scene m_aScene;
68 protected List<Scene> m_Scenes = new List<Scene>(); 66 protected List<Scene> m_Scenes = new List<Scene>();
@@ -106,7 +104,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
106 if (transferConfig != null) 104 if (transferConfig != null)
107 { 105 {
108 MaxTransferDistance = transferConfig.GetInt("max_distance", 4095); 106 MaxTransferDistance = transferConfig.GetInt("max_distance", 4095);
109 m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
110 } 107 }
111 108
112 m_agentsInTransit = new List<UUID>(); 109 m_agentsInTransit = new List<UUID>();
@@ -240,16 +237,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
240 237
241 destinationRegionName = finalDestination.RegionName; 238 destinationRegionName = finalDestination.RegionName;
242 239
243 // check if HyperGrid teleport is allowed, based on user level
244 int flags = m_aScene.GridService.GetRegionFlags(sp.Scene.RegionInfo.ScopeID, reg.RegionID);
245
246 if (((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) && (sp.UserLevel < m_levelHGTeleport))
247 {
248 m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent.");
249 sp.ControllingClient.SendTeleportFailed("HyperGrid teleport not permitted");
250 return;
251 }
252
253 uint curX = 0, curY = 0; 240 uint curX = 0, curY = 0;
254 Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY); 241 Utils.LongToUInts(sp.Scene.RegionInfo.RegionHandle, out curX, out curY);
255 int curCellX = (int)(curX / Constants.RegionSize); 242 int curCellX = (int)(curX / Constants.RegionSize);
@@ -413,7 +400,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
413 bool logout = false; 400 bool logout = false;
414 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) 401 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
415 { 402 {
416 sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", 403 sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}",
417 reason)); 404 reason));
418 return; 405 return;
419 } 406 }
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 7f9175d..6a92e61 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 51
52 private bool m_Initialized = false; 52 private bool m_Initialized = false;
53 private int m_levelHGTeleport = 0;
53 54
54 private GatekeeperServiceConnector m_GatekeeperConnector; 55 private GatekeeperServiceConnector m_GatekeeperConnector;
55 56
@@ -68,6 +69,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
68 string name = moduleConfig.GetString("EntityTransferModule", ""); 69 string name = moduleConfig.GetString("EntityTransferModule", "");
69 if (name == Name) 70 if (name == Name)
70 { 71 {
72 IConfig transferConfig = source.Configs["EntityTransfer"];
73 if (transferConfig != null)
74 m_levelHGTeleport = transferConfig.GetInt("LevelHGTeleport", 0);
75
71 InitialiseCommon(source); 76 InitialiseCommon(source);
72 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); 77 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
73 } 78 }
@@ -164,6 +169,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
164 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) 169 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
165 { 170 {
166 // this user is going to another grid 171 // this user is going to another grid
172 // check if HyperGrid teleport is allowed, based on user level
173 if (sp.UserLevel < m_levelHGTeleport)
174 {
175 m_log.WarnFormat("[ENTITY TRANSFER MODULE]: Final destination link is non permitted hypergrid region. Unable to teleport agent.");
176 reason = "HyperGrid teleport not permitted";
177 return false;
178 }
179
167 if (agentCircuit.ServiceURLs.ContainsKey("HomeURI")) 180 if (agentCircuit.ServiceURLs.ContainsKey("HomeURI"))
168 { 181 {
169 string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); 182 string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();