Less refs to UserProfileCacheService. Compiles but likely doesn't run.

This commit is contained in:
Diva Canto
2010-01-09 09:09:32 -08:00
parent 6b60f3cce5
commit 25fdbd6cbc
10 changed files with 163 additions and 113 deletions

View File

@@ -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<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query)
{
List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);

View File

@@ -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;
}

View File

@@ -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
/// <param name="userId"></param>
/// <param name="commsManager"></param>
/// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns>
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.
/// </returns>
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
/// <returns>
/// An OpenSim internal identifier for the name given. Returns null if the name was not valid
/// </returns>
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
/*