aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/Resources/OpenSim.Data.addin.xml9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs80
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs139
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs40
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs111
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs40
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs20
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs32
8 files changed, 280 insertions, 191 deletions
diff --git a/OpenSim/Data/Resources/OpenSim.Data.addin.xml b/OpenSim/Data/Resources/OpenSim.Data.addin.xml
index 65774ff..10c9c3c 100644
--- a/OpenSim/Data/Resources/OpenSim.Data.addin.xml
+++ b/OpenSim/Data/Resources/OpenSim.Data.addin.xml
@@ -3,19 +3,10 @@
3 <Import assembly="OpenSim.Data.dll" /> 3 <Import assembly="OpenSim.Data.dll" />
4 <Import assembly="OpenSim.Framework.dll" /> 4 <Import assembly="OpenSim.Framework.dll" />
5 </Runtime> 5 </Runtime>
6 <ExtensionPoint path = "/OpenSim/GridData">
7 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IGridDataPlugin" />
8 </ExtensionPoint>
9 <ExtensionPoint path = "/OpenSim/LogData">
10 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.ILogDataPlugin" />
11 </ExtensionPoint>
12 <ExtensionPoint path = "/OpenSim/AssetData"> 6 <ExtensionPoint path = "/OpenSim/AssetData">
13 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin" /> 7 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IAssetDataPlugin" />
14 </ExtensionPoint> 8 </ExtensionPoint>
15 <ExtensionPoint path = "/OpenSim/InventoryData"> 9 <ExtensionPoint path = "/OpenSim/InventoryData">
16 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin" /> 10 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IInventoryDataPlugin" />
17 </ExtensionPoint> 11 </ExtensionPoint>
18 <ExtensionPoint path = "/OpenSim/UserData">
19 <ExtensionNode name="Plugin" type="OpenSim.Framework.PluginExtensionNode" objectType="OpenSim.Data.IUserDataPlugin" />
20 </ExtensionPoint>
21</Addin> 12</Addin>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index c8697fe..31dfe14 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -93,37 +93,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
93 /// </returns> 93 /// </returns>
94 public List<InventoryNodeBase> Execute() 94 public List<InventoryNodeBase> Execute()
95 { 95 {
96 string filePath = "ERROR";
97 int successfulAssetRestores = 0;
98 int failedAssetRestores = 0;
99 int successfulItemRestores = 0;
100
101 List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>();
102
103 List<InventoryFolderBase> folderCandidates
104 = InventoryArchiveUtils.FindFolderByPath(
105 m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
106
107 if (folderCandidates.Count == 0)
108 {
109 // Possibly provide an option later on to automatically create this folder if it does not exist
110 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
111
112 return loadedNodes;
113 }
114
115 InventoryFolderBase rootDestinationFolder = folderCandidates[0];
116 archive = new TarArchiveReader(m_loadStream);
117
118 // In order to load identically named folders, we need to keep track of the folders that we have already
119 // resolved
120 Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
121
122 byte[] data;
123 TarArchiveReader.TarEntryType entryType;
124
125 try 96 try
126 { 97 {
98 string filePath = "ERROR";
99 int successfulAssetRestores = 0;
100 int failedAssetRestores = 0;
101 int successfulItemRestores = 0;
102
103 List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>();
104
105 List<InventoryFolderBase> folderCandidates
106 = InventoryArchiveUtils.FindFolderByPath(
107 m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
108
109 if (folderCandidates.Count == 0)
110 {
111 // Possibly provide an option later on to automatically create this folder if it does not exist
112 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
113
114 return loadedNodes;
115 }
116
117 InventoryFolderBase rootDestinationFolder = folderCandidates[0];
118 archive = new TarArchiveReader(m_loadStream);
119
120 // In order to load identically named folders, we need to keep track of the folders that we have already
121 // resolved
122 Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
123
124 byte[] data;
125 TarArchiveReader.TarEntryType entryType;
126
127 while ((data = archive.ReadEntry(out filePath, out entryType)) != null) 127 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
128 { 128 {
129 if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 129 if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
@@ -166,18 +166,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
166 } 166 }
167 } 167 }
168 } 168 }
169
170 archive.Close();
171
172 m_log.DebugFormat(
173 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
174 successfulAssetRestores, failedAssetRestores);
175 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
176
177 return loadedNodes;
169 } 178 }
170 finally 179 finally
171 { 180 {
172 archive.Close(); 181 m_loadStream.Close();
173 } 182 }
174
175 m_log.DebugFormat(
176 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
177 successfulAssetRestores, failedAssetRestores);
178 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
179
180 return loadedNodes;
181 } 183 }
182 184
183 public void Close() 185 public void Close()
@@ -247,7 +249,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
247 ref string archivePath, 249 ref string archivePath,
248 Dictionary <string, InventoryFolderBase> resolvedFolders) 250 Dictionary <string, InventoryFolderBase> resolvedFolders)
249 { 251 {
250 string originalArchivePath = archivePath; 252// string originalArchivePath = archivePath;
251 253
252 InventoryFolderBase destFolder = null; 254 InventoryFolderBase destFolder = null;
253 255
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 2c2724e..25a78ff 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -119,22 +119,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) 119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
120 { 120 {
121 Exception reportedException = null; 121 Exception reportedException = null;
122 bool succeeded = true; 122 bool succeeded = true;
123 123
124 try 124 try
125 { 125 {
126 // We're almost done. Just need to write out the control file now 126 // We're almost done. Just need to write out the control file now
127 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); 127 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
128 m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); 128 m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
129
130 m_archiveWriter.Close(); 129 m_archiveWriter.Close();
131 } 130 }
132 catch (Exception e) 131 catch (Exception e)
133 { 132 {
134 m_saveStream.Close();
135 reportedException = e; 133 reportedException = e;
136 succeeded = false; 134 succeeded = false;
137 } 135 }
136 finally
137 {
138 m_saveStream.Close();
139 }
138 140
139 m_module.TriggerInventoryArchiveSaved( 141 m_module.TriggerInventoryArchiveSaved(
140 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); 142 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
@@ -213,70 +215,68 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
213 /// </summary> 215 /// </summary>
214 public void Execute() 216 public void Execute()
215 { 217 {
216 InventoryFolderBase inventoryFolder = null; 218 try
217 InventoryItemBase inventoryItem = null;
218 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
219
220 bool foundStar = false;
221
222 // Eliminate double slashes and any leading / on the path.
223 string[] components
224 = m_invPath.Split(
225 new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
226
227 int maxComponentIndex = components.Length - 1;
228
229 // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
230 // folder itself. This may get more sophisicated later on
231 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
232 {
233 foundStar = true;
234 maxComponentIndex--;
235 }
236
237 m_invPath = String.Empty;
238 for (int i = 0; i <= maxComponentIndex; i++)
239 {
240 m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
241 }
242
243 // Annoyingly Split actually returns the original string if the input string consists only of delimiters
244 // Therefore if we still start with a / after the split, then we need the root folder
245 if (m_invPath.Length == 0)
246 {
247 inventoryFolder = rootFolder;
248 }
249 else
250 {
251 m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
252 List<InventoryFolderBase> candidateFolders
253 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
254 if (candidateFolders.Count > 0)
255 inventoryFolder = candidateFolders[0];
256 }
257
258 // The path may point to an item instead
259 if (inventoryFolder == null)
260 {
261 inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
262 //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
263 }
264
265 if (null == inventoryFolder && null == inventoryItem)
266 { 219 {
267 // We couldn't find the path indicated 220 InventoryFolderBase inventoryFolder = null;
268 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); 221 InventoryItemBase inventoryItem = null;
269 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage); 222 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
270 m_module.TriggerInventoryArchiveSaved( 223
271 m_id, false, m_userInfo, m_invPath, m_saveStream, 224 bool foundStar = false;
272 new Exception(errorMessage)); 225
273 return; 226 // Eliminate double slashes and any leading / on the path.
274 } 227 string[] components
228 = m_invPath.Split(
229 new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
230
231 int maxComponentIndex = components.Length - 1;
232
233 // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
234 // folder itself. This may get more sophisicated later on
235 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
236 {
237 foundStar = true;
238 maxComponentIndex--;
239 }
240
241 m_invPath = String.Empty;
242 for (int i = 0; i <= maxComponentIndex; i++)
243 {
244 m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
245 }
246
247 // Annoyingly Split actually returns the original string if the input string consists only of delimiters
248 // Therefore if we still start with a / after the split, then we need the root folder
249 if (m_invPath.Length == 0)
250 {
251 inventoryFolder = rootFolder;
252 }
253 else
254 {
255 m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
256 List<InventoryFolderBase> candidateFolders
257 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
258 if (candidateFolders.Count > 0)
259 inventoryFolder = candidateFolders[0];
260 }
261
262 // The path may point to an item instead
263 if (inventoryFolder == null)
264 {
265 inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
266 //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
267 }
268
269 if (null == inventoryFolder && null == inventoryItem)
270 {
271 // We couldn't find the path indicated
272 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
273 Exception e = new InventoryArchiverException(errorMessage);
274 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
275 throw e;
276 }
275 277
276 m_archiveWriter = new TarArchiveWriter(m_saveStream); 278 m_archiveWriter = new TarArchiveWriter(m_saveStream);
277 279
278 try
279 {
280 if (inventoryFolder != null) 280 if (inventoryFolder != null)
281 { 281 {
282 m_log.DebugFormat( 282 m_log.DebugFormat(
@@ -297,16 +297,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
297 297
298 // Don't put all this profile information into the archive right now. 298 // Don't put all this profile information into the archive right now.
299 //SaveUsers(); 299 //SaveUsers();
300
301 new AssetsRequest(
302 new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
300 } 303 }
301 catch (Exception) 304 catch (Exception)
302 { 305 {
303 m_archiveWriter.Close(); 306 m_saveStream.Close();
304 throw; 307 throw;
305 } 308 }
306
307 new AssetsRequest(
308 new AssetsArchiver(m_archiveWriter), m_assetUuids,
309 m_scene.AssetService, ReceivedAllAssets).Execute();
310 } 309 }
311 310
312 /// <summary> 311 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
new file mode 100644
index 0000000..e07e2ca
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
31{
32 /// <summary>
33 /// Signals an inventory archiving problem
34 /// </summary>
35 public class InventoryArchiverException : Exception
36 {
37 public InventoryArchiverException(string message) : base(message) {}
38 public InventoryArchiverException(string message, Exception e) : base(message, e) {}
39 }
40} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index cfefbe9..f7a2b09 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -322,34 +322,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
322 /// <param name="cmdparams"></param> 322 /// <param name="cmdparams"></param>
323 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) 323 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
324 { 324 {
325 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); 325 try
326 326 {
327 Dictionary<string, object> options = new Dictionary<string, object>(); 327 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
328 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); 328
329 329 Dictionary<string, object> options = new Dictionary<string, object>();
330 List<string> mainParams = optionSet.Parse(cmdparams); 330 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
331 331
332 if (mainParams.Count < 6) 332 List<string> mainParams = optionSet.Parse(cmdparams);
333 { 333
334 m_log.Error( 334 if (mainParams.Count < 6)
335 "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]"); 335 {
336 return; 336 m_log.Error(
337 } 337 "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]");
338 338 return;
339 string firstName = mainParams[2]; 339 }
340 string lastName = mainParams[3]; 340
341 string invPath = mainParams[4]; 341 string firstName = mainParams[2];
342 string pass = mainParams[5]; 342 string lastName = mainParams[3];
343 string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); 343 string invPath = mainParams[4];
344 344 string pass = mainParams[5];
345 m_log.InfoFormat( 345 string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
346 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", 346
347 loadPath, invPath, firstName, lastName);
348
349 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
350 m_log.InfoFormat( 347 m_log.InfoFormat(
351 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", 348 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
352 loadPath, firstName, lastName); 349 loadPath, invPath, firstName, lastName);
350
351 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
352 m_log.InfoFormat(
353 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
354 loadPath, firstName, lastName);
355 }
356 catch (InventoryArchiverException e)
357 {
358 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
359 }
353 } 360 }
354 361
355 /// <summary> 362 /// <summary>
@@ -358,30 +365,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
358 /// <param name="cmdparams"></param> 365 /// <param name="cmdparams"></param>
359 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) 366 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
360 { 367 {
361 if (cmdparams.Length < 6) 368 Guid id = Guid.NewGuid();
369
370 try
362 { 371 {
363 m_log.Error( 372 if (cmdparams.Length < 6)
364 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]"); 373 {
365 return; 374 m_log.Error(
375 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
376 return;
377 }
378
379 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
380
381 string firstName = cmdparams[2];
382 string lastName = cmdparams[3];
383 string invPath = cmdparams[4];
384 string pass = cmdparams[5];
385 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
386
387 m_log.InfoFormat(
388 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
389 savePath, invPath, firstName, lastName);
390
391 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
366 } 392 }
367 393 catch (InventoryArchiverException e)
368 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); 394 {
369 395 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
370 string firstName = cmdparams[2]; 396 }
371 string lastName = cmdparams[3]; 397
372 string invPath = cmdparams[4];
373 string pass = cmdparams[5];
374 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
375
376 m_log.InfoFormat(
377 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
378 savePath, invPath, firstName, lastName);
379
380 Guid id = Guid.NewGuid();
381 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
382
383 lock (m_pendingConsoleSaves) 398 lock (m_pendingConsoleSaves)
384 m_pendingConsoleSaves.Add(id); 399 m_pendingConsoleSaves.Add(id);
385 } 400 }
386 401
387 private void SaveInvConsoleCommandCompleted( 402 private void SaveInvConsoleCommandCompleted(
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 2a3727a..2ff6a51 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -158,7 +158,7 @@ namespace OpenSim.Region.Framework.Scenes
158 158
159 HasInventoryChanged = true; 159 HasInventoryChanged = true;
160 m_part.ParentGroup.HasGroupChanged = true; 160 m_part.ParentGroup.HasGroupChanged = true;
161 IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); 161 List<TaskInventoryItem> items = GetInventoryItems();
162 foreach (TaskInventoryItem item in items) 162 foreach (TaskInventoryItem item in items)
163 { 163 {
164 if (ownerId != item.OwnerID) 164 if (ownerId != item.OwnerID)
@@ -207,10 +207,7 @@ namespace OpenSim.Region.Framework.Scenes
207 foreach (TaskInventoryItem item in items) 207 foreach (TaskInventoryItem item in items)
208 { 208 {
209 if ((int)InventoryType.LSL == item.InvType) 209 if ((int)InventoryType.LSL == item.InvType)
210 {
211 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); 210 CreateScriptInstance(item, startParam, postOnRez, engine, stateSource);
212 Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug
213 }
214 } 211 }
215 } 212 }
216 213
@@ -256,8 +253,6 @@ namespace OpenSim.Region.Framework.Scenes
256 m_part.RemoveScriptEvents(item.ItemID); 253 m_part.RemoveScriptEvents(item.ItemID);
257 } 254 }
258 } 255 }
259
260
261 } 256 }
262 257
263 /// <summary> 258 /// <summary>
@@ -270,7 +265,7 @@ namespace OpenSim.Region.Framework.Scenes
270 // m_log.InfoFormat( 265 // m_log.InfoFormat(
271 // "[PRIM INVENTORY]: " + 266 // "[PRIM INVENTORY]: " +
272 // "Starting script {0}, {1} in prim {2}, {3}", 267 // "Starting script {0}, {1} in prim {2}, {3}",
273 // item.Name, item.ItemID, m_part.Name, m_part.UUID); 268 // item.Name, item.ItemID, Name, UUID);
274 269
275 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) 270 if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID))
276 { 271 {
@@ -558,7 +553,6 @@ namespace OpenSim.Region.Framework.Scenes
558 553
559 /// <summary> 554 /// <summary>
560 /// Check if the inventory holds an item with a given name. 555 /// Check if the inventory holds an item with a given name.
561 /// This method assumes that the task inventory is already locked.
562 /// </summary> 556 /// </summary>
563 /// <param name="name"></param> 557 /// <param name="name"></param>
564 /// <returns></returns> 558 /// <returns></returns>
@@ -663,7 +657,6 @@ namespace OpenSim.Region.Framework.Scenes
663 else 657 else
664 m_part.TriggerScriptChangedEvent(Changed.INVENTORY); 658 m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
665 659
666
667 m_inventorySerial++; 660 m_inventorySerial++;
668 //m_inventorySerial += 2; 661 //m_inventorySerial += 2;
669 HasInventoryChanged = true; 662 HasInventoryChanged = true;
@@ -754,7 +747,7 @@ namespace OpenSim.Region.Framework.Scenes
754 // changed since permissions were last set. 747 // changed since permissions were last set.
755 if (item.GroupPermissions != (uint)PermissionMask.None) 748 if (item.GroupPermissions != (uint)PermissionMask.None)
756 item.GroupID = m_part.GroupID; 749 item.GroupID = m_part.GroupID;
757 750
758 if (item.AssetID == UUID.Zero) 751 if (item.AssetID == UUID.Zero)
759 { 752 {
760 item.AssetID = m_items[item.ItemID].AssetID; 753 item.AssetID = m_items[item.ItemID].AssetID;
@@ -1114,6 +1107,30 @@ namespace OpenSim.Region.Framework.Scenes
1114 1107
1115 return ret; 1108 return ret;
1116 } 1109 }
1110
1111 public List<TaskInventoryItem> GetInventoryItems()
1112 {
1113 List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
1114
1115 lock (m_items)
1116 ret = new List<TaskInventoryItem>(m_items.Values);
1117
1118 return ret;
1119 }
1120
1121 public List<TaskInventoryItem> GetInventoryScripts()
1122 {
1123 List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
1124
1125 lock (m_items)
1126 {
1127 foreach (TaskInventoryItem item in m_items.Values)
1128 if (item.InvType == (int)InventoryType.LSL)
1129 ret.Add(item);
1130 }
1131
1132 return ret;
1133 }
1117 1134
1118 public Dictionary<UUID, string> GetScriptStates() 1135 public Dictionary<UUID, string> GetScriptStates()
1119 { 1136 {
@@ -1181,10 +1198,11 @@ namespace OpenSim.Region.Framework.Scenes
1181 engine.ResumeScript(item.ItemID); 1198 engine.ResumeScript(item.ItemID);
1182 } 1199 }
1183 } 1200 }
1184 } 1201 }
1185 } 1202 }
1186 1203
1187 Items.LockItemsForRead(false); 1204 Items.LockItemsForRead(false);
1188 } 1205 }
1206
1189 } 1207 }
1190} 1208}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 138bcc9..1d4c235 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -6134,6 +6134,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6134 PSYS_PART_MAX_AGE = 7, 6134 PSYS_PART_MAX_AGE = 7,
6135 PSYS_SRC_ACCEL = 8, 6135 PSYS_SRC_ACCEL = 8,
6136 PSYS_SRC_PATTERN = 9, 6136 PSYS_SRC_PATTERN = 9,
6137 PSYS_SRC_INNERANGLE = 10,
6138 PSYS_SRC_OUTERANGLE = 11,
6137 PSYS_SRC_TEXTURE = 12, 6139 PSYS_SRC_TEXTURE = 12,
6138 PSYS_SRC_BURST_RATE = 13, 6140 PSYS_SRC_BURST_RATE = 13,
6139 PSYS_SRC_BURST_PART_COUNT = 15, 6141 PSYS_SRC_BURST_PART_COUNT = 15,
@@ -6266,6 +6268,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6266 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi; 6268 prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
6267 break; 6269 break;
6268 6270
6271 // PSYS_SRC_INNERANGLE and PSYS_SRC_ANGLE_BEGIN use the same variables. The
6272 // PSYS_SRC_OUTERANGLE and PSYS_SRC_ANGLE_END also use the same variable. The
6273 // client tells the difference between the two by looking at the 0x02 bit in
6274 // the PartFlags variable.
6275 case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE:
6276 tempf = (float)rules.GetLSLFloatItem(i + 1);
6277 prules.InnerAngle = (float)tempf;
6278 prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
6279 break;
6280
6281 case (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE:
6282 tempf = (float)rules.GetLSLFloatItem(i + 1);
6283 prules.OuterAngle = (float)tempf;
6284 prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
6285 break;
6286
6269 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE: 6287 case (int)ScriptBaseClass.PSYS_SRC_TEXTURE:
6270 prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1)); 6288 prules.Texture = KeyOrName(rules.GetLSLStringItem(i + 1));
6271 break; 6289 break;
@@ -6322,11 +6340,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6322 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN: 6340 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_BEGIN:
6323 tempf = (float)rules.GetLSLFloatItem(i + 1); 6341 tempf = (float)rules.GetLSLFloatItem(i + 1);
6324 prules.InnerAngle = (float)tempf; 6342 prules.InnerAngle = (float)tempf;
6343 prules.PartFlags |= 0x02; // Set new angle format.
6325 break; 6344 break;
6326 6345
6327 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END: 6346 case (int)ScriptBaseClass.PSYS_SRC_ANGLE_END:
6328 tempf = (float)rules.GetLSLFloatItem(i + 1); 6347 tempf = (float)rules.GetLSLFloatItem(i + 1);
6329 prules.OuterAngle = (float)tempf; 6348 prules.OuterAngle = (float)tempf;
6349 prules.PartFlags |= 0x02; // Set new angle format.
6330 break; 6350 break;
6331 6351
6332 case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE: 6352 case (int)ScriptBaseClass.PSYS_SRC_INNERANGLE:
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index d4c1727..916e27f 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -769,8 +769,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
769 } 769 }
770 } 770 }
771 771
772
773
774 ScriptInstance instance = null; 772 ScriptInstance instance = null;
775 // Create the object record 773 // Create the object record
776 lockScriptsForRead(true); 774 lockScriptsForRead(true);
@@ -952,7 +950,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
952 950
953 CleanAssemblies(); 951 CleanAssemblies();
954 952
955
956 ScriptRemoved handlerScriptRemoved = OnScriptRemoved; 953 ScriptRemoved handlerScriptRemoved = OnScriptRemoved;
957 if (handlerScriptRemoved != null) 954 if (handlerScriptRemoved != null)
958 handlerScriptRemoved(itemID); 955 handlerScriptRemoved(itemID);
@@ -1086,26 +1083,33 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1086 public bool PostObjectEvent(uint localID, EventParams p) 1083 public bool PostObjectEvent(uint localID, EventParams p)
1087 { 1084 {
1088 bool result = false; 1085 bool result = false;
1089 1086 List<UUID> uuids = null;
1087
1090 lock (m_PrimObjects) 1088 lock (m_PrimObjects)
1091 { 1089 {
1092 if (!m_PrimObjects.ContainsKey(localID)) 1090 if (!m_PrimObjects.ContainsKey(localID))
1093 return false; 1091 return false;
1094 1092
1095 1093 uuids = m_PrimObjects[localID];
1096 foreach (UUID itemID in m_PrimObjects[localID]) 1094 }
1095
1096 foreach (UUID itemID in uuids)
1097 {
1098 IScriptInstance instance = null;
1099 try
1097 { 1100 {
1098 if (m_Scripts.ContainsKey(itemID)) 1101 if (m_Scripts.ContainsKey(itemID))
1099 { 1102 instance = m_Scripts[itemID];
1100 IScriptInstance instance = m_Scripts[itemID]; 1103 }
1101 if (instance != null) 1104 catch { /* ignore race conditions */ }
1102 { 1105
1103 instance.PostEvent(p); 1106 if (instance != null)
1104 result = true; 1107 {
1105 } 1108 instance.PostEvent(p);
1106 } 1109 result = true;
1107 } 1110 }
1108 } 1111 }
1112
1109 return result; 1113 return result;
1110 } 1114 }
1111 1115