* minor: replace test of CachedUserInfo.RootFolder != null with something more readable, and make RootFolder get only

0.6.0-stable
Justin Clarke Casey 2008-04-11 17:02:20 +00:00
parent 205b95f2e8
commit e26d4fc085
2 changed files with 20 additions and 14 deletions

View File

@ -49,7 +49,8 @@ namespace OpenSim.Framework.Communications.Cache
public UserProfileData UserProfile { get { return m_userProfile; } }
// FIXME: These need to be hidden behind accessors
public InventoryFolderImpl RootFolder = null;
private InventoryFolderImpl m_rootFolder;
public InventoryFolderImpl RootFolder { get { return m_rootFolder; } }
/// <summary>
/// Stores received folders for which we have not yet received the parents.
@ -67,6 +68,11 @@ namespace OpenSim.Framework.Communications.Cache
m_commsManager = commsManager;
m_userProfile = userProfile;
}
/// <summary>
/// Has this user info object yet received its inventory information from the invetnroy service?
/// </summary>
public bool HasInventory { get { return RootFolder != null; } }
/// <summary>
/// Store a folder pending categorization when its parent is received.
@ -134,7 +140,7 @@ namespace OpenSim.Framework.Communications.Cache
{
if (folderInfo.ParentID == LLUUID.Zero)
{
RootFolder = folderInfo;
m_rootFolder = folderInfo;
}
}
else if (RootFolder.ID == folderInfo.ParentID)
@ -208,7 +214,7 @@ namespace OpenSim.Framework.Communications.Cache
public void AddItem(LLUUID userID, InventoryItemBase itemInfo)
{
if ((userID == UserProfile.ID) && (RootFolder != null))
if ((userID == UserProfile.ID) && HasInventory)
{
ItemReceive(userID, itemInfo);
m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
@ -217,7 +223,7 @@ namespace OpenSim.Framework.Communications.Cache
public void UpdateItem(LLUUID userID, InventoryItemBase itemInfo)
{
if ((userID == UserProfile.ID) && (RootFolder != null))
if ((userID == UserProfile.ID) && HasInventory)
{
m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo);
}
@ -226,7 +232,7 @@ namespace OpenSim.Framework.Communications.Cache
public bool DeleteItem(LLUUID userID, InventoryItemBase item)
{
bool result = false;
if ((userID == UserProfile.ID) && (RootFolder != null))
if ((userID == UserProfile.ID) && HasInventory)
{
result = RootFolder.DeleteItem(item.ID);
if (result)

View File

@ -125,7 +125,7 @@ namespace OpenSim.Framework.Communications.Cache
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
{
if (userProfile.RootFolder != null)
if (userProfile.HasInventory)
{
if (userProfile.RootFolder.ID == parentID)
{
@ -175,7 +175,7 @@ namespace OpenSim.Framework.Communications.Cache
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
{
if (userProfile.RootFolder != null)
if (userProfile.HasInventory)
{
InventoryFolderBase baseFolder = new InventoryFolderBase();
baseFolder.Owner = remoteClient.AgentId;
@ -195,7 +195,7 @@ namespace OpenSim.Framework.Communications.Cache
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
{
if (userProfile.RootFolder != null)
if (userProfile.HasInventory)
{
InventoryFolderBase baseFolder = new InventoryFolderBase();
baseFolder.Owner = remoteClient.AgentId;
@ -248,21 +248,21 @@ namespace OpenSim.Framework.Communications.Cache
// inventory failure.
//
// This is a crude way of dealing with that by retrying the lookup.
if (userProfile.RootFolder == null)
if (!userProfile.HasInventory)
{
int attempts = 5;
while (attempts-- > 0)
{
Thread.Sleep(3000);
if (userProfile.RootFolder != null)
if (userProfile.HasInventory)
{
break;
}
}
}
if (userProfile.RootFolder != null)
if (userProfile.HasInventory)
{
if (userProfile.RootFolder.ID == folderID)
{
@ -346,7 +346,7 @@ namespace OpenSim.Framework.Communications.Cache
CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(agentID, out userProfile))
{
if (userProfile.RootFolder != null)
if (userProfile.HasInventory)
{
if (userProfile.RootFolder.ID == folderID)
{
@ -393,7 +393,7 @@ namespace OpenSim.Framework.Communications.Cache
CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
{
if (userProfile.RootFolder != null)
if (userProfile.HasInventory)
{
InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID);
if (subFolder != null)
@ -420,7 +420,7 @@ namespace OpenSim.Framework.Communications.Cache
CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
{
if (userProfile.RootFolder != null)
if (userProfile.HasInventory)
{
InventoryItemBase item = userProfile.RootFolder.HasItem(itemID);
if (item != null)