aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs108
1 files changed, 52 insertions, 56 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index ac21b53..864e181 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -56,7 +56,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
56 56
57 // The cache 57 // The cache
58 protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>(); 58 protected Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>();
59 private object m_AddUserLock = new object();
60 59
61 #region ISharedRegionModule 60 #region ISharedRegionModule
62 61
@@ -476,75 +475,72 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
476 475
477 UserData oldUser; 476 UserData oldUser;
478 //lock the whole block - prevent concurrent update 477 //lock the whole block - prevent concurrent update
479 lock (m_AddUserLock) 478 lock (m_UserCache)
480 { 479 m_UserCache.TryGetValue(id, out oldUser);
481 lock (m_UserCache)
482 m_UserCache.TryGetValue(id, out oldUser);
483 480
484 if (oldUser != null) 481 if (oldUser != null)
482 {
483 if (creatorData == null || creatorData == String.Empty)
485 { 484 {
486 if (creatorData == null || creatorData == String.Empty) 485 //ignore updates without creator data
487 { 486 return;
488 //ignore updates without creator data
489 return;
490 }
491
492 //try update unknown users
493 //and creator's home URL's
494 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith(oldUser.HomeURL)))
495 {
496 lock (m_UserCache)
497 m_UserCache.Remove(id);
498 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL);
499 }
500 else
501 {
502 //we have already a valid user within the cache
503 return;
504 }
505 } 487 }
506 488
507 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); 489 //try update unknown users
508 490 //and creator's home URL's
509 if (account != null) 491 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith(oldUser.HomeURL)))
510 { 492 {
511 AddUser(id, account.FirstName, account.LastName); 493 lock (m_UserCache)
494 m_UserCache.Remove(id);
495 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL);
512 } 496 }
513 else 497 else
514 { 498 {
515 UserData user = new UserData(); 499 //we have already a valid user within the cache
516 user.Id = id; 500 return;
501 }
502 }
517 503
518 if (creatorData != null && creatorData != string.Empty) 504 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
519 {
520 //creatorData = <endpoint>;<name>
521 505
522 string[] parts = creatorData.Split(';'); 506 if (account != null)
523 if (parts.Length >= 1) 507 {
508 AddUser(id, account.FirstName, account.LastName);
509 }
510 else
511 {
512 UserData user = new UserData();
513 user.Id = id;
514
515 if (creatorData != null && creatorData != string.Empty)
516 {
517 //creatorData = <endpoint>;<name>
518
519 string[] parts = creatorData.Split(';');
520 if (parts.Length >= 1)
521 {
522 user.HomeURL = parts[0];
523 try
524 { 524 {
525 user.HomeURL = parts[0]; 525 Uri uri = new Uri(parts[0]);
526 try 526 user.LastName = "@" + uri.Authority;
527 { 527 }
528 Uri uri = new Uri(parts[0]); 528 catch (UriFormatException)
529 user.LastName = "@" + uri.Authority; 529 {
530 } 530 m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]);
531 catch (UriFormatException) 531 user.LastName = "@unknown";
532 {
533 m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]);
534 user.LastName = "@unknown";
535 }
536 } 532 }
537 if (parts.Length >= 2)
538 user.FirstName = parts[1].Replace(' ', '.');
539 }
540 else
541 {
542 user.FirstName = "Unknown";
543 user.LastName = "UserUMMAU";
544 } 533 }
545 534 if (parts.Length >= 2)
546 AddUserInternal(user); 535 user.FirstName = parts[1].Replace(' ', '.');
547 } 536 }
537 else
538 {
539 user.FirstName = "Unknown";
540 user.LastName = "UserUMMAU";
541 }
542
543 AddUserInternal(user);
548 } 544 }
549 } 545 }
550 546