diff options
Diffstat (limited to 'OpenSim/Grid/UserServer/UserLoginService.cs')
-rw-r--r-- | OpenSim/Grid/UserServer/UserLoginService.cs | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index dfc44ef..0caefb1 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -183,12 +183,17 @@ namespace OpenSim.Grid.UserServer | |||
183 | // HomeLocation | 183 | // HomeLocation |
184 | RegionProfileData homeInfo = null; | 184 | RegionProfileData homeInfo = null; |
185 | // use the homeRegionID if it is stored already. If not, use the regionHandle as before | 185 | // use the homeRegionID if it is stored already. If not, use the regionHandle as before |
186 | if (theUser.HomeRegionID != UUID.Zero) | 186 | UUID homeRegionId = theUser.HomeRegionID; |
187 | homeInfo = RegionProfileData.RequestSimProfileData(theUser.HomeRegionID, | 187 | ulong homeRegionHandle = theUser.HomeRegion; |
188 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 188 | if (homeRegionId != UUID.Zero) |
189 | { | ||
190 | homeInfo = GetRegionInfo(homeRegionId); | ||
191 | } | ||
189 | else | 192 | else |
190 | homeInfo = RegionProfileData.RequestSimProfileData(theUser.HomeRegion, | 193 | { |
191 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 194 | homeInfo = GetRegionInfo(homeRegionHandle); |
195 | } | ||
196 | |||
192 | if (homeInfo != null) | 197 | if (homeInfo != null) |
193 | { | 198 | { |
194 | response.Home = | 199 | response.Home = |
@@ -204,8 +209,8 @@ namespace OpenSim.Grid.UserServer | |||
204 | // Emergency mode: Home-region isn't available, so we can't request the region info. | 209 | // Emergency mode: Home-region isn't available, so we can't request the region info. |
205 | // Use the stored home regionHandle instead. | 210 | // Use the stored home regionHandle instead. |
206 | // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again | 211 | // NOTE: If the home-region moves, this will be wrong until the users update their user-profile again |
207 | ulong regionX = theUser.HomeRegion >> 32; | 212 | ulong regionX = homeRegionHandle >> 32; |
208 | ulong regionY = theUser.HomeRegion & 0xffffffff; | 213 | ulong regionY = homeRegionHandle & 0xffffffff; |
209 | response.Home = | 214 | response.Home = |
210 | string.Format( | 215 | string.Format( |
211 | "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", | 216 | "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", |
@@ -227,8 +232,8 @@ namespace OpenSim.Grid.UserServer | |||
227 | } | 232 | } |
228 | else if (startLocationRequest == "last") | 233 | else if (startLocationRequest == "last") |
229 | { | 234 | { |
230 | regionInfo = RegionProfileData.RequestSimProfileData(theUser.CurrentAgent.Region, | 235 | UUID lastRegion = theUser.CurrentAgent.Region; |
231 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 236 | regionInfo = GetRegionInfo(lastRegion); |
232 | response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; | 237 | response.LookAt = "[r" + theUser.CurrentAgent.LookAt.X.ToString() + ",r" + theUser.CurrentAgent.LookAt.Y.ToString() + ",r" + theUser.CurrentAgent.LookAt.Z.ToString() + "]"; |
233 | } | 238 | } |
234 | else | 239 | else |
@@ -242,8 +247,7 @@ namespace OpenSim.Grid.UserServer | |||
242 | else | 247 | else |
243 | { | 248 | { |
244 | string region = uriMatch.Groups["region"].ToString(); | 249 | string region = uriMatch.Groups["region"].ToString(); |
245 | regionInfo = RegionProfileData.RequestSimProfileData(region, | 250 | regionInfo = RequestClosestRegion(region); |
246 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | ||
247 | if (regionInfo == null) | 251 | if (regionInfo == null) |
248 | { | 252 | { |
249 | m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region); | 253 | m_log.InfoFormat("[LOGIN]: Got Custom Login URL {0}, can't locate region {1}", startLocationRequest, region); |
@@ -280,7 +284,7 @@ namespace OpenSim.Grid.UserServer | |||
280 | } | 284 | } |
281 | 285 | ||
282 | m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); | 286 | m_log.Error("[LOGIN]: Sending user to default region " + defaultHandle + " instead"); |
283 | regionInfo = RegionProfileData.RequestSimProfileData(defaultHandle, m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | 287 | regionInfo = GetRegionInfo(defaultHandle); |
284 | 288 | ||
285 | // Customise the response | 289 | // Customise the response |
286 | //response.Home = | 290 | //response.Home = |
@@ -296,6 +300,26 @@ namespace OpenSim.Grid.UserServer | |||
296 | return PrepareLoginToRegion(regionInfo, theUser, response); | 300 | return PrepareLoginToRegion(regionInfo, theUser, response); |
297 | } | 301 | } |
298 | 302 | ||
303 | protected RegionProfileData RequestClosestRegion(string region) | ||
304 | { | ||
305 | return RegionProfileData.RequestSimProfileData(region, | ||
306 | m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey); | ||
307 | } | ||
308 | |||
309 | protected RegionProfileData GetRegionInfo(ulong homeRegionHandle) | ||
310 | { | ||
311 | return RegionProfileData.RequestSimProfileData(homeRegionHandle, | ||
312 | m_config.GridServerURL, m_config.GridSendKey, | ||
313 | m_config.GridRecvKey); | ||
314 | } | ||
315 | |||
316 | protected RegionProfileData GetRegionInfo(UUID homeRegionId) | ||
317 | { | ||
318 | return RegionProfileData.RequestSimProfileData(homeRegionId, | ||
319 | m_config.GridServerURL, m_config.GridSendKey, | ||
320 | m_config.GridRecvKey); | ||
321 | } | ||
322 | |||
299 | /// <summary> | 323 | /// <summary> |
300 | /// Add active gestures of the user to the login response. | 324 | /// Add active gestures of the user to the login response. |
301 | /// </summary> | 325 | /// </summary> |