diff options
Fixed so Inventory structure is correct after a log out and re-login (in Sandbox accounts)
-rw-r--r-- | OpenSim.Framework/AgentInventory.cs | 3 | ||||
-rw-r--r-- | OpenSim.Framework/UserProfileManager.cs | 2 | ||||
-rw-r--r-- | OpenSim.RegionServer/Assets/InventoryCache.cs | 13 | ||||
-rw-r--r-- | OpenSim.RegionServer/SimClient.cs | 9 |
4 files changed, 25 insertions, 2 deletions
diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs index 1abf59a..8032455 100644 --- a/OpenSim.Framework/AgentInventory.cs +++ b/OpenSim.Framework/AgentInventory.cs | |||
@@ -33,7 +33,7 @@ namespace OpenSim.Framework.Inventory | |||
33 | 33 | ||
34 | InventoryRoot = new InventoryFolder(); | 34 | InventoryRoot = new InventoryFolder(); |
35 | InventoryRoot.FolderID = LLUUID.Random(); | 35 | InventoryRoot.FolderID = LLUUID.Random(); |
36 | InventoryRoot.ParentID = new LLUUID(); | 36 | InventoryRoot.ParentID = LLUUID.Zero; |
37 | InventoryRoot.Version = 1; | 37 | InventoryRoot.Version = 1; |
38 | InventoryRoot.DefaultType = 8; | 38 | InventoryRoot.DefaultType = 8; |
39 | InventoryRoot.OwnerID = this.AgentID; | 39 | InventoryRoot.OwnerID = this.AgentID; |
@@ -84,6 +84,7 @@ namespace OpenSim.Framework.Inventory | |||
84 | 84 | ||
85 | public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent) | 85 | public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parent) |
86 | { | 86 | { |
87 | Console.WriteLine("creating new folder called " + folderName + " in agents inventory"); | ||
87 | InventoryFolder Folder = new InventoryFolder(); | 88 | InventoryFolder Folder = new InventoryFolder(); |
88 | Folder.FolderID = folderID; | 89 | Folder.FolderID = folderID; |
89 | Folder.OwnerID = this.AgentID; | 90 | Folder.OwnerID = this.AgentID; |
diff --git a/OpenSim.Framework/UserProfileManager.cs b/OpenSim.Framework/UserProfileManager.cs index ef5ab71..2f99494 100644 --- a/OpenSim.Framework/UserProfileManager.cs +++ b/OpenSim.Framework/UserProfileManager.cs | |||
@@ -287,9 +287,11 @@ namespace OpenSim.Framework.User | |||
287 | ClassifiedCategories.Add(ClassifiedCategoriesHash); | 287 | ClassifiedCategories.Add(ClassifiedCategoriesHash); |
288 | 288 | ||
289 | ArrayList AgentInventory = new ArrayList(); | 289 | ArrayList AgentInventory = new ArrayList(); |
290 | Console.WriteLine("adding inventory to response"); | ||
290 | foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values) | 291 | foreach (InventoryFolder InvFolder in TheUser.Inventory.InventoryFolders.Values) |
291 | { | 292 | { |
292 | Hashtable TempHash = new Hashtable(); | 293 | Hashtable TempHash = new Hashtable(); |
294 | Console.WriteLine("adding folder " + InvFolder.FolderName + ", ID: " + InvFolder.FolderID.ToStringHyphenated() + " with parent: " + InvFolder.ParentID.ToStringHyphenated()); | ||
293 | TempHash["name"] = InvFolder.FolderName; | 295 | TempHash["name"] = InvFolder.FolderName; |
294 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); | 296 | TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); |
295 | TempHash["version"] = (Int32)InvFolder.Version; | 297 | TempHash["version"] = (Int32)InvFolder.Version; |
diff --git a/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim.RegionServer/Assets/InventoryCache.cs index 1090940..cc7cc29 100644 --- a/OpenSim.RegionServer/Assets/InventoryCache.cs +++ b/OpenSim.RegionServer/Assets/InventoryCache.cs | |||
@@ -112,6 +112,19 @@ namespace OpenSim.Assets | |||
112 | return res; | 112 | return res; |
113 | } | 113 | } |
114 | 114 | ||
115 | public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID, ushort type, string folderName, LLUUID parent) | ||
116 | { | ||
117 | bool res = false; | ||
118 | if (folderID != LLUUID.Zero) //don't create a folder with a zero id | ||
119 | { | ||
120 | if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) | ||
121 | { | ||
122 | res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type, folderName, parent); | ||
123 | } | ||
124 | } | ||
125 | return res; | ||
126 | } | ||
127 | |||
115 | public LLUUID AddNewInventoryItem(SimClient remoteClient, LLUUID folderID, OpenSim.Framework.Assets.AssetBase asset) | 128 | public LLUUID AddNewInventoryItem(SimClient remoteClient, LLUUID folderID, OpenSim.Framework.Assets.AssetBase asset) |
116 | { | 129 | { |
117 | LLUUID newItem = null; | 130 | LLUUID newItem = null; |
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index 6eb48fb..068e148 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs | |||
@@ -332,7 +332,7 @@ namespace OpenSim | |||
332 | break; | 332 | break; |
333 | case PacketType.CreateInventoryFolder: | 333 | case PacketType.CreateInventoryFolder: |
334 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; | 334 | CreateInventoryFolderPacket invFolder = (CreateInventoryFolderPacket)Pack; |
335 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type); | 335 | m_inventoryCache.CreateNewInventoryFolder(this, invFolder.FolderData.FolderID, (ushort)invFolder.FolderData.Type, Helpers.FieldToString(invFolder.FolderData.Name), invFolder.FolderData.ParentID); |
336 | Console.WriteLine(Pack.ToString()); | 336 | Console.WriteLine(Pack.ToString()); |
337 | break; | 337 | break; |
338 | case PacketType.CreateInventoryItem: | 338 | case PacketType.CreateInventoryItem: |
@@ -361,6 +361,7 @@ namespace OpenSim | |||
361 | AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); | 361 | AssetBase asset = m_assetCache.GetAsset(update.InventoryData[i].TransactionID.Combine(this.SecureSessionID)); |
362 | if (asset != null) | 362 | if (asset != null) |
363 | { | 363 | { |
364 | Console.WriteLine("updating inventory item, found asset" + asset.FullID.ToStringHyphenated() + " already in cache"); | ||
364 | m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); | 365 | m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); |
365 | } | 366 | } |
366 | else | 367 | else |
@@ -368,8 +369,13 @@ namespace OpenSim | |||
368 | asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); | 369 | asset = this.UploadAssets.AddUploadToAssetCache(update.InventoryData[i].TransactionID); |
369 | if (asset != null) | 370 | if (asset != null) |
370 | { | 371 | { |
372 | Console.WriteLine("updating inventory item, adding asset" + asset.FullID.ToStringHyphenated() + " to cache"); | ||
371 | m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); | 373 | m_inventoryCache.UpdateInventoryItem(this, update.InventoryData[i].ItemID, asset); |
372 | } | 374 | } |
375 | else | ||
376 | { | ||
377 | Console.WriteLine("trying to update inventory item, but asset is null"); | ||
378 | } | ||
373 | } | 379 | } |
374 | } | 380 | } |
375 | } | 381 | } |
@@ -712,6 +718,7 @@ namespace OpenSim | |||
712 | if (this.m_userServer != null) | 718 | if (this.m_userServer != null) |
713 | { | 719 | { |
714 | // a user server is set so request the inventory from it | 720 | // a user server is set so request the inventory from it |
721 | Console.WriteLine("getting inventory from user server"); | ||
715 | inventory = m_inventoryCache.FetchAgentsInventory(this.AgentID, m_userServer); | 722 | inventory = m_inventoryCache.FetchAgentsInventory(this.AgentID, m_userServer); |
716 | } | 723 | } |
717 | else | 724 | else |