mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 10:15:33 +08:00
* Resolve http://opensimulator.org/mantis/view.php?id=3509 by putting some service initialization into CommsManager
* What is really needed is a plugin and interface request system as being done for region modules
This commit is contained in:
@@ -36,6 +36,12 @@ namespace OpenSim.Framework.Communications
|
||||
/// <summary>
|
||||
/// This class manages references to OpenSim non-region services (asset, inventory, user, etc.)
|
||||
/// </summary>
|
||||
///
|
||||
/// TODO: Service retrieval needs to be managed via plugin and interfaces requests, as happens for region
|
||||
/// modules from scene. Among other things, this will allow this class to be used in many different contexts
|
||||
/// (from a grid service executable, to provide services on a region) without lots of messy nulls and confusion.
|
||||
/// Also, a post initialize step on the plugins will be needed so that we don't get tortuous problems with
|
||||
/// circular dependencies between plugins.
|
||||
public class CommunicationsManager
|
||||
{
|
||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
@@ -117,7 +117,12 @@ namespace OpenSim.Framework.Communications
|
||||
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship
|
||||
/// for UUID friendslistowner
|
||||
/// </summary>
|
||||
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
|
||||
///
|
||||
/// <param name="friendlistowner">The agent for whom we're retreiving the friends Data.</param>
|
||||
/// <returns>
|
||||
/// A List of FriendListItems that contains info about the user's friends.
|
||||
/// Always returns a list even if the user has no friends
|
||||
/// </returns>
|
||||
List<FriendListItem> GetUserFriendList(UUID friendlistowner);
|
||||
|
||||
// This probably shouldn't be here, it belongs to IAuthentication
|
||||
|
||||
@@ -35,6 +35,7 @@ using Nwc.XmlRpc;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Statistics;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
@@ -52,15 +53,15 @@ namespace OpenSim.Framework.Communications
|
||||
/// </value>
|
||||
private List<IUserDataPlugin> m_plugins = new List<IUserDataPlugin>();
|
||||
|
||||
protected IInterServiceInventoryServices m_interServiceInventoryService;
|
||||
protected CommunicationsManager m_commsManager;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="interServiceInventoryService"></param>
|
||||
public UserManagerBase(IInterServiceInventoryServices interServiceInventoryService)
|
||||
/// <param name="commsManager"></param>
|
||||
public UserManagerBase(CommunicationsManager commsManager)
|
||||
{
|
||||
m_interServiceInventoryService = interServiceInventoryService;
|
||||
m_commsManager = commsManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -296,48 +297,48 @@ namespace OpenSim.Framework.Communications
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads a user's friend list
|
||||
/// </summary>
|
||||
/// <param name="name">the UUID of the friend list owner</param>
|
||||
/// <returns>A List of FriendListItems that contains info about the user's friends</returns>
|
||||
public virtual List<FriendListItem> GetUserFriendList(UUID ownerID)
|
||||
{
|
||||
List<FriendListItem> allFriends = new List<FriendListItem>();
|
||||
|
||||
foreach (IUserDataPlugin plugin in m_plugins)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<FriendListItem> result = plugin.GetUserFriendList(ownerID);
|
||||
List<FriendListItem> friends = plugin.GetUserFriendList(ownerID);
|
||||
|
||||
if (result != null)
|
||||
return result;
|
||||
if (friends != null)
|
||||
allFriends.AddRange(friends);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to GetUserFriendList via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
m_log.Error("[USERSTORAGE]: Unable to GetUserFriendList via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return allFriends;
|
||||
}
|
||||
|
||||
public virtual Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
|
||||
{
|
||||
//Dictionary<UUID, FriendRegionInfo> allFriendRegions = new Dictionary<UUID, FriendRegionInfo>();
|
||||
|
||||
foreach (IUserDataPlugin plugin in m_plugins)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<UUID, FriendRegionInfo> result = plugin.GetFriendRegionInfos(uuids);
|
||||
Dictionary<UUID, FriendRegionInfo> friendRegions = plugin.GetFriendRegionInfos(uuids);
|
||||
|
||||
if (result != null)
|
||||
return result;
|
||||
if (friendRegions != null)
|
||||
return friendRegions;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to GetFriendRegionInfos via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
return new Dictionary<UUID, FriendRegionInfo>();
|
||||
}
|
||||
|
||||
public void StoreWebLoginKey(UUID agentID, UUID webLoginKey)
|
||||
@@ -662,7 +663,7 @@ namespace OpenSim.Framework.Communications
|
||||
}
|
||||
else
|
||||
{
|
||||
m_interServiceInventoryService.CreateNewUserInventory(userProf.ID);
|
||||
m_commsManager.InterServiceInventoryService.CreateNewUserInventory(userProf.ID);
|
||||
|
||||
return userProf.ID;
|
||||
}
|
||||
@@ -731,13 +732,17 @@ namespace OpenSim.Framework.Communications
|
||||
{
|
||||
try
|
||||
{
|
||||
return plugin.GetUserAppearance(user);
|
||||
AvatarAppearance appearance = plugin.GetUserAppearance(user);
|
||||
|
||||
if (appearance != null)
|
||||
return appearance;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[USERSTORAGE]: Unable to find user appearance {0} via {1} ({2})", user.ToString(), plugin.Name, e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user