From 4c806855636543eba0423bfca0ef2084d7d7a536 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 22 Apr 2009 19:26:18 +0000
Subject: * Allow plugins to play nicely in UserManagerBase * Some methods were
returning the value of the first plugin queried, even if the return was null
* Other methods are probably best off querying more than one plugin and
aggregating results
---
OpenSim/Data/IUserData.cs | 2 +-
.../Framework/Communications/UserManagerBase.cs | 48 +++++++++++-----------
2 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/OpenSim/Data/IUserData.cs b/OpenSim/Data/IUserData.cs
index 9ac923f..573355b 100644
--- a/OpenSim/Data/IUserData.cs
+++ b/OpenSim/Data/IUserData.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Data
///
/// ID associated with the user's query. This must match what the client sent
/// The filtered contents of the search box when the user hit search.
- /// The user data profile
+ /// A list of user details. If there are no results than either an empty list or null can be returned
List GeneratePickerResults(UUID queryID, string query);
///
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 3b43622..a269b59 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -174,44 +174,46 @@ namespace OpenSim.Framework.Communications
public virtual List GenerateAgentPickerRequestResponse(UUID queryID, string query)
{
- List pickerlist = new List();
+ List allPickerList = new List();
+
foreach (IUserDataPlugin plugin in m_plugins)
{
try
{
- pickerlist = plugin.GeneratePickerResults(queryID, query);
+ List pickerList = plugin.GeneratePickerResults(queryID, query);
+ if (pickerList != null)
+ allPickerList.AddRange(pickerList);
}
catch (Exception)
{
- m_log.Info("[USERSTORAGE]: Unable to generate AgentPickerData via " + plugin.Name + "(" + query + ")");
- return new List();
+ m_log.Error(
+ "[USERSTORAGE]: Unable to generate AgentPickerData via " + plugin.Name + "(" + query + ")");
}
}
- return pickerlist;
+ return allPickerList;
}
-
- ///
- /// Updates a user profile from data object
- ///
- ///
- ///
+
public virtual bool UpdateUserProfile(UserProfileData data)
{
+ bool result = false;
+
foreach (IUserDataPlugin plugin in m_plugins)
{
try
{
plugin.UpdateUserProfile(data);
- return true;
+ result = true;
}
catch (Exception e)
{
- m_log.InfoFormat("[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}", data.FirstName, data.SurName,
- plugin.Name, e.ToString());
+ m_log.InfoFormat(
+ "[USERSTORAGE]: Unable to set user {0} {1} via {2}: {3}",
+ data.FirstName, data.SurName, plugin.Name, e.ToString());
}
}
- return false;
+
+ return result;
}
#endregion
@@ -232,9 +234,7 @@ namespace OpenSim.Framework.Communications
UserAgentData result = plugin.GetAgentByUUID(uuid);
if (result != null)
- {
return result;
- }
}
catch (Exception e)
{
@@ -256,7 +256,10 @@ namespace OpenSim.Framework.Communications
{
try
{
- return plugin.GetAgentByName(name);
+ UserAgentData result = plugin.GetAgentByName(name);
+
+ if (result != null)
+ return result;
}
catch (Exception e)
{
@@ -279,7 +282,10 @@ namespace OpenSim.Framework.Communications
{
try
{
- return plugin.GetAgentByName(fname, lname);
+ UserAgentData result = plugin.GetAgentByName(fname, lname);
+
+ if (result != null)
+ return result;
}
catch (Exception e)
{
@@ -304,9 +310,7 @@ namespace OpenSim.Framework.Communications
List result = plugin.GetUserFriendList(ownerID);
if (result != null)
- {
return result;
- }
}
catch (Exception e)
{
@@ -326,9 +330,7 @@ namespace OpenSim.Framework.Communications
Dictionary result = plugin.GetFriendRegionInfos(uuids);
if (result != null)
- {
return result;
- }
}
catch (Exception e)
{
--
cgit v1.1