aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs98
-rw-r--r--OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs14
3 files changed, 97 insertions, 31 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 94b6797..4bbc2ed 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1151,20 +1151,26 @@ namespace OpenSim.Region.Environment.Scenes
1151 { 1151 {
1152 MainLog.Instance.Warn( 1152 MainLog.Instance.Warn(
1153 "SCENE", 1153 "SCENE",
1154 "Couldn't find part {0} in object group {1} ({2}) to retreive prim inventory", 1154 "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory",
1155 localID, LocalId, UUID); 1155 localID, Name, UUID);
1156 } 1156 }
1157 return false; 1157 return false;
1158 } 1158 }
1159 1159
1160 public string RequestInventoryFile(uint localID, IXfer xferManager) 1160 public void RequestInventoryFile(uint localID, IXfer xferManager)
1161 { 1161 {
1162 SceneObjectPart part = GetChildPart(localID); 1162 SceneObjectPart part = GetChildPart(localID);
1163 if (part != null) 1163 if (part != null)
1164 { 1164 {
1165 part.RequestInventoryFile(xferManager); 1165 part.RequestInventoryFile(xferManager);
1166 } 1166 }
1167 return ""; 1167 else
1168 {
1169 MainLog.Instance.Warn(
1170 "PRIMINVENTORY",
1171 "Couldn't find part {0} in object group {1}, {2} to request inventory data",
1172 localID, Name, UUID);
1173 }
1168 } 1174 }
1169 1175
1170 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item) 1176 public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item)
@@ -1202,7 +1208,7 @@ namespace OpenSim.Region.Environment.Scenes
1202 taskItem.owner_id = new LLUUID(item.avatarID.ToString()); 1208 taskItem.owner_id = new LLUUID(item.avatarID.ToString());
1203 taskItem.creator_id = new LLUUID(item.creatorsID.ToString()); 1209 taskItem.creator_id = new LLUUID(item.creatorsID.ToString());
1204 taskItem.type = SceneObjectPart.TaskInventoryItem.Types[item.assetType]; 1210 taskItem.type = SceneObjectPart.TaskInventoryItem.Types[item.assetType];
1205 taskItem.inv_type = SceneObjectPart.TaskInventoryItem.Types[item.invType]; 1211 taskItem.inv_type = SceneObjectPart.TaskInventoryItem.InvTypes[item.invType];
1206 part.AddInventoryItem(taskItem); 1212 part.AddInventoryItem(taskItem);
1207 return true; 1213 return true;
1208 } 1214 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 051884d..2ddcf7b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -56,7 +56,21 @@ namespace OpenSim.Region.Environment.Scenes
56 private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647; 56 private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647;
57 private const uint FULL_MASK_PERMISSIONS_OWNER = 2147483647; 57 private const uint FULL_MASK_PERMISSIONS_OWNER = 2147483647;
58 private string m_inventoryFileName = ""; 58 private string m_inventoryFileName = "";
59
60 /// <summary>
61 /// The inventory folder for this prim
62 /// </summary>
59 private LLUUID m_folderID = LLUUID.Zero; 63 private LLUUID m_folderID = LLUUID.Zero;
64
65 /// <summary>
66 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see
67 /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim.
68 /// </summary>
69 public LLUUID FolderID
70 {
71 get { return m_folderID; }
72 set { m_folderID = value; }
73 }
60 74
61 [XmlIgnore] public PhysicsActor PhysActor = null; 75 [XmlIgnore] public PhysicsActor PhysActor = null;
62 76
@@ -67,14 +81,9 @@ namespace OpenSim.Region.Environment.Scenes
67 = new Dictionary<LLUUID, TaskInventoryItem>(); 81 = new Dictionary<LLUUID, TaskInventoryItem>();
68 82
69 [XmlIgnore] 83 [XmlIgnore]
70 /// <summary>
71 /// Not really ideal to allow this to be set, but currently expedient for inserting a prim inventory
72 /// from persistence.
73 /// </summary>
74 public IDictionary<LLUUID, TaskInventoryItem> TaskInventory 84 public IDictionary<LLUUID, TaskInventoryItem> TaskInventory
75 { 85 {
76 get { return m_taskInventory; } 86 get { return m_taskInventory; }
77 set { m_taskInventory = value; }
78 } 87 }
79 88
80 public LLUUID LastOwnerID; 89 public LLUUID LastOwnerID;
@@ -1059,6 +1068,10 @@ namespace OpenSim.Region.Environment.Scenes
1059 1068
1060 #region Inventory 1069 #region Inventory
1061 1070
1071 /// <summary>
1072 /// Add an item to this prim's inventory.
1073 /// </summary>
1074 /// <param name="item"></param>
1062 public void AddInventoryItem(TaskInventoryItem item) 1075 public void AddInventoryItem(TaskInventoryItem item)
1063 { 1076 {
1064 item.parent_id = m_folderID; 1077 item.parent_id = m_folderID;
@@ -1067,6 +1080,21 @@ namespace OpenSim.Region.Environment.Scenes
1067 m_taskInventory.Add(item.item_id, item); 1080 m_taskInventory.Add(item.item_id, item);
1068 m_inventorySerial++; 1081 m_inventorySerial++;
1069 } 1082 }
1083
1084 /// <summary>
1085 /// Add a whole collection of items to the prim's inventory at once. We assume that the items already
1086 /// have all their fields correctly filled out.
1087 /// </summary>
1088 /// <param name="items"></param>
1089 public void AddInventoryItems(ICollection<TaskInventoryItem> items)
1090 {
1091 foreach (TaskInventoryItem item in items)
1092 {
1093 m_taskInventory.Add(item.item_id, item);
1094 }
1095
1096 m_inventorySerial++;
1097 }
1070 1098
1071 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) 1099 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
1072 { 1100 {
@@ -1077,7 +1105,7 @@ namespace OpenSim.Region.Environment.Scenes
1077 string type = m_taskInventory[itemID].inv_type; 1105 string type = m_taskInventory[itemID].inv_type;
1078 m_taskInventory.Remove(itemID); 1106 m_taskInventory.Remove(itemID);
1079 m_inventorySerial++; 1107 m_inventorySerial++;
1080 if (type == "lsltext") 1108 if (type == "lsl_text")
1081 { 1109 {
1082 return 10; 1110 return 10;
1083 } 1111 }
@@ -1110,7 +1138,7 @@ namespace OpenSim.Region.Environment.Scenes
1110 } 1138 }
1111 } 1139 }
1112 1140
1113 public string RequestInventoryFile(IXfer xferManager) 1141 public void RequestInventoryFile(IXfer xferManager)
1114 { 1142 {
1115 byte[] fileData = new byte[0]; 1143 byte[] fileData = new byte[0];
1116 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID); 1144 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID);
@@ -1141,12 +1169,16 @@ namespace OpenSim.Region.Environment.Scenes
1141 invString.AddNameValueLine("creation_date", item.creation_date.ToString()); 1169 invString.AddNameValueLine("creation_date", item.creation_date.ToString());
1142 invString.AddSectionEnd(); 1170 invString.AddSectionEnd();
1143 } 1171 }
1172
1144 fileData = Helpers.StringToField(invString.BuildString); 1173 fileData = Helpers.StringToField(invString.BuildString);
1174
1175// MainLog.Instance.Verbose(
1176// "PRIMINVENTORY", "RequestInventoryFile fileData: {0}", Helpers.FieldToUTF8String(fileData));
1177
1145 if (fileData.Length > 2) 1178 if (fileData.Length > 2)
1146 { 1179 {
1147 xferManager.AddNewFile(m_inventoryFileName, fileData); 1180 xferManager.AddNewFile(m_inventoryFileName, fileData);
1148 } 1181 }
1149 return "";
1150 } 1182 }
1151 1183
1152 #endregion 1184 #endregion
@@ -1707,21 +1739,43 @@ namespace OpenSim.Region.Environment.Scenes
1707 1739
1708 public class TaskInventoryItem 1740 public class TaskInventoryItem
1709 { 1741 {
1742 /// <summary>
1743 /// Inventory types
1744 /// </summary>
1745 public static string[] InvTypes = new string[]
1746 {
1747 "texture",
1748 "sound",
1749 "",
1750 "",
1751 "",
1752 "",
1753 "",
1754 "",
1755 "",
1756 "",
1757 "lsl_text",
1758 ""
1759 };
1760
1761 /// <summary>
1762 /// Asset types
1763 /// </summary>
1710 public static string[] Types = new string[] 1764 public static string[] Types = new string[]
1711 { 1765 {
1712 "texture", 1766 "texture",
1713 "sound", 1767 "sound",
1714 "", 1768 "",
1715 "", 1769 "",
1716 "", 1770 "",
1717 "", 1771 "",
1718 "", 1772 "",
1719 "", 1773 "",
1720 "", 1774 "",
1721 "", 1775 "",
1722 "lsltext", 1776 "lsltext",
1723 "" 1777 ""
1724 }; 1778 };
1725 1779
1726 public LLUUID item_id = LLUUID.Zero; 1780 public LLUUID item_id = LLUUID.Zero;
1727 public LLUUID parent_id = LLUUID.Zero; //parent folder id 1781 public LLUUID parent_id = LLUUID.Zero; //parent folder id
diff --git a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
index f9ab0c5..8bad730 100644
--- a/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
+++ b/OpenSim/Region/Storage/OpenSim.DataStore.MonoSqlite/MonoSqliteDataStore.cs
@@ -340,18 +340,24 @@ namespace OpenSim.DataStore.MonoSqlite
340 String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); 340 String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
341 DataRow[] dbItemRows = dbItems.Select(sql); 341 DataRow[] dbItemRows = dbItems.Select(sql);
342 342
343 IDictionary<LLUUID, SceneObjectPart.TaskInventoryItem> inventory 343 IList<SceneObjectPart.TaskInventoryItem> inventory = new List<SceneObjectPart.TaskInventoryItem>();
344 = new Dictionary<LLUUID, SceneObjectPart.TaskInventoryItem>();
345 344
346 foreach (DataRow row in dbItemRows) 345 foreach (DataRow row in dbItemRows)
347 { 346 {
348 SceneObjectPart.TaskInventoryItem item = buildItem(row); 347 SceneObjectPart.TaskInventoryItem item = buildItem(row);
349 inventory.Add(item.item_id, item); 348 inventory.Add(item);
350 349
351 MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.name, item.item_id); 350 MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.name, item.item_id);
352 } 351 }
353 352
354 prim.TaskInventory = inventory; 353 prim.AddInventoryItems(inventory);
354
355 // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in
356 // every item). This data should really be stored in the prim table itself.
357 if (dbItemRows.Length > 0)
358 {
359 prim.FolderID = inventory[0].parent_id;
360 }
355 } 361 }
356 362
357 public void StoreTerrain(double[,] ter, LLUUID regionID) 363 public void StoreTerrain(double[,] ter, LLUUID regionID)