* Enhance some internal inventory data plugin behaviour to match what was probably intended

* (e.g returning combined results of plugin rather than always the first result)
* This will not affect any existing functionality
0.6.5-rc1
Justin Clarke Casey 2009-05-04 17:16:01 +00:00
parent a61cbab799
commit ee5774208f
3 changed files with 21 additions and 14 deletions

View File

@ -134,4 +134,4 @@ namespace OpenSim.Framework.Communications
/// <returns>null if no root folder was found</returns> /// <returns>null if no root folder was found</returns>
InventoryFolderBase RequestRootFolder(UUID userID); InventoryFolderBase RequestRootFolder(UUID userID);
} }
} }

View File

@ -117,11 +117,15 @@ namespace OpenSim.Framework.Communications
// See IInventoryServices // See IInventoryServices
public virtual InventoryFolderBase RequestRootFolder(UUID userID) public virtual InventoryFolderBase RequestRootFolder(UUID userID)
{ {
// FIXME: Probably doesn't do what was originally intended - only ever queries the first plugin // Retrieve the first root folder we get from the list of plugins.
foreach (IInventoryDataPlugin plugin in m_plugins) foreach (IInventoryDataPlugin plugin in m_plugins)
{ {
return plugin.getUserRootFolder(userID); InventoryFolderBase rootFolder = plugin.getUserRootFolder(userID);
if (rootFolder != null)
return rootFolder;
} }
// Return nothing if no plugin was able to supply a root folder
return null; return null;
} }
@ -154,11 +158,13 @@ namespace OpenSim.Framework.Communications
public List<InventoryItemBase> GetActiveGestures(UUID userId) public List<InventoryItemBase> GetActiveGestures(UUID userId)
{ {
List<InventoryItemBase> activeGestures = new List<InventoryItemBase>();
foreach (IInventoryDataPlugin plugin in m_plugins) foreach (IInventoryDataPlugin plugin in m_plugins)
{ {
return plugin.fetchActiveGestures(userId); activeGestures.AddRange(plugin.fetchActiveGestures(userId));
} }
return new List<InventoryItemBase>();
return activeGestures;
} }
#endregion #endregion
@ -168,21 +174,24 @@ namespace OpenSim.Framework.Communications
public List<InventoryFolderBase> RequestSubFolders(UUID parentFolderID) public List<InventoryFolderBase> RequestSubFolders(UUID parentFolderID)
{ {
List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>(); List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
foreach (IInventoryDataPlugin plugin in m_plugins) foreach (IInventoryDataPlugin plugin in m_plugins)
{ {
return plugin.getInventoryFolders(parentFolderID); inventoryList.AddRange(plugin.getInventoryFolders(parentFolderID));
} }
return inventoryList; return inventoryList;
} }
public List<InventoryItemBase> RequestFolderItems(UUID folderID) public List<InventoryItemBase> RequestFolderItems(UUID folderID)
{ {
List<InventoryItemBase> itemsList = new List<InventoryItemBase>(); List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
foreach (IInventoryDataPlugin plugin in m_plugins) foreach (IInventoryDataPlugin plugin in m_plugins)
{ {
itemsList = plugin.getInventoryInFolder(folderID); itemsList.AddRange(plugin.getInventoryInFolder(folderID));
return itemsList;
} }
return itemsList; return itemsList;
} }
@ -284,9 +293,7 @@ namespace OpenSim.Framework.Communications
{ {
InventoryItemBase result = plugin.queryInventoryItem(item.ID); InventoryItemBase result = plugin.queryInventoryItem(item.ID);
if (result != null) if (result != null)
{
return result; return result;
}
} }
return null; return null;
@ -298,9 +305,7 @@ namespace OpenSim.Framework.Communications
{ {
InventoryFolderBase result = plugin.queryInventoryFolder(item.ID); InventoryFolderBase result = plugin.queryInventoryFolder(item.ID);
if (result != null) if (result != null)
{
return result; return result;
}
} }
return null; return null;
@ -353,7 +358,9 @@ namespace OpenSim.Framework.Communications
{ {
foreach (IInventoryDataPlugin plugin in m_plugins) foreach (IInventoryDataPlugin plugin in m_plugins)
{ {
return plugin.getInventoryItem(itemID); InventoryItemBase item = plugin.getInventoryItem(itemID);
if (item != null)
return item;
} }
return null; return null;

View File

@ -72,7 +72,7 @@ namespace OpenSim.Framework.Communications
public virtual void AddTemporaryUserProfile(UserProfileData userProfile) public virtual void AddTemporaryUserProfile(UserProfileData userProfile)
{ {
m_log.DebugFormat("[TEMP USER PROFILE]: Adding {0} {1}", userProfile.Name, userProfile.ID); //m_log.DebugFormat("[TEMP USER PROFILE]: Adding {0} {1}", userProfile.Name, userProfile.ID);
lock (m_profiles) lock (m_profiles)
{ {