parent
078643a017
commit
a62b906a7b
|
@ -64,7 +64,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
private readonly UserProfileData m_userProfile;
|
||||
|
||||
/// <summary>
|
||||
/// Has we received the user's inventory from the inventory service?
|
||||
/// Have we received the user's inventory from the inventory service?
|
||||
/// </summary>
|
||||
public bool HasReceivedInventory { get { return m_hasReceivedInventory; } }
|
||||
private bool m_hasReceivedInventory;
|
||||
|
@ -85,9 +85,9 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
/// </summary>
|
||||
private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders
|
||||
= new Dictionary<LLUUID, IList<InventoryFolderImpl>>();
|
||||
|
||||
private LLUUID m_session_id = LLUUID.Zero;
|
||||
|
||||
public LLUUID SessionID { get { return m_session_id; } }
|
||||
private LLUUID m_session_id = LLUUID.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
//using System.Reflection;
|
||||
|
@ -36,12 +37,22 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
public class InventoryFolderImpl : InventoryFolderBase
|
||||
{
|
||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public static readonly string PATH_DELIMITER = "/";
|
||||
|
||||
// Fields
|
||||
/// <summary>
|
||||
/// Items that are contained in this folder
|
||||
/// </summary>
|
||||
public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
|
||||
|
||||
/// <summary>
|
||||
/// Child folders that are contained in this folder
|
||||
/// </summary>
|
||||
public Dictionary<LLUUID, InventoryFolderImpl> SubFolders = new Dictionary<LLUUID, InventoryFolderImpl>();
|
||||
|
||||
// Accessors
|
||||
/// <summary>
|
||||
/// The number of child folders
|
||||
/// </summary>
|
||||
public int SubFoldersCount
|
||||
{
|
||||
get { return SubFolders.Count; }
|
||||
|
@ -177,9 +188,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
public InventoryFolderImpl FindFolder(LLUUID folderID)
|
||||
{
|
||||
if (folderID == ID)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
lock (SubFolders)
|
||||
{
|
||||
|
@ -188,14 +197,51 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
InventoryFolderImpl returnFolder = folder.FindFolder(folderID);
|
||||
|
||||
if (returnFolder != null)
|
||||
{
|
||||
return returnFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find a folder given a PATH_DELIMITOR delimited path.
|
||||
///
|
||||
/// This method does not handle paths that contain multiple delimitors
|
||||
///
|
||||
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
|
||||
/// XPath like expression
|
||||
///
|
||||
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
|
||||
/// </summary>
|
||||
/// <param name="path">
|
||||
/// The path to the required folder. It this is empty then this folder itself is returned.
|
||||
/// If a folder for the given path is not found, then null is returned.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public InventoryFolderImpl FindFolderByPath(string path)
|
||||
{
|
||||
if (path == string.Empty)
|
||||
return this;
|
||||
|
||||
int delimitorIndex = path.IndexOf(PATH_DELIMITER);
|
||||
string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
|
||||
|
||||
lock (SubFolders)
|
||||
{
|
||||
foreach (InventoryFolderImpl folder in SubFolders.Values)
|
||||
{
|
||||
if (folder.Name == components[0])
|
||||
if (components.Length > 1)
|
||||
return folder.FindFolderByPath(components[1]);
|
||||
else
|
||||
return folder;
|
||||
}
|
||||
}
|
||||
|
||||
// We didn't find a folder with the given name
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the list of child items in this folder
|
||||
|
|
|
@ -680,7 +680,7 @@ namespace OpenSim
|
|||
|
||||
string firstName = cmdparams[0];
|
||||
string lastName = cmdparams[1];
|
||||
//string invPath = cmdparams[2];
|
||||
string invPath = cmdparams[2];
|
||||
//string savePath = (cmdparams.Length > 3 ? cmdparams[3] : DEFAULT_INV_BACKUP_FILENAME);
|
||||
|
||||
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(firstName, lastName);
|
||||
|
@ -695,7 +695,46 @@ namespace OpenSim
|
|||
{
|
||||
m_log.ErrorFormat("[CONSOLE]: Failed to find user info for {0} {1} {2}", firstName, lastName, userProfile.ID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
InventoryFolderImpl inventoryFolder = null;
|
||||
|
||||
if (userInfo.HasReceivedInventory)
|
||||
{
|
||||
if (invPath == InventoryFolderImpl.PATH_DELIMITER)
|
||||
{
|
||||
inventoryFolder = userInfo.RootFolder;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl
|
||||
// itself (possibly at a small loss in efficiency).
|
||||
string[] components
|
||||
= invPath.Split(new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
|
||||
invPath = String.Empty;
|
||||
foreach (string c in components)
|
||||
{
|
||||
invPath += c + InventoryFolderImpl.PATH_DELIMITER;
|
||||
}
|
||||
|
||||
inventoryFolder = userInfo.RootFolder.FindFolderByPath(invPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", firstName, lastName, userProfile.ID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (null == inventoryFolder)
|
||||
{
|
||||
m_log.ErrorFormat("[CONSOLE]: Could not find folder with path {0}", invPath);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[CONSOLE]: Found folder {0} {1} at {2}", inventoryFolder.Name, inventoryFolder.ID, invPath);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue