Fixed so Inventory structure is correct after a log out and re-login (in Sandbox accounts)

0.1-prestable
MW 2007-03-29 17:04:24 +00:00
parent 546d9dfdc5
commit f673b73471
4 changed files with 25 additions and 2 deletions

View File

@ -33,7 +33,7 @@ namespace OpenSim.Framework.Inventory
InventoryRoot = new InventoryFolder();
InventoryRoot.FolderID = LLUUID.Random();
InventoryRoot.ParentID = new LLUUID();
InventoryRoot.ParentID = LLUUID.Zero;
InventoryRoot.Version = 1;
InventoryRoot.DefaultType = 8;
InventoryRoot.OwnerID = this.AgentID;
@ -84,6 +84,7 @@ namespace OpenSim.Framework.Inventory
public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent)
{
Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
InventoryFolder Folder = new InventoryFolder();
Folder.FolderID = folderID;
Folder.OwnerID = this.AgentID;

View File

@ -287,9 +287,11 @@ namespace OpenSim.Framework.User
ClassifiedCategories.Add(ClassifiedCategoriesHash);
ArrayList AgentInventory = new ArrayList();
Console.WriteLine("adding inventory to response");
foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values)
{
Hashtable TempHash = new Hashtable();
Console.WriteLine("adding folder " + InvFolder.FolderName + ", ID: " + InvFolder.FolderID.ToStringHyphenated() + " with parent: " + InvFolder.ParentID.ToStringHyphenated());
TempHash["name"] = InvFolder.FolderName;
TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated();
TempHash["version"] = (Int32)InvFolder.Version;

View File

@ -112,6 +112,19 @@ namespace OpenSim.Assets
return res;
}
public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID, ushort type, string folderName, LLUUID parent)
{
bool res = false;
if (folderID != LLUUID.Zero) //don't create a folder with a zero id
{
if (this._agentsInventory.ContainsKey(remoteClient.AgentID))
{
res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type, folderName, parent);
}
}
return res;
}
public LLUUID AddNewInventoryItem(SimClient remoteClient, LLUUID folderID, OpenSim.Framework.Assets.AssetBase asset)
{
LLUUID newItem = null;

View File

@ -332,7 +332,7 @@ namespace OpenSim
break;
case PacketType.CreateInventoryFolder:
CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack;
m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type);
m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Helpers.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID);
Console.WriteLine(Pack.ToString());
break;
case PacketType.CreateInventoryItem:
@ -361,6 +361,7 @@ namespace OpenSim
AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID));
if (asset != null)
{
Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache");
m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset);
}
else
@ -368,8 +369,13 @@ namespace OpenSim
asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID);
if (asset != null)
{
Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache");
m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset);
}
else
{
Console.WriteLine("trying to update inventory item, but asset is null");
}
}
}
}
@ -712,6 +718,7 @@ namespace OpenSim
if (this.m_userServer != null)
{
// a user server is set so request the inventory from it
Console.WriteLine("getting inventory from user server");
inventory = m_inventoryCache.FetchAgentsInventory(this.AgentID, m_userServer);
}
else