aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs6
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs58
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs43
3 files changed, 96 insertions, 11 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index d6e1715..025b934 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Framework.Communications.Cache
64 private readonly UserProfileData m_userProfile; 64 private readonly UserProfileData m_userProfile;
65 65
66 /// <summary> 66 /// <summary>
67 /// Has we received the user's inventory from the inventory service? 67 /// Have we received the user's inventory from the inventory service?
68 /// </summary> 68 /// </summary>
69 public bool HasReceivedInventory { get { return m_hasReceivedInventory; } } 69 public bool HasReceivedInventory { get { return m_hasReceivedInventory; } }
70 private bool m_hasReceivedInventory; 70 private bool m_hasReceivedInventory;
@@ -85,9 +85,9 @@ namespace OpenSim.Framework.Communications.Cache
85 /// </summary> 85 /// </summary>
86 private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders 86 private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders
87 = new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); 87 = new Dictionary<LLUUID, IList<InventoryFolderImpl>>();
88 88
89 private LLUUID m_session_id = LLUUID.Zero;
90 public LLUUID SessionID { get { return m_session_id; } } 89 public LLUUID SessionID { get { return m_session_id; } }
90 private LLUUID m_session_id = LLUUID.Zero;
91 91
92 /// <summary> 92 /// <summary>
93 /// Constructor 93 /// Constructor
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
index 0fbc427..b1fdf76 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using libsecondlife; 30using libsecondlife;
30//using System.Reflection; 31//using System.Reflection;
@@ -36,12 +37,22 @@ namespace OpenSim.Framework.Communications.Cache
36 public class InventoryFolderImpl : InventoryFolderBase 37 public class InventoryFolderImpl : InventoryFolderBase
37 { 38 {
38 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40
41 public static readonly string PATH_DELIMITER = "/";
39 42
40 // Fields 43 /// <summary>
44 /// Items that are contained in this folder
45 /// </summary>
41 public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); 46 public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
47
48 /// <summary>
49 /// Child folders that are contained in this folder
50 /// </summary>
42 public Dictionary<LLUUID, InventoryFolderImpl> SubFolders = new Dictionary<LLUUID, InventoryFolderImpl>(); 51 public Dictionary<LLUUID, InventoryFolderImpl> SubFolders = new Dictionary<LLUUID, InventoryFolderImpl>();
43 52
44 // Accessors 53 /// <summary>
54 /// The number of child folders
55 /// </summary>
45 public int SubFoldersCount 56 public int SubFoldersCount
46 { 57 {
47 get { return SubFolders.Count; } 58 get { return SubFolders.Count; }
@@ -177,9 +188,7 @@ namespace OpenSim.Framework.Communications.Cache
177 public InventoryFolderImpl FindFolder(LLUUID folderID) 188 public InventoryFolderImpl FindFolder(LLUUID folderID)
178 { 189 {
179 if (folderID == ID) 190 if (folderID == ID)
180 {
181 return this; 191 return this;
182 }
183 192
184 lock (SubFolders) 193 lock (SubFolders)
185 { 194 {
@@ -188,14 +197,51 @@ namespace OpenSim.Framework.Communications.Cache
188 InventoryFolderImpl returnFolder = folder.FindFolder(folderID); 197 InventoryFolderImpl returnFolder = folder.FindFolder(folderID);
189 198
190 if (returnFolder != null) 199 if (returnFolder != null)
191 {
192 return returnFolder; 200 return returnFolder;
193 }
194 } 201 }
195 } 202 }
196 203
197 return null; 204 return null;
198 } 205 }
206
207 /// <summary>
208 /// Find a folder given a PATH_DELIMITOR delimited path.
209 ///
210 /// This method does not handle paths that contain multiple delimitors
211 ///
212 /// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
213 /// XPath like expression
214 ///
215 /// FIXME: Delimitors which occur in names themselves are not currently escapable.
216 /// </summary>
217 /// <param name="path">
218 /// The path to the required folder. It this is empty then this folder itself is returned.
219 /// If a folder for the given path is not found, then null is returned.
220 /// </param>
221 /// <returns></returns>
222 public InventoryFolderImpl FindFolderByPath(string path)
223 {
224 if (path == string.Empty)
225 return this;
226
227 int delimitorIndex = path.IndexOf(PATH_DELIMITER);
228 string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
229
230 lock (SubFolders)
231 {
232 foreach (InventoryFolderImpl folder in SubFolders.Values)
233 {
234 if (folder.Name == components[0])
235 if (components.Length > 1)
236 return folder.FindFolderByPath(components[1]);
237 else
238 return folder;
239 }
240 }
241
242 // We didn't find a folder with the given name
243 return null;
244 }
199 245
200 /// <summary> 246 /// <summary>
201 /// Return the list of child items in this folder 247 /// Return the list of child items in this folder
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 2b3ffd8..0d471d8 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -680,7 +680,7 @@ namespace OpenSim
680 680
681 string firstName = cmdparams[0]; 681 string firstName = cmdparams[0];
682 string lastName = cmdparams[1]; 682 string lastName = cmdparams[1];
683 //string invPath = cmdparams[2]; 683 string invPath = cmdparams[2];
684 //string savePath = (cmdparams.Length > 3 ? cmdparams[3] : DEFAULT_INV_BACKUP_FILENAME); 684 //string savePath = (cmdparams.Length > 3 ? cmdparams[3] : DEFAULT_INV_BACKUP_FILENAME);
685 685
686 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(firstName, lastName); 686 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(firstName, lastName);
@@ -695,7 +695,46 @@ namespace OpenSim
695 { 695 {
696 m_log.ErrorFormat("[CONSOLE]: Failed to find user info for {0} {1} {2}", firstName, lastName, userProfile.ID); 696 m_log.ErrorFormat("[CONSOLE]: Failed to find user info for {0} {1} {2}", firstName, lastName, userProfile.ID);
697 return; 697 return;
698 } 698 }
699
700 InventoryFolderImpl inventoryFolder = null;
701
702 if (userInfo.HasReceivedInventory)
703 {
704 if (invPath == InventoryFolderImpl.PATH_DELIMITER)
705 {
706 inventoryFolder = userInfo.RootFolder;
707 }
708 else
709 {
710 // Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl
711 // itself (possibly at a small loss in efficiency).
712 string[] components
713 = invPath.Split(new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
714 invPath = String.Empty;
715 foreach (string c in components)
716 {
717 invPath += c + InventoryFolderImpl.PATH_DELIMITER;
718 }
719
720 inventoryFolder = userInfo.RootFolder.FindFolderByPath(invPath);
721 }
722 }
723 else
724 {
725 m_log.ErrorFormat("[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", firstName, lastName, userProfile.ID);
726 return;
727 }
728
729 if (null == inventoryFolder)
730 {
731 m_log.ErrorFormat("[CONSOLE]: Could not find folder with path {0}", invPath);
732 return;
733 }
734 else
735 {
736 m_log.InfoFormat("[CONSOLE]: Found folder {0} {1} at {2}", inventoryFolder.Name, inventoryFolder.ID, invPath);
737 }
699 } 738 }
700 739
701 /// <summary> 740 /// <summary>