* Refactor: A final root folder special case removal, this time in HandleFetchInventoryDescendents[CAPS]

0.6.0-stable
Justin Clarke Casey 2008-05-04 01:14:21 +00:00
parent 6c62985fd5
commit 5ab392d0ee
1 changed files with 18 additions and 49 deletions

View File

@ -250,15 +250,6 @@ namespace OpenSim.Framework.Communications.Cache
// XXX We're not handling sortOrder yet! // XXX We're not handling sortOrder yet!
InventoryFolderImpl fold = null; InventoryFolderImpl fold = null;
if (folderID == libraryRoot.ID)
{
remoteClient.SendInventoryFolderDetails(
libraryRoot.Owner, libraryRoot.ID, libraryRoot.RequestListOfItems(),
libraryRoot.RequestListOfFolders(), fetchFolders, fetchItems);
return;
}
if ((fold = libraryRoot.FindFolder(folderID)) != null) if ((fold = libraryRoot.FindFolder(folderID)) != null)
{ {
remoteClient.SendInventoryFolderDetails( remoteClient.SendInventoryFolderDetails(
@ -293,33 +284,23 @@ namespace OpenSim.Framework.Communications.Cache
if (userProfile.HasInventory) if (userProfile.HasInventory)
{ {
if (userProfile.RootFolder.ID == folderID) if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[AGENT INVENTORY]: Found root folder {0} for client {1}", // "[AGENT INVENTORY]: Found folder {0} for client {1}",
// folderID, remoteClient.AgentId); // folderID, remoteClient.AgentId);
remoteClient.SendInventoryFolderDetails( remoteClient.SendInventoryFolderDetails(
remoteClient.AgentId, folderID, userProfile.RootFolder.RequestListOfItems(), remoteClient.AgentId, folderID, fold.RequestListOfItems(),
userProfile.RootFolder.RequestListOfFolders(), fold.RequestListOfFolders(), fetchFolders, fetchItems);
fetchFolders, fetchItems);
return; return;
} }
else else
{ {
if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) m_log.WarnFormat(
{ "[AGENT INVENTORY]: Could not find folder {0} requested by user {1} {2}",
// m_log.DebugFormat( folderID, remoteClient.Name, remoteClient.AgentId);
// "[AGENT INVENTORY]: Found folder {0} for client {1}",
// folderID, remoteClient.AgentId);
remoteClient.SendInventoryFolderDetails(
remoteClient.AgentId, folderID, fold.RequestListOfItems(),
fold.RequestListOfFolders(), fetchFolders, fetchItems);
return;
}
} }
} }
else else
@ -363,12 +344,7 @@ namespace OpenSim.Framework.Communications.Cache
// XXX We're not handling sortOrder yet! // XXX We're not handling sortOrder yet!
InventoryFolderImpl fold = null; InventoryFolderImpl fold;
if (folderID == libraryRoot.ID)
{
return libraryRoot.RequestListOfItems();
}
if ((fold = libraryRoot.FindFolder(folderID)) != null) if ((fold = libraryRoot.FindFolder(folderID)) != null)
{ {
return fold.RequestListOfItems(); return fold.RequestListOfItems();
@ -404,17 +380,18 @@ namespace OpenSim.Framework.Communications.Cache
if (userProfile.HasInventory) if (userProfile.HasInventory)
{ {
if (userProfile.RootFolder.ID == folderID) if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null)
{ {
return userProfile.RootFolder.RequestListOfItems(); return fold.RequestListOfItems();
} }
else else
{ {
if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) m_log.WarnFormat(
{ "[AGENT INVENTORY]: Could not find folder {0} requested by user {1}",
return fold.RequestListOfItems(); folderID, agentID);
}
} return null;
}
} }
else else
{ {
@ -429,14 +406,6 @@ namespace OpenSim.Framework.Communications.Cache
return null; return null;
} }
// If we've reached this point then we couldn't find the folder, even though the client thinks
// it exists
m_log.ErrorFormat("[AGENT INVENTORY]: " +
"Could not find folder {0} for user {1}",
folderID, agentID.ToString());
return new List<InventoryItemBase>();
} }
/// <summary> /// <summary>