aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs64
1 files changed, 40 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index bbdf92a..b4f6b5a 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -335,54 +335,70 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
335 { 335 {
336 UserData oldUser; 336 UserData oldUser;
337 //lock the whole block - prevent concurrent update 337 //lock the whole block - prevent concurrent update
338 lock (m_UserCache) { 338 lock (m_UserCache)
339 {
339 m_UserCache.TryGetValue (id, out oldUser); 340 m_UserCache.TryGetValue (id, out oldUser);
340 if (oldUser != null) { 341 if (oldUser != null)
341 if (creatorData == null || creatorData == String.Empty) { 342 {
343 if (creatorData == null || creatorData == String.Empty)
344 {
342 //ignore updates without creator data 345 //ignore updates without creator data
343 return; 346 return;
344 } 347 }
345 //try update unknown users 348 //try update unknown users
346 //and creator's home URL's 349 //and creator's home URL's
347 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL))) { 350 if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL)))
351 {
348 m_UserCache.Remove (id); 352 m_UserCache.Remove (id);
349// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL); 353// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL);
350 } else { 354 }
355 else
356 {
351 //we have already a valid user within the cache 357 //we have already a valid user within the cache
352 return; 358 return;
353 } 359 }
354 } 360 }
355// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); 361// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
356 362
357 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes[0].RegionInfo.ScopeID, id); 363 UserAccount account = m_Scenes [0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id);
358 364
359 if (account != null) { 365 if (account != null)
366 {
360 AddUser (id, account.FirstName, account.LastName); 367 AddUser (id, account.FirstName, account.LastName);
361 } else { 368 }
369 else
370 {
362 UserData user = new UserData (); 371 UserData user = new UserData ();
363 user.Id = id; 372 user.Id = id;
364 373
365 if (creatorData != null && creatorData != string.Empty) { 374 if (creatorData != null && creatorData != string.Empty)
375 {
366 //creatorData = <endpoint>;<name> 376 //creatorData = <endpoint>;<name>
367 377
368 string[] parts = creatorData.Split (';'); 378 string[] parts = creatorData.Split (';');
369 if (parts.Length >= 1) { 379 if (parts.Length >= 1)
370 user.HomeURL = parts[0]; 380 {
371 try { 381 user.HomeURL = parts [0];
372 Uri uri = new Uri (parts[0]); 382 try
383 {
384 Uri uri = new Uri (parts [0]);
373 user.LastName = "@" + uri.Authority; 385 user.LastName = "@" + uri.Authority;
374 } catch (UriFormatException) { 386 }
375 m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts[0]); 387 catch (UriFormatException)
388 {
389 m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts [0]);
376 user.LastName = "@unknown"; 390 user.LastName = "@unknown";
377 } 391 }
378 } 392 }
379 if (parts.Length >= 2) 393 if (parts.Length >= 2)
380 user.FirstName = parts[1].Replace (' ', '.'); 394 user.FirstName = parts [1].Replace (' ', '.');
381 } else { 395 }
396 else
397 {
382 user.FirstName = "Unknown"; 398 user.FirstName = "Unknown";
383 user.LastName = "User"; 399 user.LastName = "User";
384 } 400 }
385 401
386 AddUserInternal (user); 402 AddUserInternal (user);
387 } 403 }
388 } 404 }