diff options
author | BlueWall | 2012-01-12 21:06:27 -0500 |
---|---|---|
committer | BlueWall | 2012-01-12 21:06:27 -0500 |
commit | acbff305f5a9b96dcd0b1534e165f3184a2cfe33 (patch) | |
tree | 477e5515a242880b35bf108e4b74241820eb27d3 /OpenSim/Region/CoreModules | |
parent | Move some interfaces to a more apropriate place (diff) | |
parent | Change the default osNpcCreate() to create an 'owned' npc rather than an 'uno... (diff) | |
download | opensim-SC-acbff305f5a9b96dcd0b1534e165f3184a2cfe33.zip opensim-SC-acbff305f5a9b96dcd0b1534e165f3184a2cfe33.tar.gz opensim-SC-acbff305f5a9b96dcd0b1534e165f3184a2cfe33.tar.bz2 opensim-SC-acbff305f5a9b96dcd0b1534e165f3184a2cfe33.tar.xz |
Merge branch 'master' of /home/opensim/var/repo/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 135 |
1 files changed, 54 insertions, 81 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 37292d6..80ab30c 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -413,68 +413,71 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
413 | user.Id = uuid; | 413 | user.Id = uuid; |
414 | user.FirstName = first; | 414 | user.FirstName = first; |
415 | user.LastName = last; | 415 | user.LastName = last; |
416 | // user.ProfileURL = we should initialize this to the default | ||
417 | 416 | ||
418 | AddUserInternal(user); | 417 | AddUserInternal(user); |
419 | } | 418 | } |
420 | 419 | ||
421 | public void AddUser(UUID uuid, string first, string last, string profileURL) | 420 | public void AddUser(UUID uuid, string first, string last, string homeURL) |
422 | { | 421 | { |
423 | AddUser(uuid, profileURL + ";" + first + " " + last); | 422 | AddUser(uuid, homeURL + ";" + first + " " + last); |
424 | } | 423 | } |
425 | 424 | ||
426 | public void AddUser(UUID id, string creatorData) | 425 | public void AddUser (UUID id, string creatorData) |
427 | { | 426 | { |
428 | lock (m_UserCache) | 427 | UserData oldUser; |
429 | { | 428 | //lock the whole block - prevent concurrent update |
430 | if (m_UserCache.ContainsKey(id)) | 429 | lock (m_UserCache) { |
431 | return; | 430 | m_UserCache.TryGetValue (id, out oldUser); |
432 | } | 431 | if (oldUser != null) { |
433 | 432 | if (creatorData == null || creatorData == String.Empty) { | |
434 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData); | 433 | //ignore updates without creator data |
435 | 434 | return; | |
436 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); | 435 | } |
437 | 436 | //try update unknown users | |
438 | if (account != null) | 437 | //and creator's home URL's |
439 | { | 438 | if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL))) { |
440 | AddUser(id, account.FirstName, account.LastName); | 439 | m_UserCache.Remove (id); |
441 | } | 440 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL); |
442 | else | 441 | } else { |
443 | { | 442 | //we have already a valid user within the cache |
444 | UserData user = new UserData(); | 443 | return; |
445 | user.Id = id; | ||
446 | user.Flags = -1; | ||
447 | user.Created = -1; | ||
448 | |||
449 | if (creatorData != null && creatorData != string.Empty) | ||
450 | { | ||
451 | //creatorData = <endpoint>;<name> | ||
452 | |||
453 | string[] parts = creatorData.Split(';'); | ||
454 | if (parts.Length >= 1) | ||
455 | { | ||
456 | user.HomeURL = parts[0]; | ||
457 | try | ||
458 | { | ||
459 | Uri uri = new Uri(parts[0]); | ||
460 | user.LastName = "@" + uri.Authority; | ||
461 | } | ||
462 | catch (UriFormatException) | ||
463 | { | ||
464 | m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); | ||
465 | user.LastName = "@unknown"; | ||
466 | } | ||
467 | } | 444 | } |
468 | if (parts.Length >= 2) | ||
469 | user.FirstName = parts[1].Replace(' ', '.'); | ||
470 | } | 445 | } |
471 | else | 446 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); |
472 | { | 447 | |
473 | user.FirstName = "Unknown"; | 448 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes[0].RegionInfo.ScopeID, id); |
474 | user.LastName = "User"; | 449 | |
450 | if (account != null) { | ||
451 | AddUser (id, account.FirstName, account.LastName); | ||
452 | } else { | ||
453 | UserData user = new UserData (); | ||
454 | user.Id = id; | ||
455 | user.Flags = -1; | ||
456 | user.Created = -1; | ||
457 | |||
458 | if (creatorData != null && creatorData != string.Empty) { | ||
459 | //creatorData = <endpoint>;<name> | ||
460 | |||
461 | string[] parts = creatorData.Split (';'); | ||
462 | if (parts.Length >= 1) { | ||
463 | user.HomeURL = parts[0]; | ||
464 | try { | ||
465 | Uri uri = new Uri (parts[0]); | ||
466 | user.LastName = "@" + uri.Authority; | ||
467 | } catch (UriFormatException) { | ||
468 | m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts[0]); | ||
469 | user.LastName = "@unknown"; | ||
470 | } | ||
471 | } | ||
472 | if (parts.Length >= 2) | ||
473 | user.FirstName = parts[1].Replace (' ', '.'); | ||
474 | } else { | ||
475 | user.FirstName = "Unknown"; | ||
476 | user.LastName = "User"; | ||
477 | } | ||
478 | |||
479 | AddUserInternal (user); | ||
475 | } | 480 | } |
476 | |||
477 | AddUserInternal(user); | ||
478 | } | 481 | } |
479 | } | 482 | } |
480 | 483 | ||
@@ -488,36 +491,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
488 | // user.Id, user.FirstName, user.LastName, user.HomeURL); | 491 | // user.Id, user.FirstName, user.LastName, user.HomeURL); |
489 | } | 492 | } |
490 | 493 | ||
491 | //public void AddUser(UUID uuid, string userData) | ||
492 | //{ | ||
493 | // if (m_UserCache.ContainsKey(uuid)) | ||
494 | // return; | ||
495 | |||
496 | // UserData user = new UserData(); | ||
497 | // user.Id = uuid; | ||
498 | |||
499 | // // userData = <profile url>;<name> | ||
500 | // string[] parts = userData.Split(';'); | ||
501 | // if (parts.Length >= 1) | ||
502 | // user.ProfileURL = parts[0].Trim(); | ||
503 | // if (parts.Length >= 2) | ||
504 | // { | ||
505 | // string[] name = parts[1].Trim().Split(' '); | ||
506 | // if (name.Length >= 1) | ||
507 | // user.FirstName = name[0]; | ||
508 | // if (name.Length >= 2) | ||
509 | // user.LastName = name[1]; | ||
510 | // else | ||
511 | // user.LastName = "?"; | ||
512 | // } | ||
513 | |||
514 | // lock (m_UserCache) | ||
515 | // m_UserCache.Add(uuid, user); | ||
516 | |||
517 | // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); | ||
518 | |||
519 | //} | ||
520 | |||
521 | public bool IsLocalGridUser(UUID uuid) | 494 | public bool IsLocalGridUser(UUID uuid) |
522 | { | 495 | { |
523 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid); | 496 | UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid); |