From f43681510725f5b95fcb864a1f3e4b744fcaf992 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 7 Apr 2008 23:15:35 +0000 Subject: [PATCH] Refactor InventoryItemBase to do the following: * wrap fields as Properties * rename some fields/properties to more sensible names * set style to PropName to match more standard C# approach --- OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 82 +++++----- OpenSim/Data/MySQL/MySQLInventoryData.cs | 52 +++---- .../NHibernate/NHibernateInventoryData.cs | 8 +- OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 60 ++++---- .../Communications/Cache/CachedUserInfo.cs | 14 +- .../Communications/Cache/LibraryRootFolder.cs | 60 ++++---- .../Communications/Capabilities/Caps.cs | 46 +++--- .../Communications/InventoryServiceBase.cs | 2 +- OpenSim/Framework/InventoryItemBase.cs | 145 ++++++++++++++++-- .../InventoryServer/GridInventoryService.cs | 12 +- OpenSim/Region/ClientStack/ClientView.cs | 106 ++++++------- .../Modules/AgentAssetTransactionModule.cs | 2 +- .../Modules/AgentAssetsTransactions.cs | 36 ++--- .../Environment/Scenes/Scene.Inventory.cs | 122 +++++++-------- .../Scenes/SceneObjectGroup.Inventory.cs | 16 +- .../AvatarFactory/AvatarFactoryModule.cs | 2 +- 16 files changed, 442 insertions(+), 323 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index df7020def8..15078aafbb 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs @@ -301,19 +301,19 @@ namespace OpenSim.Data.MSSQL { InventoryItemBase item = new InventoryItemBase(); - item.inventoryID = new LLUUID((string) reader["inventoryID"]); - item.assetID = new LLUUID((string) reader["assetID"]); - item.assetType = (int) reader["assetType"]; - item.parentFolderID = new LLUUID((string) reader["parentFolderID"]); - item.avatarID = new LLUUID((string) reader["avatarID"]); - item.inventoryName = (string) reader["inventoryName"]; - item.inventoryDescription = (string) reader["inventoryDescription"]; - item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]); - item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]); - item.invType = (int) reader["invType"]; - item.creatorsID = new LLUUID((string) reader["creatorID"]); - item.inventoryBasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); - item.inventoryEveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); + item.ID = new LLUUID((string) reader["inventoryID"]); + item.AssetID = new LLUUID((string) reader["assetID"]); + item.AssetType = (int) reader["assetType"]; + item.Folder = new LLUUID((string) reader["parentFolderID"]); + item.Owner = new LLUUID((string) reader["avatarID"]); + item.Name = (string) reader["inventoryName"]; + item.Description = (string) reader["inventoryDescription"]; + item.NextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]); + item.CurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]); + item.InvType = (int) reader["invType"]; + item.Creator = new LLUUID((string) reader["creatorID"]); + item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); + item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); return item; } catch (SqlException e) @@ -425,7 +425,7 @@ namespace OpenSim.Data.MSSQL /// The inventory item public void addInventoryItem(InventoryItemBase item) { - if (getInventoryItem(item.inventoryID) != null) + if (getInventoryItem(item.ID) != null) { updateInventoryItem(item); return; @@ -440,19 +440,19 @@ namespace OpenSim.Data.MSSQL try { Dictionary param = new Dictionary(); - param["inventoryID"] = item.inventoryID.ToString(); - param["assetID"] = item.assetID.ToString(); - param["assetType"] = item.assetType.ToString(); - param["parentFolderID"] = item.parentFolderID.ToString(); - param["avatarID"] = item.avatarID.ToString(); - param["inventoryName"] = item.inventoryName; - param["inventoryDescription"] = item.inventoryDescription; - param["inventoryNextPermissions"] = item.inventoryNextPermissions.ToString(); - param["inventoryCurrentPermissions"] = item.inventoryCurrentPermissions.ToString(); - param["invType"] = Convert.ToString(item.invType); - param["creatorID"] = item.creatorsID.ToString(); - param["inventoryBasePermissions"] = Convert.ToString(item.inventoryBasePermissions); - param["inventoryEveryOnePermissions"] = Convert.ToString(item.inventoryEveryOnePermissions); + param["inventoryID"] = item.ID.ToString(); + param["assetID"] = item.AssetID.ToString(); + param["assetType"] = item.AssetType.ToString(); + param["parentFolderID"] = item.Folder.ToString(); + param["avatarID"] = item.Owner.ToString(); + param["inventoryName"] = item.Name; + param["inventoryDescription"] = item.Description; + param["inventoryNextPermissions"] = item.NextPermissions.ToString(); + param["inventoryCurrentPermissions"] = item.CurrentPermissions.ToString(); + param["invType"] = Convert.ToString(item.InvType); + param["creatorID"] = item.Creator.ToString(); + param["inventoryBasePermissions"] = Convert.ToString(item.BasePermissions); + param["inventoryEveryOnePermissions"] = Convert.ToString(item.EveryOnePermissions); IDbCommand result = database.Query(sql, param); result.ExecuteNonQuery(); @@ -484,20 +484,20 @@ namespace OpenSim.Data.MSSQL "inventoryBasePermissions = @inventoryBasePermissions" + "inventoryEveryOnePermissions = @inventoryEveryOnePermissions) where " + "inventoryID = @keyInventoryID;", database.getConnection()); - SqlParameter param1 = new SqlParameter("@inventoryID", item.inventoryID.ToString()); - SqlParameter param2 = new SqlParameter("@assetID", item.assetID); - SqlParameter param3 = new SqlParameter("@assetType", item.assetType); - SqlParameter param4 = new SqlParameter("@parentFolderID", item.parentFolderID); - SqlParameter param5 = new SqlParameter("@avatarID", item.avatarID); - SqlParameter param6 = new SqlParameter("@inventoryName", item.inventoryName); - SqlParameter param7 = new SqlParameter("@inventoryDescription", item.inventoryDescription); - SqlParameter param8 = new SqlParameter("@inventoryNextPermissions", item.inventoryNextPermissions); - SqlParameter param9 = new SqlParameter("@inventoryCurrentPermissions", item.inventoryCurrentPermissions); - SqlParameter param10 = new SqlParameter("@invType", item.invType); - SqlParameter param11 = new SqlParameter("@creatorID", item.creatorsID); - SqlParameter param12 = new SqlParameter("@inventoryBasePermissions", item.inventoryBasePermissions); - SqlParameter param13 = new SqlParameter("@inventoryEveryOnePermissions", item.inventoryEveryOnePermissions); - SqlParameter param14 = new SqlParameter("@keyInventoryID", item.inventoryID.ToString()); + SqlParameter param1 = new SqlParameter("@inventoryID", item.ID.ToString()); + SqlParameter param2 = new SqlParameter("@assetID", item.AssetID); + SqlParameter param3 = new SqlParameter("@assetType", item.AssetType); + SqlParameter param4 = new SqlParameter("@parentFolderID", item.Folder); + SqlParameter param5 = new SqlParameter("@avatarID", item.Owner); + SqlParameter param6 = new SqlParameter("@inventoryName", item.Name); + SqlParameter param7 = new SqlParameter("@inventoryDescription", item.Description); + SqlParameter param8 = new SqlParameter("@inventoryNextPermissions", item.NextPermissions); + SqlParameter param9 = new SqlParameter("@inventoryCurrentPermissions", item.CurrentPermissions); + SqlParameter param10 = new SqlParameter("@invType", item.InvType); + SqlParameter param11 = new SqlParameter("@creatorID", item.Creator); + SqlParameter param12 = new SqlParameter("@inventoryBasePermissions", item.BasePermissions); + SqlParameter param13 = new SqlParameter("@inventoryEveryOnePermissions", item.EveryOnePermissions); + SqlParameter param14 = new SqlParameter("@keyInventoryID", item.ID.ToString()); command.Parameters.Add(param1); command.Parameters.Add(param2); command.Parameters.Add(param3); diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index ceb73c5b66..6bb7a53521 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs @@ -312,19 +312,19 @@ namespace OpenSim.Data.MySQL { InventoryItemBase item = new InventoryItemBase(); - item.inventoryID = new LLUUID((string) reader["inventoryID"]); - item.assetID = new LLUUID((string) reader["assetID"]); - item.assetType = (int) reader["assetType"]; - item.parentFolderID = new LLUUID((string) reader["parentFolderID"]); - item.avatarID = new LLUUID((string) reader["avatarID"]); - item.inventoryName = (string) reader["inventoryName"]; - item.inventoryDescription = (string) reader["inventoryDescription"]; - item.inventoryNextPermissions = (uint) reader["inventoryNextPermissions"]; - item.inventoryCurrentPermissions = (uint) reader["inventoryCurrentPermissions"]; - item.invType = (int) reader["invType"]; - item.creatorsID = new LLUUID((string) reader["creatorID"]); - item.inventoryBasePermissions = (uint) reader["inventoryBasePermissions"]; - item.inventoryEveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; + item.ID = new LLUUID((string) reader["inventoryID"]); + item.AssetID = new LLUUID((string) reader["assetID"]); + item.AssetType = (int) reader["assetType"]; + item.Folder = new LLUUID((string) reader["parentFolderID"]); + item.Owner = new LLUUID((string) reader["avatarID"]); + item.Name = (string) reader["inventoryName"]; + item.Description = (string) reader["inventoryDescription"]; + item.NextPermissions = (uint) reader["inventoryNextPermissions"]; + item.CurrentPermissions = (uint) reader["inventoryCurrentPermissions"]; + item.InvType = (int) reader["invType"]; + item.Creator = new LLUUID((string) reader["creatorID"]); + item.BasePermissions = (uint) reader["inventoryBasePermissions"]; + item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; return item; } catch (MySqlException e) @@ -444,20 +444,20 @@ namespace OpenSim.Data.MySQL try { MySqlCommand result = new MySqlCommand(sql, database.Connection); - result.Parameters.AddWithValue("?inventoryID", item.inventoryID.ToString()); - result.Parameters.AddWithValue("?assetID", item.assetID.ToString()); - result.Parameters.AddWithValue("?assetType", item.assetType.ToString()); - result.Parameters.AddWithValue("?parentFolderID", item.parentFolderID.ToString()); - result.Parameters.AddWithValue("?avatarID", item.avatarID.ToString()); - result.Parameters.AddWithValue("?inventoryName", item.inventoryName); - result.Parameters.AddWithValue("?inventoryDescription", item.inventoryDescription); - result.Parameters.AddWithValue("?inventoryNextPermissions", item.inventoryNextPermissions.ToString()); + result.Parameters.AddWithValue("?inventoryID", item.ID.ToString()); + result.Parameters.AddWithValue("?assetID", item.AssetID.ToString()); + result.Parameters.AddWithValue("?assetType", item.AssetType.ToString()); + result.Parameters.AddWithValue("?parentFolderID", item.Folder.ToString()); + result.Parameters.AddWithValue("?avatarID", item.Owner.ToString()); + result.Parameters.AddWithValue("?inventoryName", item.Name); + result.Parameters.AddWithValue("?inventoryDescription", item.Description); + result.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions.ToString()); result.Parameters.AddWithValue("?inventoryCurrentPermissions", - item.inventoryCurrentPermissions.ToString()); - result.Parameters.AddWithValue("?invType", item.invType); - result.Parameters.AddWithValue("?creatorID", item.creatorsID.ToString()); - result.Parameters.AddWithValue("?inventoryBasePermissions", item.inventoryBasePermissions); - result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.inventoryEveryOnePermissions); + item.CurrentPermissions.ToString()); + result.Parameters.AddWithValue("?invType", item.InvType); + result.Parameters.AddWithValue("?creatorID", item.Creator.ToString()); + result.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions); + result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); result.ExecuteNonQuery(); result.Dispose(); } diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs index d6cd664501..ba1d3e98f0 100644 --- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs +++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs @@ -112,7 +112,7 @@ namespace OpenSim.Data.NHibernate /// The item to be created public void addInventoryItem(InventoryItemBase item) { - if (!ExistsItem(item.inventoryID)) { + if (!ExistsItem(item.ID)) { using(ISession session = factory.OpenSession()) { using(ITransaction transaction = session.BeginTransaction()) { session.Save(item); @@ -120,7 +120,7 @@ namespace OpenSim.Data.NHibernate } } } else { - m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists, updating instead", item.inventoryID); + m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists, updating instead", item.ID); updateInventoryItem(item); } } @@ -131,7 +131,7 @@ namespace OpenSim.Data.NHibernate /// The updated item public void updateInventoryItem(InventoryItemBase item) { - if (ExistsItem(item.inventoryID)) { + if (ExistsItem(item.ID)) { using(ISession session = factory.OpenSession()) { using(ITransaction transaction = session.BeginTransaction()) { session.Update(item); @@ -139,7 +139,7 @@ namespace OpenSim.Data.NHibernate } } } else { - m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists", item.inventoryID); + m_log.ErrorFormat("Attempted to add Inventory Item {0} that already exists", item.ID); } } diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 1554aa338e..f0ff7c9a67 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -91,39 +91,39 @@ namespace OpenSim.Data.SQLite public InventoryItemBase buildItem(DataRow row) { InventoryItemBase item = new InventoryItemBase(); - item.inventoryID = new LLUUID((string) row["UUID"]); - item.assetID = new LLUUID((string) row["assetID"]); - item.assetType = Convert.ToInt32(row["assetType"]); - item.invType = Convert.ToInt32(row["invType"]); - item.parentFolderID = new LLUUID((string) row["parentFolderID"]); - item.avatarID = new LLUUID((string) row["avatarID"]); - item.creatorsID = new LLUUID((string) row["creatorsID"]); - item.inventoryName = (string) row["inventoryName"]; - item.inventoryDescription = (string) row["inventoryDescription"]; + item.ID = new LLUUID((string) row["UUID"]); + item.AssetID = new LLUUID((string) row["assetID"]); + item.AssetType = Convert.ToInt32(row["assetType"]); + item.InvType = Convert.ToInt32(row["invType"]); + item.Folder = new LLUUID((string) row["parentFolderID"]); + item.Owner = new LLUUID((string) row["avatarID"]); + item.Creator = new LLUUID((string) row["creatorsID"]); + item.Name = (string) row["inventoryName"]; + item.Description = (string) row["inventoryDescription"]; - item.inventoryNextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]); - item.inventoryCurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]); - item.inventoryBasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]); - item.inventoryEveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]); + item.NextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]); + item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]); + item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]); + item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]); return item; } private void fillItemRow(DataRow row, InventoryItemBase item) { - row["UUID"] = Util.ToRawUuidString(item.inventoryID); - row["assetID"] = Util.ToRawUuidString(item.assetID); - row["assetType"] = item.assetType; - row["invType"] = item.invType; - row["parentFolderID"] = Util.ToRawUuidString(item.parentFolderID); - row["avatarID"] = Util.ToRawUuidString(item.avatarID); - row["creatorsID"] = Util.ToRawUuidString(item.creatorsID); - row["inventoryName"] = item.inventoryName; - row["inventoryDescription"] = item.inventoryDescription; + row["UUID"] = Util.ToRawUuidString(item.ID); + row["assetID"] = Util.ToRawUuidString(item.AssetID); + row["assetType"] = item.AssetType; + row["invType"] = item.InvType; + row["parentFolderID"] = Util.ToRawUuidString(item.Folder); + row["avatarID"] = Util.ToRawUuidString(item.Owner); + row["creatorsID"] = Util.ToRawUuidString(item.Creator); + row["inventoryName"] = item.Name; + row["inventoryDescription"] = item.Description; - row["inventoryNextPermissions"] = item.inventoryNextPermissions; - row["inventoryCurrentPermissions"] = item.inventoryCurrentPermissions; - row["inventoryBasePermissions"] = item.inventoryBasePermissions; - row["inventoryEveryOnePermissions"] = item.inventoryEveryOnePermissions; + row["inventoryNextPermissions"] = item.NextPermissions; + row["inventoryCurrentPermissions"] = item.CurrentPermissions; + row["inventoryBasePermissions"] = item.BasePermissions; + row["inventoryEveryOnePermissions"] = item.EveryOnePermissions; } private void addFolder(InventoryFolderBase folder, bool add) @@ -182,11 +182,11 @@ namespace OpenSim.Data.SQLite { DataTable inventoryItemTable = ds.Tables["inventoryitems"]; - DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(item.inventoryID)); + DataRow inventoryRow = inventoryItemTable.Rows.Find(Util.ToRawUuidString(item.ID)); if (inventoryRow == null) { if (! add) - m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.inventoryID); + m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.ID); inventoryRow = inventoryItemTable.NewRow(); fillItemRow(inventoryRow, item); @@ -195,7 +195,7 @@ namespace OpenSim.Data.SQLite else { if (add) - m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.inventoryID); + m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.ID); fillItemRow(inventoryRow, item); } @@ -439,7 +439,7 @@ namespace OpenSim.Data.SQLite List items = getInventoryInFolder(Util.ToRawUuidString(folderId)); foreach (InventoryItemBase i in items) - deleteInventoryItem(Util.ToRawUuidString(i.inventoryID)); + deleteInventoryItem(Util.ToRawUuidString(i.ID)); } /// diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index f2dd2bf5b2..cb1eb5a96f 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -171,21 +171,21 @@ namespace OpenSim.Framework.Communications.Cache { if ((userID == UserProfile.UUID) && (RootFolder != null)) { - if (itemInfo.parentFolderID == RootFolder.folderID) + if (itemInfo.Folder == RootFolder.folderID) { - if (!RootFolder.Items.ContainsKey(itemInfo.inventoryID)) + if (!RootFolder.Items.ContainsKey(itemInfo.ID)) { - RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); + RootFolder.Items.Add(itemInfo.ID, itemInfo); } } else { - InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.parentFolderID); + InventoryFolderImpl folder = RootFolder.HasSubFolder(itemInfo.Folder); if (folder != null) { - if (!folder.Items.ContainsKey(itemInfo.inventoryID)) + if (!folder.Items.ContainsKey(itemInfo.ID)) { - folder.Items.Add(itemInfo.inventoryID, itemInfo); + folder.Items.Add(itemInfo.ID, itemInfo); } } } @@ -214,7 +214,7 @@ namespace OpenSim.Framework.Communications.Cache bool result = false; if ((userID == UserProfile.UUID) && (RootFolder != null)) { - result = RootFolder.DeleteItem(item.inventoryID); + result = RootFolder.DeleteItem(item.ID); if (result) { m_parentCommsManager.InventoryService.DeleteInventoryItem(userID, item); diff --git a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs index b624b15a97..12a07ebb56 100644 --- a/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs +++ b/OpenSim/Framework/Communications/Cache/LibraryRootFolder.cs @@ -116,19 +116,19 @@ namespace OpenSim.Framework.Communications.Cache int assetType, int invType, LLUUID parentFolderID) { InventoryItemBase item = new InventoryItemBase(); - item.avatarID = libOwner; - item.creatorsID = libOwner; - item.inventoryID = inventoryID; - item.assetID = assetID; - item.inventoryDescription = description; - item.inventoryName = name; - item.assetType = assetType; - item.invType = invType; - item.parentFolderID = parentFolderID; - item.inventoryBasePermissions = 0x7FFFFFFF; - item.inventoryEveryOnePermissions = 0x7FFFFFFF; - item.inventoryCurrentPermissions = 0x7FFFFFFF; - item.inventoryNextPermissions = 0x7FFFFFFF; + item.Owner = libOwner; + item.Creator = libOwner; + item.ID = inventoryID; + item.AssetID = assetID; + item.Description = description; + item.Name = name; + item.AssetType = assetType; + item.InvType = invType; + item.Folder = parentFolderID; + item.BasePermissions = 0x7FFFFFFF; + item.EveryOnePermissions = 0x7FFFFFFF; + item.CurrentPermissions = 0x7FFFFFFF; + item.NextPermissions = 0x7FFFFFFF; return item; } @@ -204,31 +204,31 @@ namespace OpenSim.Framework.Communications.Cache private void ReadItemFromConfig(IConfig config) { InventoryItemBase item = new InventoryItemBase(); - item.avatarID = libOwner; - item.creatorsID = libOwner; - item.inventoryID = new LLUUID(config.GetString("inventoryID", folderID.ToString())); - item.assetID = new LLUUID(config.GetString("assetID", LLUUID.Random().ToString())); - item.parentFolderID = new LLUUID(config.GetString("folderID", folderID.ToString())); - item.inventoryDescription = config.GetString("description", System.String.Empty); - item.inventoryName = config.GetString("name", System.String.Empty); - item.assetType = config.GetInt("assetType", 0); - item.invType = config.GetInt("inventoryType", 0); - item.inventoryCurrentPermissions = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF); - item.inventoryNextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); - item.inventoryEveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); - item.inventoryBasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); + item.Owner = libOwner; + item.Creator = libOwner; + item.ID = new LLUUID(config.GetString("inventoryID", folderID.ToString())); + item.AssetID = new LLUUID(config.GetString("assetID", LLUUID.Random().ToString())); + item.Folder = new LLUUID(config.GetString("folderID", folderID.ToString())); + item.Description = config.GetString("description", System.String.Empty); + item.Name = config.GetString("name", System.String.Empty); + item.AssetType = config.GetInt("assetType", 0); + item.InvType = config.GetInt("inventoryType", 0); + item.CurrentPermissions = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF); + item.NextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); + item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); + item.BasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); - if (libraryFolders.ContainsKey(item.parentFolderID)) + if (libraryFolders.ContainsKey(item.Folder)) { - InventoryFolderImpl parentFolder = libraryFolders[item.parentFolderID]; + InventoryFolderImpl parentFolder = libraryFolders[item.Folder]; - parentFolder.Items.Add(item.inventoryID, item); + parentFolder.Items.Add(item.ID, item); } else { m_log.WarnFormat( "[LIBRARY INVENTORY]: Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!", - item.inventoryName, item.inventoryID, item.parentFolderID); + item.Name, item.ID, item.Folder); } } diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 00de14da2e..315daabe57 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -294,14 +294,14 @@ namespace OpenSim.Region.Capabilities private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem) { LLSDInventoryItem llsdItem = new LLSDInventoryItem(); - llsdItem.asset_id = invItem.assetID; + llsdItem.asset_id = invItem.AssetID; llsdItem.created_at = 1000; - llsdItem.desc = invItem.inventoryDescription; + llsdItem.desc = invItem.Description; llsdItem.flags = 0; - llsdItem.item_id = invItem.inventoryID; - llsdItem.name = invItem.inventoryName; - llsdItem.parent_id = invItem.parentFolderID; - llsdItem.type = Enum.GetName(typeof(AssetType), invItem.assetType).ToLower(); + llsdItem.item_id = invItem.ID; + llsdItem.name = invItem.Name; + llsdItem.parent_id = invItem.Folder; + llsdItem.type = Enum.GetName(typeof(AssetType), invItem.AssetType).ToLower(); // XXX Temporary fix for 'objects not appearing in inventory' problem. The asset type from libsecondlife is // returning "primitive" when it should returning "object"! It looks like this is fixed in the latest libsecondlife, @@ -311,17 +311,17 @@ namespace OpenSim.Region.Capabilities llsdItem.type = "object"; } - llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.invType).ToLower(); + llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.InvType).ToLower(); llsdItem.permissions = new LLSDPermissions(); - llsdItem.permissions.creator_id = invItem.creatorsID; - llsdItem.permissions.base_mask = (int)invItem.inventoryCurrentPermissions; - llsdItem.permissions.everyone_mask = (int)invItem.inventoryEveryOnePermissions; + llsdItem.permissions.creator_id = invItem.Creator; + llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; + llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; llsdItem.permissions.group_id = LLUUID.Zero; llsdItem.permissions.group_mask = 0; llsdItem.permissions.is_owner_group = false; - llsdItem.permissions.next_owner_mask = (int)invItem.inventoryNextPermissions; + llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; llsdItem.permissions.owner_id = m_agentID; // FixMe - llsdItem.permissions.owner_mask = (int)invItem.inventoryCurrentPermissions; + llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; llsdItem.sale_info = new LLSDSaleInfo(); llsdItem.sale_info.sale_price = 10; llsdItem.sale_info.sale_type = "not"; @@ -587,17 +587,17 @@ namespace OpenSim.Region.Capabilities m_assetCache.AddAsset(asset); InventoryItemBase item = new InventoryItemBase(); - item.avatarID = m_agentID; - item.creatorsID = m_agentID; - item.inventoryID = inventoryItem; - item.assetID = asset.FullID; - item.inventoryDescription = assetDescription; - item.inventoryName = assetName; - item.assetType = assType; - item.invType = inType; - item.parentFolderID = parentFolder; - item.inventoryCurrentPermissions = 2147483647; - item.inventoryNextPermissions = 2147483647; + item.Owner = m_agentID; + item.Creator = m_agentID; + item.ID = inventoryItem; + item.AssetID = asset.FullID; + item.Description = assetDescription; + item.Name = assetName; + item.AssetType = assType; + item.InvType = inType; + item.Folder = parentFolder; + item.CurrentPermissions = 2147483647; + item.NextPermissions = 2147483647; if (AddNewInventoryItem != null) { diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index feb0ccad7c..f41bd27cee 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -218,7 +218,7 @@ namespace OpenSim.Framework.Communications { foreach (KeyValuePair plugin in m_plugins) { - plugin.Value.deleteInventoryItem(item.inventoryID); + plugin.Value.deleteInventoryItem(item.ID); } } diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index 7d146e75c9..03b47cadce 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -40,66 +40,185 @@ namespace OpenSim.Framework /// /// A UUID containing the ID for the inventory item itself /// - public LLUUID inventoryID; + private LLUUID _id; /// /// The UUID of the associated asset on the asset server /// - public LLUUID assetID; + private LLUUID _assetID; /// /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) /// - public int assetType; + private int _assetType; /// /// The type of inventory item. (Can be slightly different to the asset type /// - public int invType; + private int _invType; /// /// The folder this item is contained in /// - public LLUUID parentFolderID; + private LLUUID _folder; /// /// The owner of this inventory item /// - public LLUUID avatarID; + private LLUUID _owner; /// /// The creator of this item /// - public LLUUID creatorsID; + private LLUUID _creator; /// /// The name of the inventory item (must be less than 64 characters) /// - public string inventoryName; + private string _name; /// /// The description of the inventory item (must be less than 64 characters) /// - public string inventoryDescription; + private string _description; /// /// A mask containing the permissions for the next owner (cannot be enforced) /// - public uint inventoryNextPermissions; + private uint _nextPermissions; /// /// A mask containing permissions for the current owner (cannot be enforced) /// - public uint inventoryCurrentPermissions; + private uint _currentPermissions; /// /// /// - public uint inventoryBasePermissions; + private uint _basePermissions; /// /// /// - public uint inventoryEveryOnePermissions; + private uint _everyOnePermissions; + + public LLUUID ID { + get { + return _id; + } + set { + _id = value; + } + } + + + + public int InvType { + get { + return _invType; + } + set { + _invType = value; + } + } + + public LLUUID Folder { + get { + return _folder; + } + set { + _folder = value; + } + } + + public LLUUID Owner { + get { + return _owner; + } + set { + _owner = value; + } + } + + public LLUUID Creator { + get { + return _creator; + } + set { + _creator = value; + } + } + + public string Name { + get { + return _name; + } + set { + _name = value; + } + } + + public string Description { + get { + return _description; + } + set { + _description = value; + } + } + + public uint NextPermissions { + get { + return _nextPermissions; + } + set { + _nextPermissions = value; + } + } + + public uint CurrentPermissions { + get { + return _currentPermissions; + } + set { + _currentPermissions = value; + } + } + + public uint BasePermissions { + get { + return _basePermissions; + } + set { + _basePermissions = value; + } + } + + public uint EveryOnePermissions { + get { + return _everyOnePermissions; + } + set { + _everyOnePermissions = value; + } + } + + public int AssetType { + get { + return _assetType; + } + set { + _assetType = value; + } + } + + public LLUUID AssetID { + get { + return _assetID; + } + set { + _assetID = value; + } + } } } diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index 681e8bb35a..92d82aba0c 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -189,10 +189,10 @@ namespace OpenSim.Grid.InventoryServer // Right now, this actions act more like an update/insert combination than a simple create. m_log.Info( "[AGENT INVENTORY]: " + - "Updating in " + item.parentFolderID.ToString() - + ", item " + item.inventoryName); + "Updating in " + item.Folder.ToString() + + ", item " + item.Name); - AddNewInventoryItem(item.avatarID, item); + AddNewInventoryItem(item.Owner, item); return true; } @@ -201,15 +201,15 @@ namespace OpenSim.Grid.InventoryServer // extra spaces to align with other inventory messages m_log.Info( "[AGENT INVENTORY]: " + - "Deleting in " + item.parentFolderID.ToString() - + ", item " + item.inventoryName); + "Deleting in " + item.Folder.ToString() + + ", item " + item.Name); DeleteItem(item); } public bool DeleteInvItem(InventoryItemBase item) { - DeleteInventoryItem(item.avatarID, item); + DeleteInventoryItem(item.Owner, item); return true; } } diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 6af32a9281..4325b93754 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -1219,25 +1219,25 @@ namespace OpenSim.Region.ClientStack foreach (InventoryItemBase item in items) { descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); - descend.ItemData[i].ItemID = item.inventoryID; - descend.ItemData[i].AssetID = item.assetID; - descend.ItemData[i].CreatorID = item.creatorsID; - descend.ItemData[i].BaseMask = item.inventoryBasePermissions; + descend.ItemData[i].ItemID = item.ID; + descend.ItemData[i].AssetID = item.AssetID; + descend.ItemData[i].CreatorID = item.Creator; + descend.ItemData[i].BaseMask = item.BasePermissions; descend.ItemData[i].CreationDate = 1000; - descend.ItemData[i].Description = Helpers.StringToField(item.inventoryDescription); - descend.ItemData[i].EveryoneMask = item.inventoryEveryOnePermissions; + descend.ItemData[i].Description = Helpers.StringToField(item.Description); + descend.ItemData[i].EveryoneMask = item.EveryOnePermissions; descend.ItemData[i].Flags = 1; - descend.ItemData[i].FolderID = item.parentFolderID; + descend.ItemData[i].FolderID = item.Folder; descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); descend.ItemData[i].GroupMask = 0; - descend.ItemData[i].InvType = (sbyte) item.invType; - descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName); - descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; - descend.ItemData[i].OwnerID = item.avatarID; - descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; + descend.ItemData[i].InvType = (sbyte) item.InvType; + descend.ItemData[i].Name = Helpers.StringToField(item.Name); + descend.ItemData[i].NextOwnerMask = item.NextPermissions; + descend.ItemData[i].OwnerID = item.Owner; + descend.ItemData[i].OwnerMask = item.CurrentPermissions; descend.ItemData[i].SalePrice = 0; descend.ItemData[i].SaleType = 0; - descend.ItemData[i].Type = (sbyte) item.assetType; + descend.ItemData[i].Type = (sbyte) item.AssetType; descend.ItemData[i].CRC = Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, descend.ItemData[i].InvType, descend.ItemData[i].Type, @@ -1247,7 +1247,7 @@ namespace OpenSim.Region.ClientStack descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, descend.ItemData[i].EveryoneMask, descend.ItemData[i].Flags, descend.ItemData[i].OwnerMask, - descend.ItemData[i].GroupMask, item.inventoryCurrentPermissions); + descend.ItemData[i].GroupMask, item.CurrentPermissions); i++; count++; @@ -1364,26 +1364,26 @@ namespace OpenSim.Region.ClientStack inventoryReply.AgentData.AgentID = AgentId; inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); - inventoryReply.InventoryData[0].ItemID = item.inventoryID; - inventoryReply.InventoryData[0].AssetID = item.assetID; - inventoryReply.InventoryData[0].CreatorID = item.creatorsID; - inventoryReply.InventoryData[0].BaseMask = item.inventoryBasePermissions; + inventoryReply.InventoryData[0].ItemID = item.ID; + inventoryReply.InventoryData[0].AssetID = item.AssetID; + inventoryReply.InventoryData[0].CreatorID = item.Creator; + inventoryReply.InventoryData[0].BaseMask = item.BasePermissions; inventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; - inventoryReply.InventoryData[0].Description = Helpers.StringToField(item.inventoryDescription); - inventoryReply.InventoryData[0].EveryoneMask = item.inventoryEveryOnePermissions; + inventoryReply.InventoryData[0].Description = Helpers.StringToField(item.Description); + inventoryReply.InventoryData[0].EveryoneMask = item.EveryOnePermissions; inventoryReply.InventoryData[0].Flags = 0; - inventoryReply.InventoryData[0].FolderID = item.parentFolderID; + inventoryReply.InventoryData[0].FolderID = item.Folder; inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); inventoryReply.InventoryData[0].GroupMask = 0; - inventoryReply.InventoryData[0].InvType = (sbyte)item.invType; - inventoryReply.InventoryData[0].Name = Helpers.StringToField(item.inventoryName); - inventoryReply.InventoryData[0].NextOwnerMask = item.inventoryNextPermissions; - inventoryReply.InventoryData[0].OwnerID = item.avatarID; - inventoryReply.InventoryData[0].OwnerMask = item.inventoryCurrentPermissions; + inventoryReply.InventoryData[0].InvType = (sbyte)item.InvType; + inventoryReply.InventoryData[0].Name = Helpers.StringToField(item.Name); + inventoryReply.InventoryData[0].NextOwnerMask = item.NextPermissions; + inventoryReply.InventoryData[0].OwnerID = item.Owner; + inventoryReply.InventoryData[0].OwnerMask = item.CurrentPermissions; inventoryReply.InventoryData[0].SalePrice = 0; inventoryReply.InventoryData[0].SaleType = 0; - inventoryReply.InventoryData[0].Type = (sbyte)item.assetType; + inventoryReply.InventoryData[0].Type = (sbyte)item.AssetType; inventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, @@ -1416,25 +1416,25 @@ namespace OpenSim.Region.ClientStack bulkUpdate.ItemData = new BulkUpdateInventoryPacket.ItemDataBlock[1]; bulkUpdate.ItemData[0] = new BulkUpdateInventoryPacket.ItemDataBlock(); - bulkUpdate.ItemData[0].ItemID = item.inventoryID; - bulkUpdate.ItemData[0].AssetID = item.assetID; - bulkUpdate.ItemData[0].CreatorID = item.creatorsID; - bulkUpdate.ItemData[0].BaseMask = item.inventoryBasePermissions; + bulkUpdate.ItemData[0].ItemID = item.ID; + bulkUpdate.ItemData[0].AssetID = item.AssetID; + bulkUpdate.ItemData[0].CreatorID = item.Creator; + bulkUpdate.ItemData[0].BaseMask = item.BasePermissions; bulkUpdate.ItemData[0].CreationDate = 1000; - bulkUpdate.ItemData[0].Description = Helpers.StringToField(item.inventoryDescription); - bulkUpdate.ItemData[0].EveryoneMask = item.inventoryEveryOnePermissions; + bulkUpdate.ItemData[0].Description = Helpers.StringToField(item.Description); + bulkUpdate.ItemData[0].EveryoneMask = item.EveryOnePermissions; bulkUpdate.ItemData[0].Flags = 0; - bulkUpdate.ItemData[0].FolderID = item.parentFolderID; + bulkUpdate.ItemData[0].FolderID = item.Folder; bulkUpdate.ItemData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); bulkUpdate.ItemData[0].GroupMask = 0; - bulkUpdate.ItemData[0].InvType = (sbyte)item.invType; - bulkUpdate.ItemData[0].Name = Helpers.StringToField(item.inventoryName); - bulkUpdate.ItemData[0].NextOwnerMask = item.inventoryNextPermissions; - bulkUpdate.ItemData[0].OwnerID = item.avatarID; - bulkUpdate.ItemData[0].OwnerMask = item.inventoryCurrentPermissions; + bulkUpdate.ItemData[0].InvType = (sbyte)item.InvType; + bulkUpdate.ItemData[0].Name = Helpers.StringToField(item.Name); + bulkUpdate.ItemData[0].NextOwnerMask = item.NextPermissions; + bulkUpdate.ItemData[0].OwnerID = item.Owner; + bulkUpdate.ItemData[0].OwnerMask = item.CurrentPermissions; bulkUpdate.ItemData[0].SalePrice = 100; bulkUpdate.ItemData[0].SaleType = 0; - bulkUpdate.ItemData[0].Type = (sbyte)item.assetType; + bulkUpdate.ItemData[0].Type = (sbyte)item.AssetType; bulkUpdate.ItemData[0].CRC = Helpers.InventoryCRC(1000, 0, bulkUpdate.ItemData[0].InvType, bulkUpdate.ItemData[0].Type, bulkUpdate.ItemData[0].AssetID, @@ -1461,25 +1461,25 @@ namespace OpenSim.Region.ClientStack InventoryReply.AgentData.SimApproved = true; InventoryReply.InventoryData = new UpdateCreateInventoryItemPacket.InventoryDataBlock[1]; InventoryReply.InventoryData[0] = new UpdateCreateInventoryItemPacket.InventoryDataBlock(); - InventoryReply.InventoryData[0].ItemID = Item.inventoryID; - InventoryReply.InventoryData[0].AssetID = Item.assetID; - InventoryReply.InventoryData[0].CreatorID = Item.creatorsID; - InventoryReply.InventoryData[0].BaseMask = Item.inventoryBasePermissions; + InventoryReply.InventoryData[0].ItemID = Item.ID; + InventoryReply.InventoryData[0].AssetID = Item.AssetID; + InventoryReply.InventoryData[0].CreatorID = Item.Creator; + InventoryReply.InventoryData[0].BaseMask = Item.BasePermissions; InventoryReply.InventoryData[0].CreationDate = 1000; - InventoryReply.InventoryData[0].Description = Helpers.StringToField(Item.inventoryDescription); - InventoryReply.InventoryData[0].EveryoneMask = Item.inventoryEveryOnePermissions; + InventoryReply.InventoryData[0].Description = Helpers.StringToField(Item.Description); + InventoryReply.InventoryData[0].EveryoneMask = Item.EveryOnePermissions; InventoryReply.InventoryData[0].Flags = 0; - InventoryReply.InventoryData[0].FolderID = Item.parentFolderID; + InventoryReply.InventoryData[0].FolderID = Item.Folder; InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); InventoryReply.InventoryData[0].GroupMask = 0; - InventoryReply.InventoryData[0].InvType = (sbyte)Item.invType; - InventoryReply.InventoryData[0].Name = Helpers.StringToField(Item.inventoryName); - InventoryReply.InventoryData[0].NextOwnerMask = Item.inventoryNextPermissions; - InventoryReply.InventoryData[0].OwnerID = Item.avatarID; - InventoryReply.InventoryData[0].OwnerMask = Item.inventoryCurrentPermissions; + InventoryReply.InventoryData[0].InvType = (sbyte)Item.InvType; + InventoryReply.InventoryData[0].Name = Helpers.StringToField(Item.Name); + InventoryReply.InventoryData[0].NextOwnerMask = Item.NextPermissions; + InventoryReply.InventoryData[0].OwnerID = Item.Owner; + InventoryReply.InventoryData[0].OwnerMask = Item.CurrentPermissions; InventoryReply.InventoryData[0].SalePrice = 100; InventoryReply.InventoryData[0].SaleType = 0; - InventoryReply.InventoryData[0].Type = (sbyte)Item.assetType; + InventoryReply.InventoryData[0].Type = (sbyte)Item.AssetType; InventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType, InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID, diff --git a/OpenSim/Region/Environment/Modules/AgentAssetTransactionModule.cs b/OpenSim/Region/Environment/Modules/AgentAssetTransactionModule.cs index 0789b3c005..7ae3ebaa5b 100644 --- a/OpenSim/Region/Environment/Modules/AgentAssetTransactionModule.cs +++ b/OpenSim/Region/Environment/Modules/AgentAssetTransactionModule.cs @@ -232,7 +232,7 @@ namespace OpenSim.Region.Environment.Modules { m_log.DebugFormat( "[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}", - item.inventoryName); + item.Name); AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); diff --git a/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs b/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs index caba0713b6..4d2ec5be01 100644 --- a/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs +++ b/OpenSim/Region/Environment/Modules/AgentAssetsTransactions.cs @@ -342,7 +342,7 @@ namespace OpenSim.Region.Environment.Modules AssetBase asset = m_userTransactions.Manager.MyScene.CommsManager.AssetCache.GetAsset( - assetID, (item.assetType == (int) AssetType.Texture ? true : false)); + assetID, (item.AssetType == (int) AssetType.Texture ? true : false)); if (asset == null) { @@ -351,11 +351,11 @@ namespace OpenSim.Region.Environment.Modules if (asset != null && asset.FullID == assetID) { - asset.Name = item.inventoryName; - asset.Description = item.inventoryDescription; - asset.InvType = (sbyte) item.invType; - asset.Type = (sbyte) item.assetType; - item.assetID = asset.FullID; + asset.Name = item.Name; + asset.Description = item.Description; + asset.InvType = (sbyte) item.InvType; + asset.Type = (sbyte) item.AssetType; + item.AssetID = asset.FullID; m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(Asset); } @@ -374,18 +374,18 @@ namespace OpenSim.Region.Environment.Modules if (userInfo != null) { InventoryItemBase item = new InventoryItemBase(); - item.avatarID = ourClient.AgentId; - item.creatorsID = ourClient.AgentId; - item.inventoryID = LLUUID.Random(); - item.assetID = Asset.FullID; - item.inventoryDescription = m_description; - item.inventoryName = m_name; - item.assetType = type; - item.invType = invType; - item.parentFolderID = InventFolder; - item.inventoryBasePermissions = 2147483647; - item.inventoryCurrentPermissions = 2147483647; - item.inventoryNextPermissions = nextPerm; + item.Owner = ourClient.AgentId; + item.Creator = ourClient.AgentId; + item.ID = LLUUID.Random(); + item.AssetID = Asset.FullID; + item.Description = m_description; + item.Name = m_name; + item.AssetType = type; + item.InvType = invType; + item.Folder = InventFolder; + item.BasePermissions = 2147483647; + item.CurrentPermissions = 2147483647; + item.NextPermissions = nextPerm; userInfo.AddItem(ourClient.AgentId, item); ourClient.SendInventoryItemCreateUpdate(item); diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 7ef32855ec..052cb02482 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -114,19 +114,19 @@ namespace OpenSim.Region.Environment.Scenes if (item != null) { AssetBase asset = - CreateAsset(item.inventoryName, item.inventoryDescription, (sbyte) item.invType, - (sbyte) item.assetType, data); + CreateAsset(item.Name, item.Description, (sbyte) item.InvType, + (sbyte) item.AssetType, data); AssetCache.AddAsset(asset); - item.assetID = asset.FullID; + item.AssetID = asset.FullID; userInfo.UpdateItem(remoteClient.AgentId, item); // remoteClient.SendInventoryItemCreateUpdate(item); - if ((InventoryType) item.invType == InventoryType.Notecard) + if ((InventoryType) item.InvType == InventoryType.Notecard) { //do we want to know about updated note cards? } - else if ((InventoryType) item.invType == InventoryType.LSL) + else if ((InventoryType) item.InvType == InventoryType.LSL) { // do we want to know about updated scripts } @@ -258,9 +258,9 @@ namespace OpenSim.Region.Environment.Scenes { if (LLUUID.Zero == transactionID) { - item.inventoryName = name; - item.inventoryDescription = description; - item.inventoryNextPermissions = nextOwnerMask; + item.Name = name; + item.Description = description; + item.NextPermissions = nextOwnerMask; userInfo.UpdateItem(remoteClient.AgentId, item); } @@ -319,20 +319,20 @@ namespace OpenSim.Region.Environment.Scenes { // Insert a copy of the item into the recipient InventoryItemBase itemCopy = new InventoryItemBase(); - itemCopy.avatarID = recipientClient.AgentId; - itemCopy.creatorsID = senderId; - itemCopy.inventoryID = LLUUID.Random(); - itemCopy.assetID = item.assetID; - itemCopy.inventoryDescription = item.inventoryDescription; - itemCopy.inventoryName = item.inventoryName; - itemCopy.assetType = item.assetType; - itemCopy.invType = item.invType; - itemCopy.parentFolderID = recipientUserInfo.RootFolder.folderID; - itemCopy.inventoryCurrentPermissions = 2147483647; - itemCopy.inventoryNextPermissions = 2147483647; - itemCopy.inventoryEveryOnePermissions = item.inventoryEveryOnePermissions; - itemCopy.inventoryBasePermissions = item.inventoryBasePermissions; - itemCopy.inventoryCurrentPermissions = item.inventoryCurrentPermissions; + itemCopy.Owner = recipientClient.AgentId; + itemCopy.Creator = senderId; + itemCopy.ID = LLUUID.Random(); + itemCopy.AssetID = item.AssetID; + itemCopy.Description = item.Description; + itemCopy.Name = item.Name; + itemCopy.AssetType = item.AssetType; + itemCopy.InvType = item.InvType; + itemCopy.Folder = recipientUserInfo.RootFolder.folderID; + itemCopy.CurrentPermissions = 2147483647; + itemCopy.NextPermissions = 2147483647; + itemCopy.EveryOnePermissions = item.EveryOnePermissions; + itemCopy.BasePermissions = item.BasePermissions; + itemCopy.CurrentPermissions = item.CurrentPermissions; recipientUserInfo.AddItem(recipientClient.AgentId, itemCopy); @@ -343,8 +343,8 @@ namespace OpenSim.Region.Environment.Scenes { m_log.ErrorFormat( "[AGENT INVENTORY]: Could not find userinfo for recipient user {0}, {1} of item {2}, {3} from {4}", - recipientClient.Name, recipientClient.AgentId, item.inventoryName, - item.inventoryID, senderId); + recipientClient.Name, recipientClient.AgentId, item.Name, + item.ID, senderId); } } else @@ -397,19 +397,19 @@ namespace OpenSim.Region.Environment.Scenes AssetBase asset = AssetCache.GetAsset( - item.assetID, (item.assetType == (int)AssetType.Texture ? true : false)); + item.AssetID, (item.AssetType == (int)AssetType.Texture ? true : false)); if (asset != null) { // TODO: preserve current permissions? CreateNewInventoryItem( - remoteClient, newFolderID, callbackID, asset, item.inventoryNextPermissions); + remoteClient, newFolderID, callbackID, asset, item.NextPermissions); } else { m_log.ErrorFormat( "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found", - item.inventoryName, item.assetID); + item.Name, item.AssetID); } } @@ -445,9 +445,9 @@ namespace OpenSim.Region.Environment.Scenes { if (newName != System.String.Empty) { - item.inventoryName = newName; + item.Name = newName; } - item.parentFolderID = folderID; + item.Folder = folderID; userInfo.DeleteItem(remoteClient.AgentId, item); // TODO: preserve current permissions? @@ -483,17 +483,17 @@ namespace OpenSim.Region.Environment.Scenes if (userInfo != null) { InventoryItemBase item = new InventoryItemBase(); - item.avatarID = remoteClient.AgentId; - item.creatorsID = remoteClient.AgentId; - item.inventoryID = LLUUID.Random(); - item.assetID = asset.FullID; - item.inventoryDescription = asset.Description; - item.inventoryName = asset.Name; - item.assetType = asset.Type; - item.invType = asset.InvType; - item.parentFolderID = folderID; - item.inventoryCurrentPermissions = 2147483647; - item.inventoryNextPermissions = nextOwnerMask; + item.Owner = remoteClient.AgentId; + item.Creator = remoteClient.AgentId; + item.ID = LLUUID.Random(); + item.AssetID = asset.FullID; + item.Description = asset.Description; + item.Name = asset.Name; + item.AssetType = asset.Type; + item.InvType = asset.InvType; + item.Folder = folderID; + item.CurrentPermissions = 2147483647; + item.NextPermissions = nextOwnerMask; userInfo.AddItem(remoteClient.AgentId, item); remoteClient.SendInventoryItemCreateUpdate(item); @@ -708,12 +708,12 @@ namespace OpenSim.Region.Environment.Scenes if (item != null) { - if (item.assetType == 0 || item.assetType == 1 || item.assetType == 10) + if (item.AssetType == 0 || item.AssetType == 1 || item.AssetType == 10) { group.AddInventoryItem(remoteClient, primLocalID, item, copyID); m_log.InfoFormat( "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", - item.inventoryName, primLocalID, remoteClient.Name); + item.Name, primLocalID, remoteClient.Name); group.GetProperties(remoteClient); } else @@ -725,7 +725,7 @@ namespace OpenSim.Region.Environment.Scenes // nasty way it is done to be changed). m_log.WarnFormat( "[PRIM INVENTORY]: Sorry, prim inventory storage of asset type {0} is not yet supported", - item.assetType); + item.AssetType); } } else @@ -790,7 +790,7 @@ namespace OpenSim.Region.Environment.Scenes "[PRIM INVENTORY]: " + "Could not rez script {0} into prim local ID {1} for user {2}" + " because the prim could not be found in the region!", - item.inventoryName, localID, remoteClient.Name); + item.Name, localID, remoteClient.Name); } } else @@ -863,21 +863,21 @@ namespace OpenSim.Region.Environment.Scenes AssetCache.AddAsset(asset); InventoryItemBase item = new InventoryItemBase(); - item.avatarID = remoteClient.AgentId; - item.creatorsID = remoteClient.AgentId; - item.inventoryID = LLUUID.Random(); - item.assetID = asset.FullID; - item.inventoryDescription = asset.Description; - item.inventoryName = asset.Name; - item.assetType = asset.Type; - item.invType = asset.InvType; - item.parentFolderID = DeRezPacket.AgentBlock.DestinationID; - item.inventoryCurrentPermissions = 2147483647; - item.inventoryNextPermissions = 2147483647; - item.inventoryEveryOnePermissions = + item.Owner = remoteClient.AgentId; + item.Creator = remoteClient.AgentId; + item.ID = LLUUID.Random(); + item.AssetID = asset.FullID; + item.Description = asset.Description; + item.Name = asset.Name; + item.AssetType = asset.Type; + item.InvType = asset.InvType; + item.Folder = DeRezPacket.AgentBlock.DestinationID; + item.CurrentPermissions = 2147483647; + item.NextPermissions = 2147483647; + item.EveryOnePermissions = ((SceneObjectGroup) selectedEnt).RootPart.EveryoneMask; - item.inventoryBasePermissions = ((SceneObjectGroup) selectedEnt).RootPart.BaseMask; - item.inventoryCurrentPermissions = ((SceneObjectGroup) selectedEnt).RootPart.OwnerMask; + item.BasePermissions = ((SceneObjectGroup) selectedEnt).RootPart.BaseMask; + item.CurrentPermissions = ((SceneObjectGroup) selectedEnt).RootPart.OwnerMask; userInfo.AddItem(remoteClient.AgentId, item); remoteClient.SendInventoryItemCreateUpdate(item); @@ -942,7 +942,7 @@ namespace OpenSim.Region.Environment.Scenes InventoryItemBase item = userInfo.RootFolder.HasItem(itemID); if (item != null) { - AssetBase rezAsset = AssetCache.GetAsset(item.assetID, false); + AssetBase rezAsset = AssetCache.GetAsset(item.AssetID, false); if (rezAsset != null) { @@ -956,8 +956,8 @@ namespace OpenSim.Region.Environment.Scenes // Since renaming the item in the inventory does not affect the name stored // in the serialization, transfer the correct name from the inventory to the // object itself before we rez. - rootPart.Name = item.inventoryName; - rootPart.Description = item.inventoryDescription; + rootPart.Name = item.Name; + rootPart.Description = item.Description; rootPart.TrimPermissions(); group.ApplyPhysics(m_physicalPrim); diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index a450a3d2cb..3f14fff00a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs @@ -178,7 +178,7 @@ namespace OpenSim.Region.Environment.Scenes public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) { - LLUUID newItemId = (copyItemID != LLUUID.Zero) ? copyItemID : item.inventoryID; + LLUUID newItemId = (copyItemID != LLUUID.Zero) ? copyItemID : item.ID; SceneObjectPart part = GetChildPart(localID); if (part != null) @@ -186,13 +186,13 @@ namespace OpenSim.Region.Environment.Scenes TaskInventoryItem taskItem = new TaskInventoryItem(); taskItem.ItemID = newItemId; - taskItem.AssetID = item.assetID; - taskItem.Name = item.inventoryName; - taskItem.Description = item.inventoryDescription; - taskItem.OwnerID = item.avatarID; - taskItem.CreatorID = item.creatorsID; - taskItem.Type = item.assetType; - taskItem.InvType = item.invType; + taskItem.AssetID = item.AssetID; + taskItem.Name = item.Name; + taskItem.Description = item.Description; + taskItem.OwnerID = item.Owner; + taskItem.CreatorID = item.Creator; + taskItem.Type = item.AssetType; + taskItem.InvType = item.InvType; part.AddInventoryItem(taskItem); return true; diff --git a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs index f413fb9e84..ae522ef45f 100644 --- a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs @@ -303,7 +303,7 @@ namespace OpenSim.Region.Modules.AvatarFactory InventoryItemBase baseItem = profile.RootFolder.HasItem(wear.ItemID); if (baseItem != null) { - assetId = baseItem.assetID; + assetId = baseItem.AssetID; avatAppearance.Wearables[wear.Type].AssetID = assetId; avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;