parent
078643a017
commit
a62b906a7b
|
@ -64,7 +64,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
private readonly UserProfileData m_userProfile;
|
private readonly UserProfileData m_userProfile;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Has we received the user's inventory from the inventory service?
|
/// Have we received the user's inventory from the inventory service?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasReceivedInventory { get { return m_hasReceivedInventory; } }
|
public bool HasReceivedInventory { get { return m_hasReceivedInventory; } }
|
||||||
private bool m_hasReceivedInventory;
|
private bool m_hasReceivedInventory;
|
||||||
|
@ -85,9 +85,9 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders
|
private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders
|
||||||
= new Dictionary<LLUUID, IList<InventoryFolderImpl>>();
|
= new Dictionary<LLUUID, IList<InventoryFolderImpl>>();
|
||||||
|
|
||||||
private LLUUID m_session_id = LLUUID.Zero;
|
|
||||||
public LLUUID SessionID { get { return m_session_id; } }
|
public LLUUID SessionID { get { return m_session_id; } }
|
||||||
|
private LLUUID m_session_id = LLUUID.Zero;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
//using System.Reflection;
|
//using System.Reflection;
|
||||||
|
@ -36,12 +37,22 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
public class InventoryFolderImpl : InventoryFolderBase
|
public class InventoryFolderImpl : InventoryFolderBase
|
||||||
{
|
{
|
||||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
//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>();
|
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>();
|
public Dictionary<LLUUID, InventoryFolderImpl> SubFolders = new Dictionary<LLUUID, InventoryFolderImpl>();
|
||||||
|
|
||||||
// Accessors
|
/// <summary>
|
||||||
|
/// The number of child folders
|
||||||
|
/// </summary>
|
||||||
public int SubFoldersCount
|
public int SubFoldersCount
|
||||||
{
|
{
|
||||||
get { return SubFolders.Count; }
|
get { return SubFolders.Count; }
|
||||||
|
@ -177,9 +188,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
public InventoryFolderImpl FindFolder(LLUUID folderID)
|
public InventoryFolderImpl FindFolder(LLUUID folderID)
|
||||||
{
|
{
|
||||||
if (folderID == ID)
|
if (folderID == ID)
|
||||||
{
|
|
||||||
return this;
|
return this;
|
||||||
}
|
|
||||||
|
|
||||||
lock (SubFolders)
|
lock (SubFolders)
|
||||||
{
|
{
|
||||||
|
@ -188,14 +197,51 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
InventoryFolderImpl returnFolder = folder.FindFolder(folderID);
|
InventoryFolderImpl returnFolder = folder.FindFolder(folderID);
|
||||||
|
|
||||||
if (returnFolder != null)
|
if (returnFolder != null)
|
||||||
{
|
|
||||||
return returnFolder;
|
return returnFolder;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
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>
|
/// <summary>
|
||||||
/// Return the list of child items in this folder
|
/// Return the list of child items in this folder
|
||||||
|
|
|
@ -680,7 +680,7 @@ namespace OpenSim
|
||||||
|
|
||||||
string firstName = cmdparams[0];
|
string firstName = cmdparams[0];
|
||||||
string lastName = cmdparams[1];
|
string lastName = cmdparams[1];
|
||||||
//string invPath = cmdparams[2];
|
string invPath = cmdparams[2];
|
||||||
//string savePath = (cmdparams.Length > 3 ? cmdparams[3] : DEFAULT_INV_BACKUP_FILENAME);
|
//string savePath = (cmdparams.Length > 3 ? cmdparams[3] : DEFAULT_INV_BACKUP_FILENAME);
|
||||||
|
|
||||||
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(firstName, lastName);
|
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);
|
m_log.ErrorFormat("[CONSOLE]: Failed to find user info for {0} {1} {2}", firstName, lastName, userProfile.ID);
|
||||||
return;
|
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>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue