diff options
Diffstat (limited to '')
7 files changed, 249 insertions, 95 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 8560c73..0ee7606 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
91 | /// Constructor | 91 | /// Constructor |
92 | /// </summary> | 92 | /// </summary> |
93 | public InventoryArchiveWriteRequest( | 93 | public InventoryArchiveWriteRequest( |
94 | Guid id, InventoryArchiverModule module, Scene scene, | 94 | Guid id, InventoryArchiverModule module, Scene scene, |
95 | UserAccount userInfo, string invPath, string savePath) | 95 | UserAccount userInfo, string invPath, string savePath) |
96 | : this( | 96 | : this( |
97 | id, | 97 | id, |
@@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
107 | /// Constructor | 107 | /// Constructor |
108 | /// </summary> | 108 | /// </summary> |
109 | public InventoryArchiveWriteRequest( | 109 | public InventoryArchiveWriteRequest( |
110 | Guid id, InventoryArchiverModule module, Scene scene, | 110 | Guid id, InventoryArchiverModule module, Scene scene, |
111 | UserAccount userInfo, string invPath, Stream saveStream) | 111 | UserAccount userInfo, string invPath, Stream saveStream) |
112 | { | 112 | { |
113 | m_id = id; | 113 | m_id = id; |
@@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
125 | { | 125 | { |
126 | Exception reportedException = null; | 126 | Exception reportedException = null; |
127 | bool succeeded = true; | 127 | bool succeeded = true; |
128 | 128 | ||
129 | try | 129 | try |
130 | { | 130 | { |
131 | m_archiveWriter.Close(); | 131 | m_archiveWriter.Close(); |
@@ -146,6 +146,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
146 | 146 | ||
147 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) | 147 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) |
148 | { | 148 | { |
149 | if (options.ContainsKey("exclude")) | ||
150 | { | ||
151 | if (((List<String>)options["exclude"]).Contains(inventoryItem.Name) || | ||
152 | ((List<String>)options["exclude"]).Contains(inventoryItem.ID.ToString())) | ||
153 | { | ||
154 | if (options.ContainsKey("verbose")) | ||
155 | { | ||
156 | m_log.InfoFormat( | ||
157 | "[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}", | ||
158 | inventoryItem.Name, inventoryItem.ID, path); | ||
159 | } | ||
160 | return; | ||
161 | } | ||
162 | } | ||
163 | |||
149 | if (options.ContainsKey("verbose")) | 164 | if (options.ContainsKey("verbose")) |
150 | m_log.InfoFormat( | 165 | m_log.InfoFormat( |
151 | "[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}", | 166 | "[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}", |
@@ -175,9 +190,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
175 | /// <param name="options"></param> | 190 | /// <param name="options"></param> |
176 | /// <param name="userAccountService"></param> | 191 | /// <param name="userAccountService"></param> |
177 | protected void SaveInvFolder( | 192 | protected void SaveInvFolder( |
178 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, | 193 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, |
179 | Dictionary<string, object> options, IUserAccountService userAccountService) | 194 | Dictionary<string, object> options, IUserAccountService userAccountService) |
180 | { | 195 | { |
196 | if (options.ContainsKey("excludefolders")) | ||
197 | { | ||
198 | if (((List<String>)options["excludefolders"]).Contains(inventoryFolder.Name) || | ||
199 | ((List<String>)options["excludefolders"]).Contains(inventoryFolder.ID.ToString())) | ||
200 | { | ||
201 | if (options.ContainsKey("verbose")) | ||
202 | { | ||
203 | m_log.InfoFormat( | ||
204 | "[INVENTORY ARCHIVER]: Skipping folder {0} at {1}", | ||
205 | inventoryFolder.Name, path); | ||
206 | } | ||
207 | return; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | if (options.ContainsKey("verbose")) | ||
212 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name); | ||
213 | |||
181 | if (saveThisFolderItself) | 214 | if (saveThisFolderItself) |
182 | { | 215 | { |
183 | path += CreateArchiveFolderName(inventoryFolder); | 216 | path += CreateArchiveFolderName(inventoryFolder); |
@@ -186,7 +219,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
186 | m_archiveWriter.WriteDir(path); | 219 | m_archiveWriter.WriteDir(path); |
187 | } | 220 | } |
188 | 221 | ||
189 | InventoryCollection contents | 222 | InventoryCollection contents |
190 | = m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID); | 223 | = m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID); |
191 | 224 | ||
192 | foreach (InventoryFolderBase childFolder in contents.Folders) | 225 | foreach (InventoryFolderBase childFolder in contents.Folders) |
@@ -213,16 +246,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
213 | InventoryFolderBase inventoryFolder = null; | 246 | InventoryFolderBase inventoryFolder = null; |
214 | InventoryItemBase inventoryItem = null; | 247 | InventoryItemBase inventoryItem = null; |
215 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); | 248 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); |
216 | 249 | ||
217 | bool saveFolderContentsOnly = false; | 250 | bool saveFolderContentsOnly = false; |
218 | 251 | ||
219 | // Eliminate double slashes and any leading / on the path. | 252 | // Eliminate double slashes and any leading / on the path. |
220 | string[] components | 253 | string[] components |
221 | = m_invPath.Split( | 254 | = m_invPath.Split( |
222 | new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); | 255 | new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); |
223 | 256 | ||
224 | int maxComponentIndex = components.Length - 1; | 257 | int maxComponentIndex = components.Length - 1; |
225 | 258 | ||
226 | // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the | 259 | // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the |
227 | // folder itself. This may get more sophisicated later on | 260 | // folder itself. This may get more sophisicated later on |
228 | if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) | 261 | if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) |
@@ -230,13 +263,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
230 | saveFolderContentsOnly = true; | 263 | saveFolderContentsOnly = true; |
231 | maxComponentIndex--; | 264 | maxComponentIndex--; |
232 | } | 265 | } |
233 | 266 | ||
234 | m_invPath = String.Empty; | 267 | m_invPath = String.Empty; |
235 | for (int i = 0; i <= maxComponentIndex; i++) | 268 | for (int i = 0; i <= maxComponentIndex; i++) |
236 | { | 269 | { |
237 | m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER; | 270 | m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER; |
238 | } | 271 | } |
239 | 272 | ||
240 | // Annoyingly Split actually returns the original string if the input string consists only of delimiters | 273 | // Annoyingly Split actually returns the original string if the input string consists only of delimiters |
241 | // Therefore if we still start with a / after the split, then we need the root folder | 274 | // Therefore if we still start with a / after the split, then we need the root folder |
242 | if (m_invPath.Length == 0) | 275 | if (m_invPath.Length == 0) |
@@ -246,25 +279,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
246 | else | 279 | else |
247 | { | 280 | { |
248 | m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); | 281 | m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); |
249 | List<InventoryFolderBase> candidateFolders | 282 | List<InventoryFolderBase> candidateFolders |
250 | = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath); | 283 | = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath); |
251 | if (candidateFolders.Count > 0) | 284 | if (candidateFolders.Count > 0) |
252 | inventoryFolder = candidateFolders[0]; | 285 | inventoryFolder = candidateFolders[0]; |
253 | } | 286 | } |
254 | 287 | ||
255 | // The path may point to an item instead | 288 | // The path may point to an item instead |
256 | if (inventoryFolder == null) | 289 | if (inventoryFolder == null) |
257 | inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath); | 290 | inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath); |
258 | 291 | ||
259 | if (null == inventoryFolder && null == inventoryItem) | 292 | if (null == inventoryFolder && null == inventoryItem) |
260 | { | 293 | { |
261 | // We couldn't find the path indicated | 294 | // We couldn't find the path indicated |
262 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); | 295 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); |
263 | Exception e = new InventoryArchiverException(errorMessage); | 296 | Exception e = new InventoryArchiverException(errorMessage); |
264 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); | 297 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); |
265 | throw e; | 298 | throw e; |
266 | } | 299 | } |
267 | 300 | ||
268 | m_archiveWriter = new TarArchiveWriter(m_saveStream); | 301 | m_archiveWriter = new TarArchiveWriter(m_saveStream); |
269 | 302 | ||
270 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Adding control file to archive."); | 303 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Adding control file to archive."); |
@@ -278,10 +311,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
278 | { | 311 | { |
279 | m_log.DebugFormat( | 312 | m_log.DebugFormat( |
280 | "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", | 313 | "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", |
281 | inventoryFolder.Name, | 314 | inventoryFolder.Name, |
282 | inventoryFolder.ID, | 315 | inventoryFolder.ID, |
283 | m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); | 316 | m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); |
284 | 317 | ||
285 | //recurse through all dirs getting dirs and files | 318 | //recurse through all dirs getting dirs and files |
286 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService); | 319 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService); |
287 | } | 320 | } |
@@ -290,10 +323,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
290 | m_log.DebugFormat( | 323 | m_log.DebugFormat( |
291 | "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", | 324 | "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", |
292 | inventoryItem.Name, inventoryItem.ID, m_invPath); | 325 | inventoryItem.Name, inventoryItem.ID, m_invPath); |
293 | 326 | ||
294 | SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH, options, userAccountService); | 327 | SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH, options, userAccountService); |
295 | } | 328 | } |
296 | 329 | ||
297 | // Don't put all this profile information into the archive right now. | 330 | // Don't put all this profile information into the archive right now. |
298 | //SaveUsers(); | 331 | //SaveUsers(); |
299 | 332 | ||
@@ -352,7 +385,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
352 | /// | 385 | /// |
353 | /// These names are prepended with an inventory folder's UUID so that more than one folder can have the | 386 | /// These names are prepended with an inventory folder's UUID so that more than one folder can have the |
354 | /// same name | 387 | /// same name |
355 | /// | 388 | /// |
356 | /// <param name="folder"></param> | 389 | /// <param name="folder"></param> |
357 | /// <returns></returns> | 390 | /// <returns></returns> |
358 | public static string CreateArchiveFolderName(InventoryFolderBase folder) | 391 | public static string CreateArchiveFolderName(InventoryFolderBase folder) |
@@ -366,7 +399,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
366 | /// | 399 | /// |
367 | /// These names are prepended with an inventory item's UUID so that more than one item can have the | 400 | /// These names are prepended with an inventory item's UUID so that more than one item can have the |
368 | /// same name | 401 | /// same name |
369 | /// | 402 | /// |
370 | /// <param name="item"></param> | 403 | /// <param name="item"></param> |
371 | /// <returns></returns> | 404 | /// <returns></returns> |
372 | public static string CreateArchiveItemName(InventoryItemBase item) | 405 | public static string CreateArchiveItemName(InventoryItemBase item) |
@@ -412,7 +445,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
412 | public string CreateControlFile(Dictionary<string, object> options) | 445 | public string CreateControlFile(Dictionary<string, object> options) |
413 | { | 446 | { |
414 | int majorVersion, minorVersion; | 447 | int majorVersion, minorVersion; |
415 | 448 | ||
416 | if (options.ContainsKey("home")) | 449 | if (options.ContainsKey("home")) |
417 | { | 450 | { |
418 | majorVersion = 1; | 451 | majorVersion = 1; |
@@ -422,10 +455,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
422 | { | 455 | { |
423 | majorVersion = 0; | 456 | majorVersion = 0; |
424 | minorVersion = 3; | 457 | minorVersion = 3; |
425 | } | 458 | } |
426 | 459 | ||
427 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); | 460 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); |
428 | 461 | ||
429 | StringWriter sw = new StringWriter(); | 462 | StringWriter sw = new StringWriter(); |
430 | XmlTextWriter xtw = new XmlTextWriter(sw); | 463 | XmlTextWriter xtw = new XmlTextWriter(sw); |
431 | xtw.Formatting = Formatting.Indented; | 464 | xtw.Formatting = Formatting.Indented; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index ac22c3f..cf87010 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -47,18 +47,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
47 | public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule | 47 | public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | public string Name { get { return "Inventory Archiver Module"; } } | 51 | public string Name { get { return "Inventory Archiver Module"; } } |
52 | 52 | ||
53 | public bool IsSharedModule { get { return true; } } | 53 | public bool IsSharedModule { get { return true; } } |
54 | 54 | ||
55 | /// <value> | 55 | /// <value> |
56 | /// Enable or disable checking whether the iar user is actually logged in | 56 | /// Enable or disable checking whether the iar user is actually logged in |
57 | /// </value> | 57 | /// </value> |
58 | // public bool DisablePresenceChecks { get; set; } | 58 | // public bool DisablePresenceChecks { get; set; } |
59 | 59 | ||
60 | public event InventoryArchiveSaved OnInventoryArchiveSaved; | 60 | public event InventoryArchiveSaved OnInventoryArchiveSaved; |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// The file to load and save inventory if no filename has been specified | 63 | /// The file to load and save inventory if no filename has been specified |
64 | /// </summary> | 64 | /// </summary> |
@@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
68 | /// Pending save completions initiated from the console | 68 | /// Pending save completions initiated from the console |
69 | /// </value> | 69 | /// </value> |
70 | protected List<Guid> m_pendingConsoleSaves = new List<Guid>(); | 70 | protected List<Guid> m_pendingConsoleSaves = new List<Guid>(); |
71 | 71 | ||
72 | /// <value> | 72 | /// <value> |
73 | /// All scenes that this module knows about | 73 | /// All scenes that this module knows about |
74 | /// </value> | 74 | /// </value> |
@@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
106 | { | 106 | { |
107 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); | 107 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); |
108 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; | 108 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; |
109 | 109 | ||
110 | scene.AddCommand( | 110 | scene.AddCommand( |
111 | "Archiving", this, "load iar", | 111 | "Archiving", this, "load iar", |
112 | "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", | 112 | "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]", |
@@ -119,11 +119,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
119 | + "<IAR path> is the filesystem path or URI from which to load the IAR." | 119 | + "<IAR path> is the filesystem path or URI from which to load the IAR." |
120 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), | 120 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), |
121 | HandleLoadInvConsoleCommand); | 121 | HandleLoadInvConsoleCommand); |
122 | 122 | ||
123 | scene.AddCommand( | 123 | scene.AddCommand( |
124 | "Archiving", this, "save iar", | 124 | "Archiving", this, "save iar", |
125 | "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-v|--verbose]", | 125 | "save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]", |
126 | "Save user inventory archive (IAR).", | 126 | "Save user inventory archive (IAR).", |
127 | "<first> is the user's first name.\n" | 127 | "<first> is the user's first name.\n" |
128 | + "<last> is the user's last name.\n" | 128 | + "<last> is the user's last name.\n" |
129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n" | 129 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved.\n" |
@@ -131,32 +131,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
131 | + string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME) | 131 | + string.Format(" If this is not given then the filename {0} in the current directory is used.\n", DEFAULT_INV_BACKUP_FILENAME) |
132 | + "-h|--home=<url> adds the url of the profile service to the saved user information.\n" | 132 | + "-h|--home=<url> adds the url of the profile service to the saved user information.\n" |
133 | + "-c|--creators preserves information about foreign creators.\n" | 133 | + "-c|--creators preserves information about foreign creators.\n" |
134 | + "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine | ||
135 | + "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine | ||
134 | + "-v|--verbose extra debug messages.\n" | 136 | + "-v|--verbose extra debug messages.\n" |
135 | + "--noassets stops assets being saved to the IAR.", | 137 | + "--noassets stops assets being saved to the IAR.", |
136 | HandleSaveInvConsoleCommand); | 138 | HandleSaveInvConsoleCommand); |
137 | 139 | ||
138 | m_aScene = scene; | 140 | m_aScene = scene; |
139 | } | 141 | } |
140 | 142 | ||
141 | m_scenes[scene.RegionInfo.RegionID] = scene; | 143 | m_scenes[scene.RegionInfo.RegionID] = scene; |
142 | } | 144 | } |
143 | 145 | ||
144 | public void PostInitialise() {} | 146 | public void PostInitialise() {} |
145 | 147 | ||
146 | public void Close() {} | 148 | public void Close() {} |
147 | 149 | ||
148 | /// <summary> | 150 | /// <summary> |
149 | /// Trigger the inventory archive saved event. | 151 | /// Trigger the inventory archive saved event. |
150 | /// </summary> | 152 | /// </summary> |
151 | protected internal void TriggerInventoryArchiveSaved( | 153 | protected internal void TriggerInventoryArchiveSaved( |
152 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 154 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
153 | Exception reportedException) | 155 | Exception reportedException) |
154 | { | 156 | { |
155 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; | 157 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; |
156 | if (handlerInventoryArchiveSaved != null) | 158 | if (handlerInventoryArchiveSaved != null) |
157 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); | 159 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); |
158 | } | 160 | } |
159 | 161 | ||
160 | public bool ArchiveInventory( | 162 | public bool ArchiveInventory( |
161 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) | 163 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) |
162 | { | 164 | { |
@@ -164,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
164 | } | 166 | } |
165 | 167 | ||
166 | public bool ArchiveInventory( | 168 | public bool ArchiveInventory( |
167 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, | 169 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, |
168 | Dictionary<string, object> options) | 170 | Dictionary<string, object> options) |
169 | { | 171 | { |
170 | if (m_scenes.Count > 0) | 172 | if (m_scenes.Count > 0) |
@@ -188,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
188 | 190 | ||
189 | return false; | 191 | return false; |
190 | } | 192 | } |
191 | 193 | ||
192 | return true; | 194 | return true; |
193 | // } | 195 | // } |
194 | // else | 196 | // else |
@@ -202,15 +204,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
202 | 204 | ||
203 | return false; | 205 | return false; |
204 | } | 206 | } |
205 | 207 | ||
206 | public bool ArchiveInventory( | 208 | public bool ArchiveInventory( |
207 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, | 209 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, |
208 | Dictionary<string, object> options) | 210 | Dictionary<string, object> options) |
209 | { | 211 | { |
210 | if (m_scenes.Count > 0) | 212 | if (m_scenes.Count > 0) |
211 | { | 213 | { |
212 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 214 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
213 | 215 | ||
214 | if (userInfo != null) | 216 | if (userInfo != null) |
215 | { | 217 | { |
216 | // if (CheckPresence(userInfo.PrincipalID)) | 218 | // if (CheckPresence(userInfo.PrincipalID)) |
@@ -228,7 +230,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
228 | 230 | ||
229 | return false; | 231 | return false; |
230 | } | 232 | } |
231 | 233 | ||
232 | return true; | 234 | return true; |
233 | // } | 235 | // } |
234 | // else | 236 | // else |
@@ -239,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
239 | // } | 241 | // } |
240 | } | 242 | } |
241 | } | 243 | } |
242 | 244 | ||
243 | return false; | 245 | return false; |
244 | } | 246 | } |
245 | 247 | ||
@@ -247,9 +249,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
247 | { | 249 | { |
248 | return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); | 250 | return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); |
249 | } | 251 | } |
250 | 252 | ||
251 | public bool DearchiveInventory( | 253 | public bool DearchiveInventory( |
252 | string firstName, string lastName, string invPath, string pass, Stream loadStream, | 254 | string firstName, string lastName, string invPath, string pass, Stream loadStream, |
253 | Dictionary<string, object> options) | 255 | Dictionary<string, object> options) |
254 | { | 256 | { |
255 | if (m_scenes.Count > 0) | 257 | if (m_scenes.Count > 0) |
@@ -295,22 +297,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
295 | 297 | ||
296 | return false; | 298 | return false; |
297 | } | 299 | } |
298 | 300 | ||
299 | public bool DearchiveInventory( | 301 | public bool DearchiveInventory( |
300 | string firstName, string lastName, string invPath, string pass, string loadPath, | 302 | string firstName, string lastName, string invPath, string pass, string loadPath, |
301 | Dictionary<string, object> options) | 303 | Dictionary<string, object> options) |
302 | { | 304 | { |
303 | if (m_scenes.Count > 0) | 305 | if (m_scenes.Count > 0) |
304 | { | 306 | { |
305 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 307 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
306 | 308 | ||
307 | if (userInfo != null) | 309 | if (userInfo != null) |
308 | { | 310 | { |
309 | // if (CheckPresence(userInfo.PrincipalID)) | 311 | // if (CheckPresence(userInfo.PrincipalID)) |
310 | // { | 312 | // { |
311 | InventoryArchiveReadRequest request; | 313 | InventoryArchiveReadRequest request; |
312 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); | 314 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); |
313 | 315 | ||
314 | try | 316 | try |
315 | { | 317 | { |
316 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); | 318 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); |
@@ -324,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
324 | 326 | ||
325 | return false; | 327 | return false; |
326 | } | 328 | } |
327 | 329 | ||
328 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 330 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
329 | 331 | ||
330 | return true; | 332 | return true; |
@@ -340,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
340 | 342 | ||
341 | return false; | 343 | return false; |
342 | } | 344 | } |
343 | 345 | ||
344 | /// <summary> | 346 | /// <summary> |
345 | /// Load inventory from an inventory file archive | 347 | /// Load inventory from an inventory file archive |
346 | /// </summary> | 348 | /// </summary> |
@@ -351,26 +353,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
351 | { | 353 | { |
352 | Dictionary<string, object> options = new Dictionary<string, object>(); | 354 | Dictionary<string, object> options = new Dictionary<string, object>(); |
353 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); | 355 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); |
354 | 356 | ||
355 | List<string> mainParams = optionSet.Parse(cmdparams); | 357 | List<string> mainParams = optionSet.Parse(cmdparams); |
356 | 358 | ||
357 | if (mainParams.Count < 6) | 359 | if (mainParams.Count < 6) |
358 | { | 360 | { |
359 | m_log.Error( | 361 | m_log.Error( |
360 | "[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); | 362 | "[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); |
361 | return; | 363 | return; |
362 | } | 364 | } |
363 | 365 | ||
364 | string firstName = mainParams[2]; | 366 | string firstName = mainParams[2]; |
365 | string lastName = mainParams[3]; | 367 | string lastName = mainParams[3]; |
366 | string invPath = mainParams[4]; | 368 | string invPath = mainParams[4]; |
367 | string pass = mainParams[5]; | 369 | string pass = mainParams[5]; |
368 | string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); | 370 | string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); |
369 | 371 | ||
370 | m_log.InfoFormat( | 372 | m_log.InfoFormat( |
371 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", | 373 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", |
372 | loadPath, invPath, firstName, lastName); | 374 | loadPath, invPath, firstName, lastName); |
373 | 375 | ||
374 | if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) | 376 | if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) |
375 | m_log.InfoFormat( | 377 | m_log.InfoFormat( |
376 | "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", | 378 | "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", |
@@ -381,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
381 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); | 383 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); |
382 | } | 384 | } |
383 | } | 385 | } |
384 | 386 | ||
385 | /// <summary> | 387 | /// <summary> |
386 | /// Save inventory to a file archive | 388 | /// Save inventory to a file archive |
387 | /// </summary> | 389 | /// </summary> |
@@ -398,6 +400,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
398 | ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); | 400 | ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); |
399 | ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); | 401 | ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); |
400 | ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); | 402 | ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); |
403 | ops.Add("e|exclude=", delegate(string v) | ||
404 | { | ||
405 | if (!options.ContainsKey("exclude")) | ||
406 | options["exclude"] = new List<String>(); | ||
407 | ((List<String>)options["exclude"]).Add(v); | ||
408 | }); | ||
409 | ops.Add("f|excludefolder=", delegate(string v) | ||
410 | { | ||
411 | if (!options.ContainsKey("excludefolders")) | ||
412 | options["excludefolders"] = new List<String>(); | ||
413 | ((List<String>)options["excludefolders"]).Add(v); | ||
414 | }); | ||
401 | 415 | ||
402 | List<string> mainParams = ops.Parse(cmdparams); | 416 | List<string> mainParams = ops.Parse(cmdparams); |
403 | 417 | ||
@@ -406,10 +420,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
406 | if (mainParams.Count < 6) | 420 | if (mainParams.Count < 6) |
407 | { | 421 | { |
408 | m_log.Error( | 422 | m_log.Error( |
409 | "[INVENTORY ARCHIVER]: usage is save iar [-h|--home=<url>] [--noassets] <first name> <last name> <inventory path> <user password> [<save file path>] [-c|--creators] [-v|--verbose]"); | 423 | "[INVENTORY ARCHIVER]: save iar [-h|--home=<url>] [--noassets] <first> <last> <inventory path> <password> [<IAR path>] [-c|--creators] [-e|--exclude=<name/uuid>] [-f|--excludefolder=<foldername/uuid>] [-v|--verbose]"); |
410 | return; | 424 | return; |
411 | } | 425 | } |
412 | 426 | ||
413 | if (options.ContainsKey("home")) | 427 | if (options.ContainsKey("home")) |
414 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); | 428 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); |
415 | 429 | ||
@@ -418,7 +432,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
418 | string invPath = mainParams[4]; | 432 | string invPath = mainParams[4]; |
419 | string pass = mainParams[5]; | 433 | string pass = mainParams[5]; |
420 | string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); | 434 | string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); |
421 | 435 | ||
422 | m_log.InfoFormat( | 436 | m_log.InfoFormat( |
423 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", | 437 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", |
424 | savePath, invPath, firstName, lastName); | 438 | savePath, invPath, firstName, lastName); |
@@ -433,9 +447,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
433 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); | 447 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message); |
434 | } | 448 | } |
435 | } | 449 | } |
436 | 450 | ||
437 | private void SaveInvConsoleCommandCompleted( | 451 | private void SaveInvConsoleCommandCompleted( |
438 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 452 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
439 | Exception reportedException) | 453 | Exception reportedException) |
440 | { | 454 | { |
441 | lock (m_pendingConsoleSaves) | 455 | lock (m_pendingConsoleSaves) |
@@ -445,7 +459,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
445 | else | 459 | else |
446 | return; | 460 | return; |
447 | } | 461 | } |
448 | 462 | ||
449 | if (succeeded) | 463 | if (succeeded) |
450 | { | 464 | { |
451 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName); | 465 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName); |
@@ -453,11 +467,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
453 | else | 467 | else |
454 | { | 468 | { |
455 | m_log.ErrorFormat( | 469 | m_log.ErrorFormat( |
456 | "[INVENTORY ARCHIVER]: Archive save for {0} {1} failed - {2}", | 470 | "[INVENTORY ARCHIVER]: Archive save for {0} {1} failed - {2}", |
457 | userInfo.FirstName, userInfo.LastName, reportedException.Message); | 471 | userInfo.FirstName, userInfo.LastName, reportedException.Message); |
458 | } | 472 | } |
459 | } | 473 | } |
460 | 474 | ||
461 | /// <summary> | 475 | /// <summary> |
462 | /// Get user information for the given name. | 476 | /// Get user information for the given name. |
463 | /// </summary> | 477 | /// </summary> |
@@ -467,13 +481,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
467 | /// <returns></returns> | 481 | /// <returns></returns> |
468 | protected UserAccount GetUserInfo(string firstName, string lastName, string pass) | 482 | protected UserAccount GetUserInfo(string firstName, string lastName, string pass) |
469 | { | 483 | { |
470 | UserAccount account | 484 | UserAccount account |
471 | = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); | 485 | = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, firstName, lastName); |
472 | 486 | ||
473 | if (null == account) | 487 | if (null == account) |
474 | { | 488 | { |
475 | m_log.ErrorFormat( | 489 | m_log.ErrorFormat( |
476 | "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}", | 490 | "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1}", |
477 | firstName, lastName); | 491 | firstName, lastName); |
478 | return null; | 492 | return null; |
479 | } | 493 | } |
@@ -488,7 +502,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
488 | else | 502 | else |
489 | { | 503 | { |
490 | m_log.ErrorFormat( | 504 | m_log.ErrorFormat( |
491 | "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", | 505 | "[INVENTORY ARCHIVER]: Password for user {0} {1} incorrect. Please try again.", |
492 | firstName, lastName); | 506 | firstName, lastName); |
493 | return null; | 507 | return null; |
494 | } | 508 | } |
@@ -499,7 +513,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
499 | return null; | 513 | return null; |
500 | } | 514 | } |
501 | } | 515 | } |
502 | 516 | ||
503 | /// <summary> | 517 | /// <summary> |
504 | /// Notify the client of loaded nodes if they are logged in | 518 | /// Notify the client of loaded nodes if they are logged in |
505 | /// </summary> | 519 | /// </summary> |
@@ -508,22 +522,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
508 | { | 522 | { |
509 | if (loadedNodes.Count == 0) | 523 | if (loadedNodes.Count == 0) |
510 | return; | 524 | return; |
511 | 525 | ||
512 | foreach (Scene scene in m_scenes.Values) | 526 | foreach (Scene scene in m_scenes.Values) |
513 | { | 527 | { |
514 | ScenePresence user = scene.GetScenePresence(userInfo.PrincipalID); | 528 | ScenePresence user = scene.GetScenePresence(userInfo.PrincipalID); |
515 | 529 | ||
516 | if (user != null && !user.IsChildAgent) | 530 | if (user != null && !user.IsChildAgent) |
517 | { | 531 | { |
518 | foreach (InventoryNodeBase node in loadedNodes) | 532 | foreach (InventoryNodeBase node in loadedNodes) |
519 | { | 533 | { |
520 | // m_log.DebugFormat( | 534 | // m_log.DebugFormat( |
521 | // "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}", | 535 | // "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}", |
522 | // user.Name, node.Name); | 536 | // user.Name, node.Name); |
523 | 537 | ||
524 | user.ControllingClient.SendBulkUpdateInventory(node); | 538 | user.ControllingClient.SendBulkUpdateInventory(node); |
525 | } | 539 | } |
526 | 540 | ||
527 | break; | 541 | break; |
528 | } | 542 | } |
529 | } | 543 | } |
@@ -538,7 +552,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
538 | // { | 552 | // { |
539 | // if (DisablePresenceChecks) | 553 | // if (DisablePresenceChecks) |
540 | // return true; | 554 | // return true; |
541 | // | 555 | // |
542 | // foreach (Scene scene in m_scenes.Values) | 556 | // foreach (Scene scene in m_scenes.Values) |
543 | // { | 557 | // { |
544 | // ScenePresence p; | 558 | // ScenePresence p; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs new file mode 100644 index 0000000..10c78b5 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs | |||
@@ -0,0 +1,65 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using System.Threading; | ||
31 | using NUnit.Framework; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Tests.Common; | ||
37 | using OpenSim.Tests.Common.Mock; | ||
38 | |||
39 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.) | ||
43 | /// </summary> | ||
44 | [TestFixture] | ||
45 | public class SceneObjectSpatialTests | ||
46 | { | ||
47 | [Test] | ||
48 | public void TestGetRootPartPosition() | ||
49 | { | ||
50 | TestHelpers.InMethod(); | ||
51 | |||
52 | Scene scene = SceneHelpers.SetupScene(); | ||
53 | UUID ownerId = TestHelpers.ParseTail(0x1); | ||
54 | Vector3 partPosition = new Vector3(10, 20, 30); | ||
55 | |||
56 | SceneObjectGroup so | ||
57 | = SceneHelpers.CreateSceneObject(1, ownerId, "obj1", 0x10); | ||
58 | so.AbsolutePosition = partPosition; | ||
59 | scene.AddNewSceneObject(so, false); | ||
60 | |||
61 | Assert.That(so.AbsolutePosition, Is.EqualTo(partPosition)); | ||
62 | Assert.That(so.RootPart.AbsolutePosition, Is.EqualTo(partPosition)); | ||
63 | } | ||
64 | } | ||
65 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 23158b9..9564d46 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -12019,35 +12019,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
12019 | return 1; | 12019 | return 1; |
12020 | } | 12020 | } |
12021 | 12021 | ||
12022 | #region Not Implemented | 12022 | public LSL_Integer llGetMemoryLimit() |
12023 | // | 12023 | { |
12024 | // Listing the unimplemented lsl functions here, please move | 12024 | m_host.AddScriptLPS(1); |
12025 | // them from this region as they are completed | 12025 | // The value returned for LSO scripts in SL |
12026 | // | 12026 | return 16384; |
12027 | } | ||
12027 | 12028 | ||
12028 | public void llGetEnv(LSL_String name) | 12029 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) |
12029 | { | 12030 | { |
12030 | m_host.AddScriptLPS(1); | 12031 | m_host.AddScriptLPS(1); |
12031 | NotImplemented("llGetEnv"); | 12032 | // Treat as an LSO script |
12033 | return ScriptBaseClass.FALSE; | ||
12032 | } | 12034 | } |
12033 | 12035 | ||
12034 | public void llGetSPMaxMemory() | 12036 | public LSL_Integer llGetSPMaxMemory() |
12035 | { | 12037 | { |
12036 | m_host.AddScriptLPS(1); | 12038 | m_host.AddScriptLPS(1); |
12037 | NotImplemented("llGetSPMaxMemory"); | 12039 | // The value returned for LSO scripts in SL |
12040 | return 16384; | ||
12038 | } | 12041 | } |
12039 | 12042 | ||
12040 | public virtual LSL_Integer llGetUsedMemory() | 12043 | public virtual LSL_Integer llGetUsedMemory() |
12041 | { | 12044 | { |
12042 | m_host.AddScriptLPS(1); | 12045 | m_host.AddScriptLPS(1); |
12043 | NotImplemented("llGetUsedMemory"); | 12046 | // The value returned for LSO scripts in SL |
12044 | return 0; | 12047 | return 16384; |
12045 | } | 12048 | } |
12046 | 12049 | ||
12047 | public void llScriptProfiler(LSL_Integer flags) | 12050 | public void llScriptProfiler(LSL_Integer flags) |
12048 | { | 12051 | { |
12049 | m_host.AddScriptLPS(1); | 12052 | m_host.AddScriptLPS(1); |
12050 | //NotImplemented("llScriptProfiler"); | 12053 | // This does nothing for LSO scripts in SL |
12054 | } | ||
12055 | |||
12056 | #region Not Implemented | ||
12057 | // | ||
12058 | // Listing the unimplemented lsl functions here, please move | ||
12059 | // them from this region as they are completed | ||
12060 | // | ||
12061 | |||
12062 | public void llGetEnv(LSL_String name) | ||
12063 | { | ||
12064 | m_host.AddScriptLPS(1); | ||
12065 | NotImplemented("llGetEnv"); | ||
12051 | } | 12066 | } |
12052 | 12067 | ||
12053 | public void llSetSoundQueueing(int queue) | 12068 | public void llSetSoundQueueing(int queue) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 5c528977..eab6851 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -149,7 +149,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
149 | LSL_Rotation llGetLocalRot(); | 149 | LSL_Rotation llGetLocalRot(); |
150 | LSL_Float llGetMass(); | 150 | LSL_Float llGetMass(); |
151 | LSL_Float llGetMassMKS(); | 151 | LSL_Float llGetMassMKS(); |
152 | void llGetNextEmail(string address, string subject); | 152 | LSL_Integer llGetMemoryLimit(); |
153 | void llGetNextEmail(string address, string subject); | ||
153 | LSL_String llGetNotecardLine(string name, int line); | 154 | LSL_String llGetNotecardLine(string name, int line); |
154 | LSL_Key llGetNumberOfNotecardLines(string name); | 155 | LSL_Key llGetNumberOfNotecardLines(string name); |
155 | LSL_Integer llGetNumberOfPrims(); | 156 | LSL_Integer llGetNumberOfPrims(); |
@@ -187,6 +188,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
187 | LSL_String llGetScriptName(); | 188 | LSL_String llGetScriptName(); |
188 | LSL_Integer llGetScriptState(string name); | 189 | LSL_Integer llGetScriptState(string name); |
189 | LSL_String llGetSimulatorHostname(); | 190 | LSL_String llGetSimulatorHostname(); |
191 | LSL_Integer llGetSPMaxMemory(); | ||
190 | LSL_Integer llGetStartParameter(); | 192 | LSL_Integer llGetStartParameter(); |
191 | LSL_Integer llGetStatus(int status); | 193 | LSL_Integer llGetStatus(int status); |
192 | LSL_String llGetSubString(string src, int start, int end); | 194 | LSL_String llGetSubString(string src, int start, int end); |
@@ -322,6 +324,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
322 | void llSay(int channelID, string text); | 324 | void llSay(int channelID, string text); |
323 | void llScaleTexture(double u, double v, int face); | 325 | void llScaleTexture(double u, double v, int face); |
324 | LSL_Integer llScriptDanger(LSL_Vector pos); | 326 | LSL_Integer llScriptDanger(LSL_Vector pos); |
327 | void llScriptProfiler(LSL_Integer flag); | ||
325 | LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); | 328 | LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata); |
326 | void llSensor(string name, string id, int type, double range, double arc); | 329 | void llSensor(string name, string id, int type, double range, double arc); |
327 | void llSensorRemove(); | 330 | void llSensorRemove(); |
@@ -345,6 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
345 | void llSetLinkTexture(int linknumber, string texture, int face); | 348 | void llSetLinkTexture(int linknumber, string texture, int face); |
346 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); | 349 | void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); |
347 | void llSetLocalRot(LSL_Rotation rot); | 350 | void llSetLocalRot(LSL_Rotation rot); |
351 | LSL_Integer llSetMemoryLimit(LSL_Integer limit); | ||
348 | void llSetObjectDesc(string desc); | 352 | void llSetObjectDesc(string desc); |
349 | void llSetObjectName(string name); | 353 | void llSetObjectName(string name); |
350 | void llSetObjectPermMask(int mask, int value); | 354 | void llSetObjectPermMask(int mask, int value); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 6246b57..23b4336 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -383,6 +383,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
383 | public const int PRIM_SCULPT_FLAG_INVERT = 64; | 383 | public const int PRIM_SCULPT_FLAG_INVERT = 64; |
384 | public const int PRIM_SCULPT_FLAG_MIRROR = 128; | 384 | public const int PRIM_SCULPT_FLAG_MIRROR = 128; |
385 | 385 | ||
386 | public const int PROFILE_NONE = 0; | ||
387 | public const int PROFILE_SCRIPT_MEMORY = 1; | ||
388 | |||
386 | public const int MASK_BASE = 0; | 389 | public const int MASK_BASE = 0; |
387 | public const int MASK_OWNER = 1; | 390 | public const int MASK_OWNER = 1; |
388 | public const int MASK_GROUP = 2; | 391 | public const int MASK_GROUP = 2; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 70c5fcd..9446099 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -586,6 +586,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
586 | return m_LSL_Functions.llGetMassMKS(); | 586 | return m_LSL_Functions.llGetMassMKS(); |
587 | } | 587 | } |
588 | 588 | ||
589 | public LSL_Integer llGetMemoryLimit() | ||
590 | { | ||
591 | return m_LSL_Functions.llGetMemoryLimit(); | ||
592 | } | ||
593 | |||
589 | public void llGetNextEmail(string address, string subject) | 594 | public void llGetNextEmail(string address, string subject) |
590 | { | 595 | { |
591 | m_LSL_Functions.llGetNextEmail(address, subject); | 596 | m_LSL_Functions.llGetNextEmail(address, subject); |
@@ -776,6 +781,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
776 | return m_LSL_Functions.llGetSimulatorHostname(); | 781 | return m_LSL_Functions.llGetSimulatorHostname(); |
777 | } | 782 | } |
778 | 783 | ||
784 | public LSL_Integer llGetSPMaxMemory() | ||
785 | { | ||
786 | return m_LSL_Functions.llGetSPMaxMemory(); | ||
787 | } | ||
788 | |||
779 | public LSL_Integer llGetStartParameter() | 789 | public LSL_Integer llGetStartParameter() |
780 | { | 790 | { |
781 | return m_LSL_Functions.llGetStartParameter(); | 791 | return m_LSL_Functions.llGetStartParameter(); |
@@ -1445,6 +1455,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1445 | return m_LSL_Functions.llScriptDanger(pos); | 1455 | return m_LSL_Functions.llScriptDanger(pos); |
1446 | } | 1456 | } |
1447 | 1457 | ||
1458 | public void llScriptProfiler(LSL_Integer flags) | ||
1459 | { | ||
1460 | m_LSL_Functions.llScriptProfiler(flags); | ||
1461 | } | ||
1462 | |||
1448 | public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) | 1463 | public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata) |
1449 | { | 1464 | { |
1450 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); | 1465 | return m_LSL_Functions.llSendRemoteData(channel, dest, idata, sdata); |
@@ -1555,6 +1570,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
1555 | m_LSL_Functions.llSetLocalRot(rot); | 1570 | m_LSL_Functions.llSetLocalRot(rot); |
1556 | } | 1571 | } |
1557 | 1572 | ||
1573 | public LSL_Integer llSetMemoryLimit(LSL_Integer limit) | ||
1574 | { | ||
1575 | return m_LSL_Functions.llSetMemoryLimit(limit); | ||
1576 | } | ||
1577 | |||
1558 | public void llSetObjectDesc(string desc) | 1578 | public void llSetObjectDesc(string desc) |
1559 | { | 1579 | { |
1560 | m_LSL_Functions.llSetObjectDesc(desc); | 1580 | m_LSL_Functions.llSetObjectDesc(desc); |