diff options
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 128 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 14 |
2 files changed, 70 insertions, 72 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index b33c2b1..1e18095 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
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 | ||
@@ -95,10 +95,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
95 | 95 | ||
96 | public InventoryArchiverModule() {} | 96 | public InventoryArchiverModule() {} |
97 | 97 | ||
98 | public InventoryArchiverModule(bool disablePresenceChecks) | 98 | // public InventoryArchiverModule(bool disablePresenceChecks) |
99 | { | 99 | // { |
100 | DisablePresenceChecks = disablePresenceChecks; | 100 | // DisablePresenceChecks = disablePresenceChecks; |
101 | } | 101 | // } |
102 | 102 | ||
103 | public void Initialise(Scene scene, IConfigSource source) | 103 | public void Initialise(Scene scene, IConfigSource source) |
104 | { | 104 | { |
@@ -172,8 +172,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
172 | 172 | ||
173 | if (userInfo != null) | 173 | if (userInfo != null) |
174 | { | 174 | { |
175 | if (CheckPresence(userInfo.PrincipalID)) | 175 | // if (CheckPresence(userInfo.PrincipalID)) |
176 | { | 176 | // { |
177 | try | 177 | try |
178 | { | 178 | { |
179 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); | 179 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); |
@@ -189,13 +189,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
189 | } | 189 | } |
190 | 190 | ||
191 | return true; | 191 | return true; |
192 | } | 192 | // } |
193 | else | 193 | // else |
194 | { | 194 | // { |
195 | m_log.ErrorFormat( | 195 | // m_log.ErrorFormat( |
196 | "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", | 196 | // "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", |
197 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); | 197 | // userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); |
198 | } | 198 | // } |
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
@@ -212,8 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
212 | 212 | ||
213 | if (userInfo != null) | 213 | if (userInfo != null) |
214 | { | 214 | { |
215 | if (CheckPresence(userInfo.PrincipalID)) | 215 | // if (CheckPresence(userInfo.PrincipalID)) |
216 | { | 216 | // { |
217 | try | 217 | try |
218 | { | 218 | { |
219 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); | 219 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); |
@@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
229 | } | 229 | } |
230 | 230 | ||
231 | return true; | 231 | return true; |
232 | } | 232 | // } |
233 | else | 233 | // else |
234 | { | 234 | // { |
235 | m_log.ErrorFormat( | 235 | // m_log.ErrorFormat( |
236 | "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", | 236 | // "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", |
237 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); | 237 | // userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); |
238 | } | 238 | // } |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
@@ -257,9 +257,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
257 | 257 | ||
258 | if (userInfo != null) | 258 | if (userInfo != null) |
259 | { | 259 | { |
260 | if (CheckPresence(userInfo.PrincipalID)) | 260 | // if (CheckPresence(userInfo.PrincipalID)) |
261 | { | 261 | // { |
262 | |||
263 | InventoryArchiveReadRequest request; | 262 | InventoryArchiveReadRequest request; |
264 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); | 263 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); |
265 | 264 | ||
@@ -280,13 +279,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
280 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 279 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
281 | 280 | ||
282 | return true; | 281 | return true; |
283 | } | 282 | // } |
284 | else | 283 | // else |
285 | { | 284 | // { |
286 | m_log.ErrorFormat( | 285 | // m_log.ErrorFormat( |
287 | "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", | 286 | // "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", |
288 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); | 287 | // userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); |
289 | } | 288 | // } |
290 | } | 289 | } |
291 | else | 290 | else |
292 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found", | 291 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found", |
@@ -306,8 +305,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
306 | 305 | ||
307 | if (userInfo != null) | 306 | if (userInfo != null) |
308 | { | 307 | { |
309 | if (CheckPresence(userInfo.PrincipalID)) | 308 | // if (CheckPresence(userInfo.PrincipalID)) |
310 | { | 309 | // { |
311 | InventoryArchiveReadRequest request; | 310 | InventoryArchiveReadRequest request; |
312 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); | 311 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); |
313 | 312 | ||
@@ -328,13 +327,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
328 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 327 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
329 | 328 | ||
330 | return true; | 329 | return true; |
331 | } | 330 | // } |
332 | else | 331 | // else |
333 | { | 332 | // { |
334 | m_log.ErrorFormat( | 333 | // m_log.ErrorFormat( |
335 | "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", | 334 | // "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", |
336 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); | 335 | // userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); |
337 | } | 336 | // } |
338 | } | 337 | } |
339 | } | 338 | } |
340 | 339 | ||
@@ -529,28 +528,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
529 | } | 528 | } |
530 | } | 529 | } |
531 | 530 | ||
532 | /// <summary> | 531 | // /// <summary> |
533 | /// Check if the given user is present in any of the scenes. | 532 | // /// Check if the given user is present in any of the scenes. |
534 | /// </summary> | 533 | // /// </summary> |
535 | /// <param name="userId">The user to check</param> | 534 | // /// <param name="userId">The user to check</param> |
536 | /// <returns>true if the user is in any of the scenes, false otherwise</returns> | 535 | // /// <returns>true if the user is in any of the scenes, false otherwise</returns> |
537 | protected bool CheckPresence(UUID userId) | 536 | // protected bool CheckPresence(UUID userId) |
538 | { | 537 | // { |
539 | if (DisablePresenceChecks) | 538 | // if (DisablePresenceChecks) |
540 | return true; | 539 | // return true; |
541 | 540 | // | |
542 | foreach (Scene scene in m_scenes.Values) | 541 | // foreach (Scene scene in m_scenes.Values) |
543 | { | 542 | // { |
544 | ScenePresence p; | 543 | // ScenePresence p; |
545 | if ((p = scene.GetScenePresence(userId)) != null) | 544 | // if ((p = scene.GetScenePresence(userId)) != null) |
546 | { | 545 | // { |
547 | p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false); | 546 | // p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false); |
548 | return true; | 547 | // return true; |
549 | } | 548 | // } |
550 | } | 549 | // } |
551 | 550 | // | |
552 | return false; | 551 | // return false; |
553 | } | 552 | // } |
554 | |||
555 | } | 553 | } |
556 | } | 554 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 2747e15..76d0b85 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -120,7 +120,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
120 | TestHelper.InMethod(); | 120 | TestHelper.InMethod(); |
121 | // log4net.Config.XmlConfigurator.Configure(); | 121 | // log4net.Config.XmlConfigurator.Configure(); |
122 | 122 | ||
123 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 123 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
124 | 124 | ||
125 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | 125 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); |
126 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 126 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
238 | TestHelper.InMethod(); | 238 | TestHelper.InMethod(); |
239 | // log4net.Config.XmlConfigurator.Configure(); | 239 | // log4net.Config.XmlConfigurator.Configure(); |
240 | 240 | ||
241 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 241 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
242 | 242 | ||
243 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | 243 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); |
244 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 244 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
@@ -355,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
355 | // log4net.Config.XmlConfigurator.Configure(); | 355 | // log4net.Config.XmlConfigurator.Configure(); |
356 | 356 | ||
357 | SerialiserModule serialiserModule = new SerialiserModule(); | 357 | SerialiserModule serialiserModule = new SerialiserModule(); |
358 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 358 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
359 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 359 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); |
360 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 360 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
361 | 361 | ||
@@ -382,7 +382,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
382 | //log4net.Config.XmlConfigurator.Configure(); | 382 | //log4net.Config.XmlConfigurator.Configure(); |
383 | 383 | ||
384 | SerialiserModule serialiserModule = new SerialiserModule(); | 384 | SerialiserModule serialiserModule = new SerialiserModule(); |
385 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 385 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
386 | 386 | ||
387 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 387 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene |
388 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 388 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); |
@@ -443,7 +443,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
443 | string humanEscapedItemName = @"You & you are a mean\/man\/"; | 443 | string humanEscapedItemName = @"You & you are a mean\/man\/"; |
444 | string userPassword = "meowfood"; | 444 | string userPassword = "meowfood"; |
445 | 445 | ||
446 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 446 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
447 | 447 | ||
448 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | 448 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); |
449 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); | 449 | SceneSetupHelpers.SetupSceneModules(scene, archiverModule); |
@@ -558,7 +558,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
558 | 558 | ||
559 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | 559 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); |
560 | SerialiserModule serialiserModule = new SerialiserModule(); | 560 | SerialiserModule serialiserModule = new SerialiserModule(); |
561 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 561 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
562 | 562 | ||
563 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 563 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene |
564 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 564 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); |
@@ -619,7 +619,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
619 | 619 | ||
620 | // MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | 620 | // MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); |
621 | // SerialiserModule serialiserModule = new SerialiserModule(); | 621 | // SerialiserModule serialiserModule = new SerialiserModule(); |
622 | // InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 622 | // InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
623 | 623 | ||
624 | // // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 624 | // // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene |
625 | // Scene scene = SceneSetupHelpers.SetupScene(); | 625 | // Scene scene = SceneSetupHelpers.SetupScene(); |