From bf8f64e40eb0766de1f671bf05f985e422761ea8 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 12 May 2014 08:54:31 +0300 Subject: Fixed error if a user didn't have a "Current Outfit" folder in their suitcase. This fixes http://opensimulator.org/mantis/view.php?id=7161 --- .../HypergridService/HGSuitcaseInventoryService.cs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs') diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 3de2330..4416995 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -122,7 +122,7 @@ namespace OpenSim.Services.HypergridService } List tree = GetFolderTree(principalID, suitcase.folderID); - if (tree == null || (tree != null && tree.Count == 0)) + if (tree.Count == 0) return null; List folders = new List(); @@ -537,13 +537,13 @@ namespace OpenSim.Services.HypergridService private List GetFolderTree(UUID principalID, UUID folder) { - List t = null; + List t; if (m_SuitcaseTrees.TryGetValue(principalID, out t)) return t; // Get the tree of the suitcase folder t = GetFolderTreeRecursive(folder); - m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5minutes + m_SuitcaseTrees.AddOrUpdate(principalID, t, 5*60); // 5 minutes return t; } @@ -554,8 +554,10 @@ namespace OpenSim.Services.HypergridService new string[] { "parentFolderID" }, new string[] { root.ToString() }); - if (folders == null || (folders != null && folders.Length == 0)) + if (folders == null || folders.Length == 0) + { return tree; // empty tree + } else { foreach (XInventoryFolder f in folders) @@ -588,17 +590,18 @@ namespace OpenSim.Services.HypergridService List tree = new List(); tree.Add(suitcase); // Warp! the tree is the real root folder plus the children of the suitcase folder tree.AddRange(GetFolderTree(principalID, suitcase.folderID)); + // Also add the Current Outfit folder to the list of available folders - tree.Add(GetCurrentOutfitXFolder(principalID)); + XInventoryFolder folder = GetCurrentOutfitXFolder(principalID); + if (folder != null) + tree.Add(folder); XInventoryFolder f = tree.Find(delegate(XInventoryFolder fl) { - if (fl.folderID == folderID) return true; - else return false; + return (fl.folderID == folderID); }); - if (f == null) return false; - else return true; + return (f != null); } #endregion -- cgit v1.1 From 78733b979fa2f34ef0a0066fc019cb698239e9f5 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 18 May 2014 18:52:57 +0300 Subject: Log the user when an inventory operation is blocked because the item/folder isn't in the Suitcase --- .../HypergridService/HGSuitcaseInventoryService.cs | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs') diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 4416995..649e66c 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -249,7 +249,7 @@ namespace OpenSim.Services.HypergridService if (!IsWithinSuitcaseTree(principalID, folderID)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} is not within Suitcase tree", folderID); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} (user {1}) is not within Suitcase tree", folderID, principalID); return new InventoryCollection(); } @@ -269,7 +269,7 @@ namespace OpenSim.Services.HypergridService // make sure the given folder exists under the suitcase tree of this user if (!IsWithinSuitcaseTree(principalID, folderID)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderItems: folder {0} is not within Suitcase tree", folderID); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderItems: folder {0} (user {1}) is not within Suitcase tree", folderID, principalID); return new List(); } @@ -284,7 +284,7 @@ namespace OpenSim.Services.HypergridService if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} is not within Suitcase tree", folder.ParentID); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner); return false; } @@ -306,7 +306,7 @@ namespace OpenSim.Services.HypergridService //m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Update folder {0}, version {1}", folder.ID, folder.Version); if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} is not within Suitcase tree", folder.Name, folder.ID); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} (user {2}) is not within Suitcase tree", folder.Name, folder.ID, folder.Owner); return false; } @@ -318,13 +318,13 @@ namespace OpenSim.Services.HypergridService { if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ID); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ID, folder.Owner); return false; } if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ParentID); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} (user {1}) is not within Suitcase tree", folder.ParentID, folder.Owner); return false; } @@ -349,7 +349,7 @@ namespace OpenSim.Services.HypergridService // make sure the given folder's parent folder exists under the suitcase tree of this user if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem: folder {0} is not within Suitcase tree", item.Folder); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddItem: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); return false; } @@ -362,7 +362,7 @@ namespace OpenSim.Services.HypergridService { if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} is not within Suitcase tree", item.Folder); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); return false; } @@ -378,7 +378,7 @@ namespace OpenSim.Services.HypergridService { if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", item.Folder); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); return false; } } @@ -389,7 +389,7 @@ namespace OpenSim.Services.HypergridService InventoryItemBase originalItem = base.GetItem(item); if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", originalItem.Folder); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); return false; } } @@ -414,8 +414,8 @@ namespace OpenSim.Services.HypergridService if (!IsWithinSuitcaseTree(it.Owner, it.Folder) && !IsPartOfAppearance(it.Owner, it.ID)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Item {0}/{1} (folder {2}) is not within Suitcase tree or Appearance", - it.Name, it.ID, it.Folder); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetItem: item {0}/{1} (folder {2}) (user {3}) is not within Suitcase tree or Appearance", + it.Name, it.ID, it.Folder, it.Owner); return null; } @@ -437,8 +437,8 @@ namespace OpenSim.Services.HypergridService { if (!IsWithinSuitcaseTree(f.Owner, f.ID)) { - m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Folder {0}/{1} is not within Suitcase tree", - f.Name, f.ID); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolder: folder {0}/{1} (user {2}) is not within Suitcase tree", + f.Name, f.ID, f.Owner); return null; } } -- cgit v1.1 From 1fa3a6f1bd7c60c5e4226c0d84ee175e1ccb4476 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 22 May 2014 18:23:19 +0300 Subject: When creating a new user, create the folders "Current Outfit", "Favorites", and the standard subfolders of "Calling Cards". (If we don't create them now then they'll be created later by the viewer, but why wait.) --- .../Services/HypergridService/HGSuitcaseInventoryService.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs') diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 649e66c..d158537 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -164,8 +164,6 @@ namespace OpenSim.Services.HypergridService m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); return null; } - - m_Database.StoreFolder(suitcase); CreateSystemFolders(principalID, suitcase.folderID); } @@ -188,6 +186,10 @@ namespace OpenSim.Services.HypergridService CreateFolder(principalID, rootID, (int)AssetType.CallingCard, "Calling Cards"); if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) CreateFolder(principalID, rootID, (int)AssetType.Clothing, "Clothing"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; })) + CreateFolder(principalID, rootID, (int)AssetType.CurrentOutfitFolder, "Current Outfit"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; })) + CreateFolder(principalID, rootID, (int)AssetType.FavoriteFolder, "Favorites"); if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) CreateFolder(principalID, rootID, (int)AssetType.Gesture, "Gestures"); if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) @@ -208,11 +210,6 @@ namespace OpenSim.Services.HypergridService CreateFolder(principalID, rootID, (int)AssetType.Texture, "Textures"); if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; })) CreateFolder(principalID, rootID, (int)AssetType.TrashFolder, "Trash"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.FavoriteFolder, "Favorites"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.CurrentOutfitFolder, "Current Outfit"); - } public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) -- cgit v1.1