Merge branch 'master' of /home/opensim/src/opensim

iar_mods
BlueWall 2012-01-13 17:16:20 -05:00
commit cde80125ad
1 changed files with 40 additions and 24 deletions

View File

@ -335,54 +335,70 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
{ {
UserData oldUser; UserData oldUser;
//lock the whole block - prevent concurrent update //lock the whole block - prevent concurrent update
lock (m_UserCache) { lock (m_UserCache)
{
m_UserCache.TryGetValue (id, out oldUser); m_UserCache.TryGetValue (id, out oldUser);
if (oldUser != null) { if (oldUser != null)
if (creatorData == null || creatorData == String.Empty) { {
if (creatorData == null || creatorData == String.Empty)
{
//ignore updates without creator data //ignore updates without creator data
return; return;
} }
//try update unknown users //try update unknown users
//and creator's home URL's //and creator's home URL's
if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL))) { if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL)))
{
m_UserCache.Remove (id); m_UserCache.Remove (id);
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL); // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData,oldUser.HomeURL);
} else { }
else
{
//we have already a valid user within the cache //we have already a valid user within the cache
return; return;
} }
} }
// m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData);
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes[0].RegionInfo.ScopeID, id); UserAccount account = m_Scenes [0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id);
if (account != null) { if (account != null)
{
AddUser (id, account.FirstName, account.LastName); AddUser (id, account.FirstName, account.LastName);
} else { }
else
{
UserData user = new UserData (); UserData user = new UserData ();
user.Id = id; user.Id = id;
if (creatorData != null && creatorData != string.Empty) { if (creatorData != null && creatorData != string.Empty)
{
//creatorData = <endpoint>;<name> //creatorData = <endpoint>;<name>
string[] parts = creatorData.Split (';'); string[] parts = creatorData.Split (';');
if (parts.Length >= 1) { if (parts.Length >= 1)
user.HomeURL = parts[0]; {
try { user.HomeURL = parts [0];
Uri uri = new Uri (parts[0]); try
{
Uri uri = new Uri (parts [0]);
user.LastName = "@" + uri.Authority; user.LastName = "@" + uri.Authority;
} catch (UriFormatException) { }
m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts[0]); catch (UriFormatException)
{
m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts [0]);
user.LastName = "@unknown"; user.LastName = "@unknown";
} }
} }
if (parts.Length >= 2) if (parts.Length >= 2)
user.FirstName = parts[1].Replace (' ', '.'); user.FirstName = parts [1].Replace (' ', '.');
} else { }
else
{
user.FirstName = "Unknown"; user.FirstName = "Unknown";
user.LastName = "User"; user.LastName = "User";
} }
AddUserInternal (user); AddUserInternal (user);
} }
} }