in GetUsersNames(string[] ids) why are empty names in cache? ignore them, cache also information found by GridUserService

LSLKeyTest
UbitUmarov 2016-08-18 04:16:20 +01:00
parent df8f189f5c
commit fedc689170
1 changed files with 19 additions and 8 deletions

View File

@ -489,6 +489,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
List<string> missing = new List<string>(); List<string> missing = new List<string>();
Dictionary<UUID,string> untried = new Dictionary<UUID, string>(); Dictionary<UUID,string> untried = new Dictionary<UUID, string>();
// look in cache // look in cache
UserData userdata = new UserData(); UserData userdata = new UserData();
@ -500,7 +501,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
lock (m_UserCache) lock (m_UserCache)
{ {
if (m_UserCache.TryGetValue(uuid, out userdata) && if (m_UserCache.TryGetValue(uuid, out userdata) &&
userdata.FirstName != "Unknown") userdata.FirstName != "Unknown" && userdata.FirstName != string.Empty)
{ {
string name = userdata.FirstName + " " + userdata.LastName; string name = userdata.FirstName + " " + userdata.LastName;
@ -562,20 +563,30 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
if (uInfo != null) if (uInfo != null)
{ {
string url, first, last, tmp; string url, first, last, tmp;
UUID u;
if(uInfo.UserID.Length <= 36) if(uInfo.UserID.Length <= 36)
continue; continue;
if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out u, out url, out first, out last, out tmp)) if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out uuid, out url, out first, out last, out tmp))
{ {
if (url != string.Empty) if (url != string.Empty)
{ {
try try
{ {
string name = first.Replace(" ", ".") + "." + last.Replace(" ", ".") + " @" + new Uri(url).Authority; userdata = new UserData();
ret[u] = name; userdata.FirstName = first.Replace(" ", ".") + "." + last.Replace(" ", ".");
missing.Remove(u.ToString()); userdata.LastName = "@" + new Uri(url).Authority;
untried.Remove(u); userdata.Id = uuid;
userdata.HomeURL = url;
userdata.IsUnknownUser = false;
userdata.HasGridUserTried = true;
lock (m_UserCache)
m_UserCache[uuid] = userdata;
string name = userdata.FirstName + " " + userdata.LastName;
ret[uuid] = name;
missing.Remove(uuid.ToString());
untried.Remove(uuid);
} }
catch catch
{ {
@ -592,7 +603,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
foreach(KeyValuePair<UUID, string> kvp in untried) foreach(KeyValuePair<UUID, string> kvp in untried)
{ {
ret[kvp.Key] = kvp.Value; ret[kvp.Key] = kvp.Value;
missing.Remove(kvp.Key.ToString()); missing.Remove((kvp.Key).ToString());
} }
} }