From 7dbc5803a6321dc13fccb3d7eef31963e2e28278 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 18 Aug 2016 02:49:46 +0100 Subject: in GetUsersNames(string[] ids) dont loose names HGFriends may have cached --- .../UserManagement/UserManagementModule.cs | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 2fd9183..640ca4e 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -488,9 +488,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return ret; List missing = new List(); - + Dictionary untried = new Dictionary(); // look in cache UserData userdata = new UserData(); + UUID uuid = UUID.Zero; foreach(string id in ids) { @@ -499,11 +500,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement lock (m_UserCache) { if (m_UserCache.TryGetValue(uuid, out userdata) && - userdata.HasGridUserTried && userdata.FirstName != "Unknown") { string name = userdata.FirstName + " " + userdata.LastName; - ret[uuid] = name; + + if(userdata.HasGridUserTried) + ret[uuid] = name; + else + { + untried[uuid] = name; + missing.Add(id); + } } else missing.Add(id); @@ -527,6 +534,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement string name = uac.FirstName + " " + uac.LastName; ret[uac.PrincipalID] = name; missing.Remove(uac.PrincipalID.ToString()); // slowww + untried.Remove(uac.PrincipalID); userdata = new UserData(); userdata.Id = uac.PrincipalID; @@ -567,6 +575,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement string name = first.Replace(" ", ".") + "." + last.Replace(" ", ".") + " @" + new Uri(url).Authority; ret[u] = name; missing.Remove(u.ToString()); + untried.Remove(u); } catch { @@ -577,6 +586,16 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } + // add the untried in cache that still failed + if(untried.Count > 0) + { + foreach(KeyValuePair kvp in untried) + { + ret[kvp.Key] = kvp.Value; + missing.Remove(kvp.Key.ToString()); + } + } + // add the UMMthings ( not sure we should) if(missing.Count > 0) { -- cgit v1.1