From 0fe08c8799b1a3a2d5a07c206c2f9680d1c0798e Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 4 May 2014 13:36:36 +0300 Subject: - When sending the "My Suitcase" folder to the client, always claim it has Folder Type 8. (Previously we had used Folder Type -1 in one place, and LLClientView didn't even bother changing Folder Type 100 to anything else.) --- .../HypergridService/HGSuitcaseInventoryService.cs | 14 +++++++------- OpenSim/Services/InventoryService/XInventoryService.cs | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 8269d36..df797a5 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -156,9 +156,9 @@ namespace OpenSim.Services.HypergridService if (suitcase == null) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID); - // make one, and let's add it to the user's inventory as a direct child of the root folder - // In the DB we tag it as type 100, but we use -1 (Unknown) outside - suitcase = CreateFolder(principalID, root.folderID, 100, "My Suitcase"); + // Create the My Suitcase folder under the user's root folder. + // In the DB we tag it as type 100, but we use type 8 (Folder) outside, as this affects the sort order. + suitcase = CreateFolder(principalID, root.folderID, InventoryItemBase.SUITCASE_FOLDER_TYPE, InventoryItemBase.SUITCASE_FOLDER_NAME); if (suitcase == null) { m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); @@ -464,7 +464,7 @@ namespace OpenSim.Services.HypergridService // Warp! Root folder for travelers XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "agentID", "type" }, - new string[] { principalID.ToString(), "100" }); // This is a special folder type... + new string[] { principalID.ToString(), InventoryItemBase.SUITCASE_FOLDER_TYPE.ToString() }); // This is a special folder type... if (folders != null && folders.Length > 0) return folders[0]; @@ -472,13 +472,13 @@ namespace OpenSim.Services.HypergridService // check to see if we have the old Suitcase folder folders = m_Database.GetFolders( new string[] { "agentID", "folderName", "parentFolderID" }, - new string[] { principalID.ToString(), "My Suitcase", UUID.Zero.ToString() }); + new string[] { principalID.ToString(), InventoryItemBase.SUITCASE_FOLDER_NAME, UUID.Zero.ToString() }); if (folders != null && folders.Length > 0) { // Move it to under the root folder XInventoryFolder root = GetRootXFolder(principalID); folders[0].parentFolderID = root.folderID; - folders[0].type = 100; + folders[0].type = InventoryItemBase.SUITCASE_FOLDER_TYPE; m_Database.StoreFolder(folders[0]); return folders[0]; } @@ -488,7 +488,7 @@ namespace OpenSim.Services.HypergridService private void SetAsNormalFolder(XInventoryFolder suitcase) { - suitcase.type = (short)AssetType.Folder; + suitcase.type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; } private List GetFolderTree(UUID principalID, UUID folder) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 3bee433..7c16ca9 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -631,8 +631,8 @@ namespace OpenSim.Services.InventoryService newFolder.ParentID = folder.parentFolderID; newFolder.Type = (short)folder.type; // Viewer can't understand anything that's not in it's LLFolderType enum - if (newFolder.Type == 100) - newFolder.Type = -1; + if (newFolder.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) + newFolder.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; newFolder.Version = (ushort)folder.version; newFolder.Name = folder.folderName; newFolder.Owner = folder.agentID; -- cgit v1.1 From df49196e17bae9a1472085402094718ba6997b1e Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 5 May 2014 10:20:04 +0300 Subject: Log whenever an inventory operation is blocked because the item/folder isn't in the Suitcase --- .../HypergridService/HGSuitcaseInventoryService.cs | 60 +++++++++++++++++++--- 1 file changed, 52 insertions(+), 8 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index df797a5..3de2330 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -248,7 +248,10 @@ namespace OpenSim.Services.HypergridService InventoryCollection coll = null; if (!IsWithinSuitcaseTree(principalID, folderID)) + { + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetFolderContent: folder {0} is not within Suitcase tree", folderID); return new InventoryCollection(); + } coll = base.GetFolderContent(principalID, folderID); @@ -265,7 +268,10 @@ namespace OpenSim.Services.HypergridService // Let's do a bit of sanity checking, more than the base service does // 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); return new List(); + } return base.GetFolderItems(principalID, folderID); } @@ -277,7 +283,10 @@ namespace OpenSim.Services.HypergridService // make sure the given folder's parent folder exists under the suitcase tree of this user if (!IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) + { + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: AddFolder: folder {0} is not within Suitcase tree", folder.ParentID); return false; + } // OK, it's legit if (base.AddFolder(folder)) @@ -297,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]: folder {0} not within Suitcase tree", folder.Name); + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateFolder: folder {0}/{1} is not within Suitcase tree", folder.Name, folder.ID); return false; } @@ -307,9 +316,17 @@ namespace OpenSim.Services.HypergridService public override bool MoveFolder(InventoryFolderBase folder) { - if (!IsWithinSuitcaseTree(folder.Owner, folder.ID) || - !IsWithinSuitcaseTree(folder.Owner, folder.ParentID)) + if (!IsWithinSuitcaseTree(folder.Owner, folder.ID)) + { + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveFolder: folder {0} is not within Suitcase tree", folder.ID); 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); + return false; + } return base.MoveFolder(folder); } @@ -331,7 +348,10 @@ namespace OpenSim.Services.HypergridService // Let's do a bit of sanity checking, more than the base service does // 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); return false; + } // OK, it's legit return base.AddItem(item); @@ -341,7 +361,10 @@ namespace OpenSim.Services.HypergridService public override bool UpdateItem(InventoryItemBase item) { if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) + { + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: UpdateItem: folder {0} is not within Suitcase tree", item.Folder); return false; + } return base.UpdateItem(item); } @@ -350,11 +373,28 @@ namespace OpenSim.Services.HypergridService { // Principal is b0rked. *sigh* - if (!IsWithinSuitcaseTree(items[0].Owner, items[0].Folder)) - return false; + // Check the items' destination folders + foreach (InventoryItemBase item in items) + { + if (!IsWithinSuitcaseTree(item.Owner, item.Folder)) + { + m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} is not within Suitcase tree", item.Folder); + return false; + } + } - return base.MoveItems(principalID, items); + // Check the items' current folders + foreach (InventoryItemBase item in items) + { + 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); + return false; + } + } + return base.MoveItems(principalID, items); } public override bool DeleteItems(UUID principalID, List itemIDs) @@ -374,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} (folder {1}) is not within Suitcase", - it.Name, it.Folder); + 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); return null; } @@ -396,7 +436,11 @@ namespace OpenSim.Services.HypergridService if (f != null) { 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); return null; + } } return f; -- cgit v1.1