diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 74 |
1 files changed, 36 insertions, 38 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3b029f2..5b64aac 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -48,6 +48,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | private byte[] m_inventoryFileData = new byte[0]; | 50 | private byte[] m_inventoryFileData = new byte[0]; |
51 | private byte[] m_inventoryFileNameBytes = new byte[0]; | ||
52 | private string m_inventoryFileName = ""; | ||
51 | private uint m_inventoryFileNameSerial = 0; | 53 | private uint m_inventoryFileNameSerial = 0; |
52 | private bool m_inventoryPrivileged = false; | 54 | private bool m_inventoryPrivileged = false; |
53 | private object m_inventoryFileLock = new object(); | 55 | private object m_inventoryFileLock = new object(); |
@@ -1112,28 +1114,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1112 | /// <param name="xferManager"></param> | 1114 | /// <param name="xferManager"></param> |
1113 | public void RequestInventoryFile(IClientAPI client, IXfer xferManager) | 1115 | public void RequestInventoryFile(IClientAPI client, IXfer xferManager) |
1114 | { | 1116 | { |
1115 | |||
1116 | lock (m_inventoryFileLock) | 1117 | lock (m_inventoryFileLock) |
1117 | { | 1118 | { |
1118 | string filename = "inventory_" + UUID.Random().ToString() + ".tmp"; | ||
1119 | |||
1120 | bool changed = false; | 1119 | bool changed = false; |
1121 | if (m_inventoryFileNameSerial < m_inventorySerial) | ||
1122 | { | ||
1123 | m_inventoryFileNameSerial = m_inventorySerial; | ||
1124 | changed = true; | ||
1125 | } | ||
1126 | |||
1127 | if (m_inventoryFileData.Length < 2) | ||
1128 | changed = true; | ||
1129 | |||
1130 | bool includeAssets = false; | ||
1131 | if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) | ||
1132 | includeAssets = true; | ||
1133 | |||
1134 | if (m_inventoryPrivileged != includeAssets) | ||
1135 | changed = true; | ||
1136 | |||
1137 | 1120 | ||
1138 | Items.LockItemsForRead(true); | 1121 | Items.LockItemsForRead(true); |
1139 | 1122 | ||
@@ -1141,7 +1124,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1141 | { | 1124 | { |
1142 | Items.LockItemsForRead(false); | 1125 | Items.LockItemsForRead(false); |
1143 | client.SendTaskInventory(m_part.UUID, 0, new byte[0]); | 1126 | client.SendTaskInventory(m_part.UUID, 0, new byte[0]); |
1144 | |||
1145 | return; | 1127 | return; |
1146 | } | 1128 | } |
1147 | 1129 | ||
@@ -1152,14 +1134,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1152 | return; | 1134 | return; |
1153 | } | 1135 | } |
1154 | 1136 | ||
1155 | if (!changed) | 1137 | if (m_inventoryFileNameSerial != m_inventorySerial) |
1156 | { | 1138 | { |
1157 | Items.LockItemsForRead(false); | 1139 | m_inventoryFileNameSerial = m_inventorySerial; |
1140 | changed = true; | ||
1141 | } | ||
1142 | |||
1143 | Items.LockItemsForRead(false); | ||
1144 | |||
1145 | if (m_inventoryFileData.Length < 2) | ||
1146 | changed = true; | ||
1158 | 1147 | ||
1159 | xferManager.AddNewFile(filename, | 1148 | bool includeAssets = false; |
1160 | m_inventoryFileData); | 1149 | if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) |
1150 | includeAssets = true; | ||
1151 | |||
1152 | if (m_inventoryPrivileged != includeAssets) | ||
1153 | changed = true; | ||
1154 | |||
1155 | if (!changed) | ||
1156 | { | ||
1157 | xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); | ||
1161 | client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial, | 1158 | client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial, |
1162 | Util.StringToBytes256(filename)); | 1159 | m_inventoryFileNameBytes); |
1163 | 1160 | ||
1164 | return; | 1161 | return; |
1165 | } | 1162 | } |
@@ -1168,6 +1165,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1168 | 1165 | ||
1169 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); | 1166 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); |
1170 | 1167 | ||
1168 | Items.LockItemsForRead(true); | ||
1169 | |||
1171 | foreach (TaskInventoryItem item in m_items.Values) | 1170 | foreach (TaskInventoryItem item in m_items.Values) |
1172 | { | 1171 | { |
1173 | UUID ownerID = item.OwnerID; | 1172 | UUID ownerID = item.OwnerID; |
@@ -1222,9 +1221,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1222 | 1221 | ||
1223 | if (m_inventoryFileData.Length > 2) | 1222 | if (m_inventoryFileData.Length > 2) |
1224 | { | 1223 | { |
1225 | xferManager.AddNewFile(filename, m_inventoryFileData); | 1224 | m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; |
1226 | client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial, | 1225 | m_inventoryFileNameBytes = Util.StringToBytes256(m_inventoryFileName); |
1227 | Util.StringToBytes256(filename)); | 1226 | xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); |
1227 | client.SendTaskInventory(m_part.UUID, (short)m_inventoryFileNameSerial,m_inventoryFileNameBytes); | ||
1228 | return; | 1228 | return; |
1229 | } | 1229 | } |
1230 | 1230 | ||
@@ -1267,26 +1267,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1267 | AddNameValueLine("obj_id", folderID.ToString()); | 1267 | AddNameValueLine("obj_id", folderID.ToString()); |
1268 | AddNameValueLine("parent_id", parentID.ToString()); | 1268 | AddNameValueLine("parent_id", parentID.ToString()); |
1269 | AddNameValueLine("type", "category"); | 1269 | AddNameValueLine("type", "category"); |
1270 | AddNameValueLine("name", "Contents|"); | 1270 | AddNameValueLine("name", "Contents|\n\t}"); |
1271 | AddSectionEnd(); | ||
1272 | } | 1271 | } |
1273 | 1272 | ||
1274 | public void AddItemStart() | 1273 | public void AddItemStart() |
1275 | { | 1274 | { |
1276 | BuildString.Append("\tinv_item\t0\n"); | 1275 | BuildString.Append("\tinv_item\t0\n\t{\n"); |
1277 | AddSectionStart(); | ||
1278 | } | 1276 | } |
1279 | 1277 | ||
1280 | public void AddPermissionsStart() | 1278 | public void AddPermissionsStart() |
1281 | { | 1279 | { |
1282 | BuildString.Append("\tpermissions 0\n"); | 1280 | BuildString.Append("\tpermissions 0\n\t{\n"); |
1283 | AddSectionStart(); | ||
1284 | } | 1281 | } |
1285 | 1282 | ||
1286 | public void AddSaleStart() | 1283 | public void AddSaleStart() |
1287 | { | 1284 | { |
1288 | BuildString.Append("\tsale_info\t0\n"); | 1285 | BuildString.Append("\tsale_info\t0\n\t{\n"); |
1289 | AddSectionStart(); | ||
1290 | } | 1286 | } |
1291 | 1287 | ||
1292 | protected void AddSectionStart() | 1288 | protected void AddSectionStart() |
@@ -1307,8 +1303,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1307 | public void AddNameValueLine(string name, string value) | 1303 | public void AddNameValueLine(string name, string value) |
1308 | { | 1304 | { |
1309 | BuildString.Append("\t\t"); | 1305 | BuildString.Append("\t\t"); |
1310 | BuildString.Append(name + "\t"); | 1306 | BuildString.Append(name); |
1311 | BuildString.Append(value + "\n"); | 1307 | BuildString.Append("\t"); |
1308 | BuildString.Append(value); | ||
1309 | BuildString.Append("\n"); | ||
1312 | } | 1310 | } |
1313 | 1311 | ||
1314 | public String GetString() | 1312 | public String GetString() |