From 25fdbd6cbcfc857c444042745d7d4fa8e495a982 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 9 Jan 2010 09:09:32 -0800 Subject: Less refs to UserProfileCacheService. Compiles but likely doesn't run. --- .../Communications/CommunicationsManager.cs | 63 ---------------------- .../Osp/OspInventoryWrapperPlugin.cs | 10 ++-- .../Framework/Communications/Osp/OspResolver.cs | 21 ++++---- 3 files changed, 17 insertions(+), 77 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 52f6202..d215340 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -135,69 +135,6 @@ namespace OpenSim.Framework.Communications return; } - public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) - { - if (uuid == m_userProfileCacheService.LibraryRoot.Owner) - { - remote_client.SendNameReply(uuid, "Mr", "OpenSim"); - } - else - { - string[] names = doUUIDNameRequest(uuid); - if (names.Length == 2) - { - remote_client.SendNameReply(uuid, names[0], names[1]); - } - - } - } - - private string[] doUUIDNameRequest(UUID uuid) - { - lock (m_nameRequestCache) - { - if (m_nameRequestCache.ContainsKey(uuid)) - return m_nameRequestCache[uuid]; - } - - string[] returnstring = new string[0]; - CachedUserInfo uinfo = UserProfileCacheService.GetUserDetails(uuid); - - if ((uinfo != null) && (uinfo.UserProfile != null)) - { - returnstring = new string[2]; - returnstring[0] = uinfo.UserProfile.FirstName; - returnstring[1] = uinfo.UserProfile.SurName; - lock (m_nameRequestCache) - { - if (!m_nameRequestCache.ContainsKey(uuid)) - m_nameRequestCache.Add(uuid, returnstring); - } - } - - return returnstring; - } - - public bool UUIDNameCachedTest(UUID uuid) - { - lock (m_nameRequestCache) - return m_nameRequestCache.ContainsKey(uuid); - } - - public string UUIDNameRequestString(UUID uuid) - { - string[] names = doUUIDNameRequest(uuid); - if (names.Length == 2) - { - string firstname = names[0]; - string lastname = names[1]; - - return firstname + " " + lastname; - - } - return "(hippos)"; - } - public List GenerateAgentPickerRequestResponse(UUID queryID, string query) { List pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query); diff --git a/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs b/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs index e96c5e8..bcd1eee 100644 --- a/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs +++ b/OpenSim/Framework/Communications/Osp/OspInventoryWrapperPlugin.cs @@ -28,6 +28,7 @@ using System.Collections.Generic; using OpenSim.Data; using OpenMetaverse; +using OpenSim.Services.Interfaces; namespace OpenSim.Framework.Communications.Osp { @@ -37,12 +38,13 @@ namespace OpenSim.Framework.Communications.Osp public class OspInventoryWrapperPlugin : IInventoryDataPlugin { protected IInventoryDataPlugin m_wrappedPlugin; - protected CommunicationsManager m_commsManager; + //protected CommunicationsManager m_commsManager; + protected IUserAccountService m_userAccountService; - public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, CommunicationsManager commsManager) + public OspInventoryWrapperPlugin(IInventoryDataPlugin wrappedPlugin, IUserAccountService userService) { m_wrappedPlugin = wrappedPlugin; - m_commsManager = commsManager; + m_userAccountService = userService; } public string Name { get { return "OspInventoryWrapperPlugin"; } } @@ -81,7 +83,7 @@ namespace OpenSim.Framework.Communications.Osp protected InventoryItemBase PostProcessItem(InventoryItemBase item) { - item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_commsManager); + item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_userAccountService); return item; } diff --git a/OpenSim/Framework/Communications/Osp/OspResolver.cs b/OpenSim/Framework/Communications/Osp/OspResolver.cs index 4013896..14f813a 100644 --- a/OpenSim/Framework/Communications/Osp/OspResolver.cs +++ b/OpenSim/Framework/Communications/Osp/OspResolver.cs @@ -31,6 +31,7 @@ using log4net; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; +using OpenSim.Services.Interfaces; namespace OpenSim.Framework.Communications.Osp { @@ -55,11 +56,11 @@ namespace OpenSim.Framework.Communications.Osp /// /// /// The OSPA. Null if a user with the given UUID could not be found. - public static string MakeOspa(UUID userId, CommunicationsManager commsManager) + public static string MakeOspa(UUID userId, IUserAccountService userService) { - CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); - if (userInfo != null) - return MakeOspa(userInfo.UserProfile.FirstName, userInfo.UserProfile.SurName); + UserAccount account = userService.GetUserAccount(UUID.Zero, userId); + if (account != null) + return MakeOspa(account.FirstName, account.LastName); return null; } @@ -88,7 +89,7 @@ namespace OpenSim.Framework.Communications.Osp /// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero /// is returned. /// - public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager) + public static UUID ResolveOspa(string ospa, IUserAccountService userService) { if (!ospa.StartsWith(OSPA_PREFIX)) return UUID.Zero; @@ -112,7 +113,7 @@ namespace OpenSim.Framework.Communications.Osp string value = tuple.Substring(tupleSeparatorIndex + 1).Trim(); if (OSPA_NAME_KEY == key) - return ResolveOspaName(value, commsManager); + return ResolveOspaName(value, userService); } return UUID.Zero; @@ -137,7 +138,7 @@ namespace OpenSim.Framework.Communications.Osp /// /// An OpenSim internal identifier for the name given. Returns null if the name was not valid /// - protected static UUID ResolveOspaName(string name, CommunicationsManager commsManager) + protected static UUID ResolveOspaName(string name, IUserAccountService userService) { int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR); @@ -150,9 +151,9 @@ namespace OpenSim.Framework.Communications.Osp string firstName = name.Remove(nameSeparatorIndex).TrimEnd(); string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart(); - CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); - if (userInfo != null) - return userInfo.UserProfile.ID; + UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName); + if (account != null) + return account.PrincipalID; // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc /* -- cgit v1.1