diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginService.cs | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index be90d38..f97222e 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -53,6 +53,7 @@ namespace OpenSim.Services.LLLoginService | |||
53 | private static bool Initialized = false; | 53 | private static bool Initialized = false; |
54 | 54 | ||
55 | protected IUserAccountService m_UserAccountService; | 55 | protected IUserAccountService m_UserAccountService; |
56 | protected IGridUserService m_GridUserService; | ||
56 | protected IAuthenticationService m_AuthenticationService; | 57 | protected IAuthenticationService m_AuthenticationService; |
57 | protected IInventoryService m_InventoryService; | 58 | protected IInventoryService m_InventoryService; |
58 | protected IGridService m_GridService; | 59 | protected IGridService m_GridService; |
@@ -82,6 +83,7 @@ namespace OpenSim.Services.LLLoginService | |||
82 | throw new Exception(String.Format("No section LoginService in config file")); | 83 | throw new Exception(String.Format("No section LoginService in config file")); |
83 | 84 | ||
84 | string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty); | 85 | string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty); |
86 | string gridUserService = m_LoginServerConfig.GetString("GridUserService", String.Empty); | ||
85 | string agentService = m_LoginServerConfig.GetString("UserAgentService", String.Empty); | 87 | string agentService = m_LoginServerConfig.GetString("UserAgentService", String.Empty); |
86 | string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty); | 88 | string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty); |
87 | string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty); | 89 | string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty); |
@@ -105,8 +107,10 @@ namespace OpenSim.Services.LLLoginService | |||
105 | 107 | ||
106 | Object[] args = new Object[] { config }; | 108 | Object[] args = new Object[] { config }; |
107 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | 109 | m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); |
110 | m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); | ||
108 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); | 111 | m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); |
109 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); | 112 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args); |
113 | |||
110 | if (gridService != string.Empty) | 114 | if (gridService != string.Empty) |
111 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); | 115 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); |
112 | if (presenceService != string.Empty) | 116 | if (presenceService != string.Empty) |
@@ -271,8 +275,6 @@ namespace OpenSim.Services.LLLoginService | |||
271 | // | 275 | // |
272 | // Login the presence | 276 | // Login the presence |
273 | // | 277 | // |
274 | PresenceInfo presence = null; | ||
275 | GridRegion home = null; | ||
276 | if (m_PresenceService != null) | 278 | if (m_PresenceService != null) |
277 | { | 279 | { |
278 | success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); | 280 | success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); |
@@ -281,28 +283,35 @@ namespace OpenSim.Services.LLLoginService | |||
281 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: could not login presence"); | 283 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: could not login presence"); |
282 | return LLFailedLoginResponse.GridProblem; | 284 | return LLFailedLoginResponse.GridProblem; |
283 | } | 285 | } |
284 | |||
285 | // Get the updated presence info | ||
286 | presence = m_PresenceService.GetAgent(session); | ||
287 | |||
288 | // Get the home region | ||
289 | if ((presence.HomeRegionID != UUID.Zero) && m_GridService != null) | ||
290 | { | ||
291 | home = m_GridService.GetRegionByUUID(scopeID, presence.HomeRegionID); | ||
292 | } | ||
293 | } | 286 | } |
294 | 287 | ||
295 | // | 288 | // |
289 | // Change Online status and get the home region | ||
290 | // | ||
291 | GridRegion home = null; | ||
292 | GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString()); | ||
293 | if (guinfo != null && (guinfo.HomeRegionID != UUID.Zero) && m_GridService != null) | ||
294 | { | ||
295 | home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID); | ||
296 | } | ||
297 | if (guinfo == null) | ||
298 | { | ||
299 | // something went wrong, make something up, so that we don't have to test this anywhere else | ||
300 | guinfo = new GridUserInfo(); | ||
301 | guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); | ||
302 | } | ||
303 | |||
304 | // | ||
296 | // Find the destination region/grid | 305 | // Find the destination region/grid |
297 | // | 306 | // |
298 | string where = string.Empty; | 307 | string where = string.Empty; |
299 | Vector3 position = Vector3.Zero; | 308 | Vector3 position = Vector3.Zero; |
300 | Vector3 lookAt = Vector3.Zero; | 309 | Vector3 lookAt = Vector3.Zero; |
301 | GridRegion gatekeeper = null; | 310 | GridRegion gatekeeper = null; |
302 | GridRegion destination = FindDestination(account, scopeID, presence, session, startLocation, out gatekeeper, out where, out position, out lookAt); | 311 | GridRegion destination = FindDestination(account, scopeID, guinfo, session, startLocation, home, out gatekeeper, out where, out position, out lookAt); |
303 | if (destination == null) | 312 | if (destination == null) |
304 | { | 313 | { |
305 | m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt); | 314 | m_PresenceService.LogoutAgent(session); |
306 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: destination not found"); | 315 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: destination not found"); |
307 | return LLFailedLoginResponse.GridProblem; | 316 | return LLFailedLoginResponse.GridProblem; |
308 | } | 317 | } |
@@ -324,7 +333,7 @@ namespace OpenSim.Services.LLLoginService | |||
324 | 333 | ||
325 | if (aCircuit == null) | 334 | if (aCircuit == null) |
326 | { | 335 | { |
327 | m_PresenceService.LogoutAgent(session, presence.Position, presence.LookAt); | 336 | m_PresenceService.LogoutAgent(session); |
328 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: {0}", reason); | 337 | m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: {0}", reason); |
329 | return LLFailedLoginResponse.AuthorizationProblem; | 338 | return LLFailedLoginResponse.AuthorizationProblem; |
330 | 339 | ||
@@ -340,7 +349,7 @@ namespace OpenSim.Services.LLLoginService | |||
340 | // | 349 | // |
341 | // Finally, fill out the response and return it | 350 | // Finally, fill out the response and return it |
342 | // | 351 | // |
343 | LLLoginResponse response = new LLLoginResponse(account, aCircuit, presence, destination, inventorySkel, friendsList, m_LibraryService, | 352 | LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, |
344 | where, startLocation, position, lookAt, m_WelcomeMessage, home, clientIP); | 353 | where, startLocation, position, lookAt, m_WelcomeMessage, home, clientIP); |
345 | 354 | ||
346 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); | 355 | m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); |
@@ -350,12 +359,12 @@ namespace OpenSim.Services.LLLoginService | |||
350 | { | 359 | { |
351 | m_log.WarnFormat("[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2} {3}", firstName, lastName, e.ToString(), e.StackTrace); | 360 | m_log.WarnFormat("[LLOGIN SERVICE]: Exception processing login for {0} {1}: {2} {3}", firstName, lastName, e.ToString(), e.StackTrace); |
352 | if (m_PresenceService != null) | 361 | if (m_PresenceService != null) |
353 | m_PresenceService.LogoutAgent(session, new Vector3(128, 128, 0), new Vector3(0, 1, 0)); | 362 | m_PresenceService.LogoutAgent(session); |
354 | return LLFailedLoginResponse.InternalError; | 363 | return LLFailedLoginResponse.InternalError; |
355 | } | 364 | } |
356 | } | 365 | } |
357 | 366 | ||
358 | protected GridRegion FindDestination(UserAccount account, UUID scopeID, PresenceInfo pinfo, UUID sessionID, string startLocation, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt) | 367 | protected GridRegion FindDestination(UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, GridRegion home, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt) |
359 | { | 368 | { |
360 | m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation); | 369 | m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation); |
361 | 370 | ||
@@ -377,7 +386,7 @@ namespace OpenSim.Services.LLLoginService | |||
377 | 386 | ||
378 | bool tryDefaults = false; | 387 | bool tryDefaults = false; |
379 | 388 | ||
380 | if (pinfo.HomeRegionID.Equals(UUID.Zero)) | 389 | if (home == null) |
381 | { | 390 | { |
382 | m_log.WarnFormat( | 391 | m_log.WarnFormat( |
383 | "[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set", | 392 | "[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set", |
@@ -387,16 +396,10 @@ namespace OpenSim.Services.LLLoginService | |||
387 | } | 396 | } |
388 | else | 397 | else |
389 | { | 398 | { |
390 | region = m_GridService.GetRegionByUUID(scopeID, pinfo.HomeRegionID); | 399 | region = home; |
391 | 400 | ||
392 | if (null == region) | 401 | position = pinfo.HomePosition; |
393 | { | 402 | lookAt = pinfo.HomeLookAt; |
394 | m_log.WarnFormat( | ||
395 | "[LLOGIN SERVICE]: User {0} {1} has a recorded home region of {2} but this cannot be found by the grid service", | ||
396 | account.FirstName, account.LastName, pinfo.HomeRegionID); | ||
397 | |||
398 | tryDefaults = true; | ||
399 | } | ||
400 | } | 403 | } |
401 | 404 | ||
402 | if (tryDefaults) | 405 | if (tryDefaults) |
@@ -432,7 +435,7 @@ namespace OpenSim.Services.LLLoginService | |||
432 | 435 | ||
433 | GridRegion region = null; | 436 | GridRegion region = null; |
434 | 437 | ||
435 | if (pinfo.RegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(scopeID, pinfo.RegionID)) == null) | 438 | if (pinfo.LastRegionID.Equals(UUID.Zero) || (region = m_GridService.GetRegionByUUID(scopeID, pinfo.LastRegionID)) == null) |
436 | { | 439 | { |
437 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); | 440 | List<GridRegion> defaults = m_GridService.GetDefaultRegions(scopeID); |
438 | if (defaults != null && defaults.Count > 0) | 441 | if (defaults != null && defaults.Count > 0) |
@@ -454,8 +457,8 @@ namespace OpenSim.Services.LLLoginService | |||
454 | } | 457 | } |
455 | else | 458 | else |
456 | { | 459 | { |
457 | position = pinfo.Position; | 460 | position = pinfo.LastPosition; |
458 | lookAt = pinfo.LookAt; | 461 | lookAt = pinfo.LastLookAt; |
459 | } | 462 | } |
460 | 463 | ||
461 | return region; | 464 | return region; |