From 5ab392d0ee041a78f0d2752c4cc3302855a12abb Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sun, 4 May 2008 01:14:21 +0000 Subject: * Refactor: A final root folder special case removal, this time in HandleFetchInventoryDescendents[CAPS] --- .../Cache/UserProfileCacheService.cs | 67 ++++++---------------- 1 file changed, 18 insertions(+), 49 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 92b08e5..176e75e 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -250,15 +250,6 @@ namespace OpenSim.Framework.Communications.Cache // XXX We're not handling sortOrder yet! 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) { remoteClient.SendInventoryFolderDetails( @@ -293,33 +284,23 @@ namespace OpenSim.Framework.Communications.Cache if (userProfile.HasInventory) { - if (userProfile.RootFolder.ID == folderID) + if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) { -// m_log.DebugFormat( -// "[AGENT INVENTORY]: Found root folder {0} for client {1}", -// folderID, remoteClient.AgentId); +// m_log.DebugFormat( +// "[AGENT INVENTORY]: Found folder {0} for client {1}", +// folderID, remoteClient.AgentId); remoteClient.SendInventoryFolderDetails( - remoteClient.AgentId, folderID, userProfile.RootFolder.RequestListOfItems(), - userProfile.RootFolder.RequestListOfFolders(), - fetchFolders, fetchItems); + remoteClient.AgentId, folderID, fold.RequestListOfItems(), + fold.RequestListOfFolders(), fetchFolders, fetchItems); return; } else { - if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) - { -// m_log.DebugFormat( -// "[AGENT INVENTORY]: Found folder {0} for client {1}", -// folderID, remoteClient.AgentId); - - remoteClient.SendInventoryFolderDetails( - remoteClient.AgentId, folderID, fold.RequestListOfItems(), - fold.RequestListOfFolders(), fetchFolders, fetchItems); - - return; - } + m_log.WarnFormat( + "[AGENT INVENTORY]: Could not find folder {0} requested by user {1} {2}", + folderID, remoteClient.Name, remoteClient.AgentId); } } else @@ -363,12 +344,7 @@ namespace OpenSim.Framework.Communications.Cache // XXX We're not handling sortOrder yet! - InventoryFolderImpl fold = null; - if (folderID == libraryRoot.ID) - { - return libraryRoot.RequestListOfItems(); - } - + InventoryFolderImpl fold; if ((fold = libraryRoot.FindFolder(folderID)) != null) { return fold.RequestListOfItems(); @@ -404,17 +380,18 @@ namespace OpenSim.Framework.Communications.Cache if (userProfile.HasInventory) { - if (userProfile.RootFolder.ID == folderID) + if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) { - return userProfile.RootFolder.RequestListOfItems(); + return fold.RequestListOfItems(); } else { - if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) - { - return fold.RequestListOfItems(); - } - } + m_log.WarnFormat( + "[AGENT INVENTORY]: Could not find folder {0} requested by user {1}", + folderID, agentID); + + return null; + } } else { @@ -429,14 +406,6 @@ namespace OpenSim.Framework.Communications.Cache 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(); } /// -- cgit v1.1