- 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.)

0.8.0.3
Oren Hurvitz 2014-05-04 13:36:36 +03:00
parent 7862d1e20d
commit 0fe08c8799
4 changed files with 17 additions and 10 deletions

View File

@ -35,6 +35,10 @@ namespace OpenSim.Framework
/// </summary>
public class InventoryItemBase : InventoryNodeBase, ICloneable
{
public static readonly string SUITCASE_FOLDER_NAME = "My Suitcase";
public static readonly sbyte SUITCASE_FOLDER_TYPE = 100;
public static readonly sbyte SUITCASE_FOLDER_FAKE_TYPE = 8;
/// <value>
/// The inventory type of the item. This is slightly different from the asset type in some situations.
/// </value>

View File

@ -1761,6 +1761,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
newBlock.Name = Util.StringToBytes256(folder.Name);
newBlock.ParentID = folder.ParentID;
newBlock.Type = (sbyte)folder.Type;
if (newBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
newBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
return newBlock;
}
@ -2010,8 +2012,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
folderBlock.FolderID = folder.ID;
folderBlock.ParentID = folder.ParentID;
//folderBlock.Type = -1;
folderBlock.Type = (sbyte)folder.Type;
if (folderBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
folderBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
folderBlock.Name = Util.StringToBytes256(folder.Name);
return folderBlock;

View File

@ -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<XInventoryFolder> GetFolderTree(UUID principalID, UUID folder)

View File

@ -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;