From 138bcf6fffdb16e3962c03f995aff7cda15a7800 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 17 Oct 2008 16:44:05 +0000 Subject: * Apply a modified version of http://opensimulator.org/mantis/view.php?id=2290 * This allows multiple user profile providers to be specified in OpenSim.ini separated by commas * If multiple providers are specified then a request for a user profile will query each in turn until the profile is either found or all have been queried * Unfortunately I don't believe this order can currently be specified, which if true is something that will need to be fixed. * Thanks to smeans for the original patch. --- .../Framework/Communications/UserManagerBase.cs | 20 +++++++++--- OpenSim/Framework/PluginLoader.cs | 37 ++++++++++++++++++---- 2 files changed, 46 insertions(+), 11 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index aa68367..32bfed7 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -56,11 +56,11 @@ namespace OpenSim.Framework.Communications public void AddPlugin(string provider, string connect) { PluginLoader loader = - new PluginLoader (new UserDataInitialiser (connect)); + new PluginLoader(new UserDataInitialiser(connect)); // loader will try to load all providers (MySQL, MSSQL, etc) // unless it is constrainted to the correct "Provider" entry in the addin.xml - loader.Add ("/OpenSim/UserData", new PluginProviderFilter (provider)); + loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider)); loader.Load(); _plugins = loader.Plugins; @@ -178,7 +178,12 @@ namespace OpenSim.Framework.Communications { try { - return plugin.GetAgentByUUID(uuid); + UserAgentData result = plugin.GetAgentByUUID(uuid); + + if (result != null) + { + return result; + } } catch (Exception e) { @@ -260,7 +265,12 @@ namespace OpenSim.Framework.Communications { try { - return plugin.GetUserFriendList(ownerID); + List result = plugin.GetUserFriendList(ownerID); + + if (result != null) + { + return result; + } } catch (Exception e) { @@ -331,7 +341,6 @@ namespace OpenSim.Framework.Communications } } - /// /// Resets the currentAgent in the user profile /// @@ -344,6 +353,7 @@ namespace OpenSim.Framework.Communications { return; } + profile.CurrentAgent = null; UpdateUserProfile(profile); diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs index ab4e217..a39f787 100644 --- a/OpenSim/Framework/PluginLoader.cs +++ b/OpenSim/Framework/PluginLoader.cs @@ -342,20 +342,45 @@ namespace OpenSim.Framework } /// - /// Filters out which plugin to load based on its "Provider", which is name given by in the addin.xml + /// Filters out which plugin to load based on its the plugin name or names given. Plugin names are contained in + /// their addin.xml /// public class PluginProviderFilter : IPluginFilter { - private string provider; - - public PluginProviderFilter (string p) + private string[] m_filters; + + /// + /// Constructor. + /// + /// + /// Plugin name or names on which to filter. Multiple names should be separated by commas. + /// + public PluginProviderFilter(string p) { - provider = p; + m_filters = p.Split(','); + + for (int i = 0; i < m_filters.Length; i++) + { + m_filters[i] = m_filters[i].Trim(); + } } + /// + /// Apply this filter to the given plugin. + /// + /// + /// true if the plugin's name matched one of the filters, false otherwise. public bool Apply (PluginExtensionNode plugin) { - return (plugin.Provider == provider); + for (int i = 0; i < m_filters.Length; i++) + { + if (m_filters[i] == plugin.Provider) + { + return true; + } + } + + return false; } } } -- cgit v1.1