diff options
author | Diva Canto | 2010-01-18 10:37:11 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-18 10:37:11 -0800 |
commit | fd64823466ee667d0d827f95d3001ec8675512b2 (patch) | |
tree | 8b5b695da9283a693c29d9d1614e12cfeeaa8d5a /OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |
parent | * Fixed misspelling of field in GridService (diff) | |
download | opensim-SC_OLD-fd64823466ee667d0d827f95d3001ec8675512b2.zip opensim-SC_OLD-fd64823466ee667d0d827f95d3001ec8675512b2.tar.gz opensim-SC_OLD-fd64823466ee667d0d827f95d3001ec8675512b2.tar.bz2 opensim-SC_OLD-fd64823466ee667d0d827f95d3001ec8675512b2.tar.xz |
* Added missing GatekeeperServiceConnector
* Added basic machinery for teleporting users home. Untested.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 101aea0..0e6323b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -111,6 +111,55 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
111 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 111 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
112 | } | 112 | } |
113 | 113 | ||
114 | public override void TeleportHome(UUID id, IClientAPI client) | ||
115 | { | ||
116 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | ||
117 | |||
118 | // Let's find out if this is a foreign user or a local user | ||
119 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, id); | ||
120 | if (account != null) | ||
121 | { | ||
122 | // local grid user | ||
123 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | ||
124 | base.TeleportHome(id, client); | ||
125 | return; | ||
126 | } | ||
127 | |||
128 | // Foreign user wants to go home | ||
129 | // | ||
130 | AgentCircuitData aCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); | ||
131 | if (aCircuit == null || (aCircuit != null && !aCircuit.ServiceURLs.ContainsKey("GatewayURI"))) | ||
132 | { | ||
133 | client.SendTeleportFailed("Your information has been lost"); | ||
134 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | ||
135 | return; | ||
136 | } | ||
137 | |||
138 | GridRegion homeGatekeeper = MakeRegion(aCircuit); | ||
139 | if (homeGatekeeper == null) | ||
140 | { | ||
141 | client.SendTeleportFailed("Your information has been lost"); | ||
142 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's gateway information is malformed"); | ||
143 | return; | ||
144 | } | ||
145 | |||
146 | Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; | ||
147 | GridRegion finalDestination = m_GatekeeperConnector.GetHomeRegion(homeGatekeeper, aCircuit.AgentID, out position, out lookAt); | ||
148 | } | ||
114 | #endregion | 149 | #endregion |
150 | |||
151 | private GridRegion MakeRegion(AgentCircuitData aCircuit) | ||
152 | { | ||
153 | GridRegion region = new GridRegion(); | ||
154 | |||
155 | Uri uri = null; | ||
156 | if (!Uri.TryCreate(aCircuit.ServiceURLs["GatewayURI"].ToString(), UriKind.Absolute, out uri)) | ||
157 | return null; | ||
158 | |||
159 | region.ExternalHostName = uri.Host; | ||
160 | region.HttpPort = (uint)uri.Port; | ||
161 | region.RegionName = string.Empty; | ||
162 | return region; | ||
163 | } | ||
115 | } | 164 | } |
116 | } | 165 | } |