diff options
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
27 files changed, 695 insertions, 344 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 951afd7..acd156e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -286,6 +286,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
286 | 286 | ||
287 | public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp) | 287 | public bool AttachObject(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp) |
288 | { | 288 | { |
289 | if (!Enabled) | ||
290 | return false; | ||
291 | |||
292 | if (AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, temp)) | ||
293 | { | ||
294 | m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); | ||
295 | return true; | ||
296 | } | ||
297 | |||
298 | return false; | ||
299 | } | ||
300 | |||
301 | private bool AttachObjectInternal(IScenePresence sp, SceneObjectGroup group, uint attachmentPt, bool silent, bool useAttachData, bool temp) | ||
302 | { | ||
289 | lock (sp.AttachmentsSyncLock) | 303 | lock (sp.AttachmentsSyncLock) |
290 | { | 304 | { |
291 | // m_log.DebugFormat( | 305 | // m_log.DebugFormat( |
@@ -461,6 +475,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
461 | 475 | ||
462 | public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId) | 476 | public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId) |
463 | { | 477 | { |
478 | DetachSingleAttachmentToGround(sp, soLocalId, sp.AbsolutePosition, Quaternion.Identity); | ||
479 | } | ||
480 | |||
481 | public void DetachSingleAttachmentToGround(IScenePresence sp, uint soLocalId, Vector3 absolutePos, Quaternion absoluteRot) | ||
482 | { | ||
464 | if (!Enabled) | 483 | if (!Enabled) |
465 | return; | 484 | return; |
466 | 485 | ||
@@ -502,7 +521,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
502 | so.FromItemID = UUID.Zero; | 521 | so.FromItemID = UUID.Zero; |
503 | 522 | ||
504 | SceneObjectPart rootPart = so.RootPart; | 523 | SceneObjectPart rootPart = so.RootPart; |
505 | so.AbsolutePosition = sp.AbsolutePosition; | 524 | so.AbsolutePosition = absolutePos; |
525 | if (absoluteRot != Quaternion.Identity) | ||
526 | { | ||
527 | so.UpdateGroupRotationR(absoluteRot); | ||
528 | } | ||
506 | so.AttachedAvatar = UUID.Zero; | 529 | so.AttachedAvatar = UUID.Zero; |
507 | rootPart.SetParentLocalId(0); | 530 | rootPart.SetParentLocalId(0); |
508 | so.ClearPartAttachmentData(); | 531 | so.ClearPartAttachmentData(); |
@@ -616,9 +639,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
616 | 639 | ||
617 | if (grp.HasGroupChanged) | 640 | if (grp.HasGroupChanged) |
618 | { | 641 | { |
619 | // m_log.DebugFormat( | 642 | m_log.DebugFormat( |
620 | // "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", | 643 | "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", |
621 | // grp.UUID, grp.AttachmentPoint); | 644 | grp.UUID, grp.AttachmentPoint); |
622 | 645 | ||
623 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState); | 646 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState); |
624 | 647 | ||
@@ -862,7 +885,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
862 | // This will throw if the attachment fails | 885 | // This will throw if the attachment fails |
863 | try | 886 | try |
864 | { | 887 | { |
865 | AttachObject(sp, objatt, attachmentPt, false, false, false); | 888 | AttachObjectInternal(sp, objatt, attachmentPt, false, false, false); |
866 | } | 889 | } |
867 | catch (Exception e) | 890 | catch (Exception e) |
868 | { | 891 | { |
@@ -933,6 +956,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
933 | 956 | ||
934 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); | 957 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); |
935 | item = m_scene.InventoryService.GetItem(item); | 958 | item = m_scene.InventoryService.GetItem(item); |
959 | if (item == null) | ||
960 | return; | ||
961 | |||
936 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); | 962 | bool changed = sp.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID); |
937 | if (changed && m_scene.AvatarFactory != null) | 963 | if (changed && m_scene.AvatarFactory != null) |
938 | { | 964 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index d9a619d..4e9d3f9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -62,7 +62,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
62 | public class AttachmentsModuleTests : OpenSimTestCase | 62 | public class AttachmentsModuleTests : OpenSimTestCase |
63 | { | 63 | { |
64 | private AutoResetEvent m_chatEvent = new AutoResetEvent(false); | 64 | private AutoResetEvent m_chatEvent = new AutoResetEvent(false); |
65 | private OSChatMessage m_osChatMessageReceived; | 65 | // private OSChatMessage m_osChatMessageReceived; |
66 | |||
67 | // Used to test whether the operations have fired the attach event. Must be reset after each test. | ||
68 | private int m_numberOfAttachEventsFired; | ||
66 | 69 | ||
67 | [TestFixtureSetUp] | 70 | [TestFixtureSetUp] |
68 | public void FixtureInit() | 71 | public void FixtureInit() |
@@ -83,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
83 | { | 86 | { |
84 | // Console.WriteLine("Got chat [{0}]", oscm.Message); | 87 | // Console.WriteLine("Got chat [{0}]", oscm.Message); |
85 | 88 | ||
86 | m_osChatMessageReceived = oscm; | 89 | // m_osChatMessageReceived = oscm; |
87 | m_chatEvent.Set(); | 90 | m_chatEvent.Set(); |
88 | } | 91 | } |
89 | 92 | ||
@@ -99,6 +102,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
99 | "attachments-test-scene", TestHelpers.ParseTail(999), 1000, 1000, config); | 102 | "attachments-test-scene", TestHelpers.ParseTail(999), 1000, 1000, config); |
100 | SceneHelpers.SetupSceneModules(scene, config, modules.ToArray()); | 103 | SceneHelpers.SetupSceneModules(scene, config, modules.ToArray()); |
101 | 104 | ||
105 | scene.EventManager.OnAttach += (localID, itemID, avatarID) => m_numberOfAttachEventsFired++; | ||
106 | |||
102 | return scene; | 107 | return scene; |
103 | } | 108 | } |
104 | 109 | ||
@@ -181,6 +186,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
181 | TestHelpers.InMethod(); | 186 | TestHelpers.InMethod(); |
182 | // TestHelpers.EnableLogging(); | 187 | // TestHelpers.EnableLogging(); |
183 | 188 | ||
189 | m_numberOfAttachEventsFired = 0; | ||
190 | |||
184 | Scene scene = CreateTestScene(); | 191 | Scene scene = CreateTestScene(); |
185 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 192 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
186 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); | 193 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); |
@@ -189,6 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
189 | 196 | ||
190 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); | 197 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); |
191 | 198 | ||
199 | m_numberOfAttachEventsFired = 0; | ||
192 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false); | 200 | scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false, false, false); |
193 | 201 | ||
194 | // Check status on scene presence | 202 | // Check status on scene presence |
@@ -216,7 +224,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
216 | 224 | ||
217 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); | 225 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); |
218 | 226 | ||
219 | // TestHelpers.DisableLogging(); | 227 | // Check events |
228 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1)); | ||
220 | } | 229 | } |
221 | 230 | ||
222 | /// <summary> | 231 | /// <summary> |
@@ -228,6 +237,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
228 | TestHelpers.InMethod(); | 237 | TestHelpers.InMethod(); |
229 | // TestHelpers.EnableLogging(); | 238 | // TestHelpers.EnableLogging(); |
230 | 239 | ||
240 | m_numberOfAttachEventsFired = 0; | ||
241 | |||
231 | Scene scene = CreateTestScene(); | 242 | Scene scene = CreateTestScene(); |
232 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); | 243 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); |
233 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); | 244 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1); |
@@ -247,6 +258,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
247 | 258 | ||
248 | Assert.That(sp.HasAttachments(), Is.False); | 259 | Assert.That(sp.HasAttachments(), Is.False); |
249 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); | 260 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); |
261 | |||
262 | // Check events | ||
263 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); | ||
250 | } | 264 | } |
251 | 265 | ||
252 | [Test] | 266 | [Test] |
@@ -261,6 +275,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
261 | 275 | ||
262 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); | 276 | InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20); |
263 | 277 | ||
278 | m_numberOfAttachEventsFired = 0; | ||
264 | scene.AttachmentsModule.RezSingleAttachmentFromInventory( | 279 | scene.AttachmentsModule.RezSingleAttachmentFromInventory( |
265 | sp, attItem.ID, (uint)AttachmentPoint.Chest); | 280 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
266 | 281 | ||
@@ -280,6 +295,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
280 | Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); | 295 | Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); |
281 | 296 | ||
282 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); | 297 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); |
298 | |||
299 | // Check events | ||
300 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1)); | ||
283 | } | 301 | } |
284 | 302 | ||
285 | /// <summary> | 303 | /// <summary> |
@@ -338,6 +356,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
338 | ISceneEntity so | 356 | ISceneEntity so |
339 | = scene.AttachmentsModule.RezSingleAttachmentFromInventory( | 357 | = scene.AttachmentsModule.RezSingleAttachmentFromInventory( |
340 | sp, attItem.ID, (uint)AttachmentPoint.Chest); | 358 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
359 | |||
360 | m_numberOfAttachEventsFired = 0; | ||
341 | scene.AttachmentsModule.DetachSingleAttachmentToGround(sp, so.LocalId); | 361 | scene.AttachmentsModule.DetachSingleAttachmentToGround(sp, so.LocalId); |
342 | 362 | ||
343 | // Check scene presence status | 363 | // Check scene presence status |
@@ -353,6 +373,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
353 | 373 | ||
354 | // Check object in scene | 374 | // Check object in scene |
355 | Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null); | 375 | Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null); |
376 | |||
377 | // Check events | ||
378 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1)); | ||
356 | } | 379 | } |
357 | 380 | ||
358 | [Test] | 381 | [Test] |
@@ -369,6 +392,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
369 | SceneObjectGroup so | 392 | SceneObjectGroup so |
370 | = (SceneObjectGroup)scene.AttachmentsModule.RezSingleAttachmentFromInventory( | 393 | = (SceneObjectGroup)scene.AttachmentsModule.RezSingleAttachmentFromInventory( |
371 | sp, attItem.ID, (uint)AttachmentPoint.Chest); | 394 | sp, attItem.ID, (uint)AttachmentPoint.Chest); |
395 | |||
396 | m_numberOfAttachEventsFired = 0; | ||
372 | scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, so); | 397 | scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, so); |
373 | 398 | ||
374 | // Check status on scene presence | 399 | // Check status on scene presence |
@@ -380,6 +405,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
380 | Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0)); | 405 | Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0)); |
381 | 406 | ||
382 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(0)); | 407 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(0)); |
408 | |||
409 | // Check events | ||
410 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1)); | ||
383 | } | 411 | } |
384 | 412 | ||
385 | /// <summary> | 413 | /// <summary> |
@@ -461,10 +489,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
461 | 489 | ||
462 | SceneObjectGroup rezzedAtt = presence.GetAttachments()[0]; | 490 | SceneObjectGroup rezzedAtt = presence.GetAttachments()[0]; |
463 | 491 | ||
464 | scene.IncomingCloseAgent(presence.UUID); | 492 | m_numberOfAttachEventsFired = 0; |
493 | scene.IncomingCloseAgent(presence.UUID, false); | ||
465 | 494 | ||
466 | // Check that we can't retrieve this attachment from the scene. | 495 | // Check that we can't retrieve this attachment from the scene. |
467 | Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null); | 496 | Assert.That(scene.GetSceneObjectGroup(rezzedAtt.UUID), Is.Null); |
497 | |||
498 | // Check events | ||
499 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); | ||
468 | } | 500 | } |
469 | 501 | ||
470 | [Test] | 502 | [Test] |
@@ -480,6 +512,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
480 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); | 512 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); |
481 | acd.Appearance = new AvatarAppearance(); | 513 | acd.Appearance = new AvatarAppearance(); |
482 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); | 514 | acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); |
515 | |||
516 | m_numberOfAttachEventsFired = 0; | ||
483 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); | 517 | ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); |
484 | 518 | ||
485 | Assert.That(presence.HasAttachments(), Is.True); | 519 | Assert.That(presence.HasAttachments(), Is.True); |
@@ -502,6 +536,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
502 | Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); | 536 | Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest)); |
503 | 537 | ||
504 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); | 538 | Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); |
539 | |||
540 | // Check events. We expect OnAttach to fire on login. | ||
541 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(1)); | ||
505 | } | 542 | } |
506 | 543 | ||
507 | [Test] | 544 | [Test] |
@@ -522,10 +559,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
522 | 559 | ||
523 | Vector3 newPosition = new Vector3(1, 2, 4); | 560 | Vector3 newPosition = new Vector3(1, 2, 4); |
524 | 561 | ||
562 | m_numberOfAttachEventsFired = 0; | ||
525 | scene.SceneGraph.UpdatePrimGroupPosition(attSo.LocalId, newPosition, sp.ControllingClient); | 563 | scene.SceneGraph.UpdatePrimGroupPosition(attSo.LocalId, newPosition, sp.ControllingClient); |
526 | 564 | ||
527 | Assert.That(attSo.AbsolutePosition, Is.EqualTo(sp.AbsolutePosition)); | 565 | Assert.That(attSo.AbsolutePosition, Is.EqualTo(sp.AbsolutePosition)); |
528 | Assert.That(attSo.RootPart.AttachedPos, Is.EqualTo(newPosition)); | 566 | Assert.That(attSo.RootPart.AttachedPos, Is.EqualTo(newPosition)); |
567 | |||
568 | // Check events | ||
569 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); | ||
529 | } | 570 | } |
530 | 571 | ||
531 | [Test] | 572 | [Test] |
@@ -574,6 +615,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
574 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 615 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
575 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | 616 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
576 | 617 | ||
618 | m_numberOfAttachEventsFired = 0; | ||
577 | sceneA.RequestTeleportLocation( | 619 | sceneA.RequestTeleportLocation( |
578 | beforeTeleportSp.ControllingClient, | 620 | beforeTeleportSp.ControllingClient, |
579 | sceneB.RegionInfo.RegionHandle, | 621 | sceneB.RegionInfo.RegionHandle, |
@@ -616,29 +658,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
616 | Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0)); | 658 | Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0)); |
617 | 659 | ||
618 | Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0)); | 660 | Assert.That(sceneA.GetSceneObjectGroups().Count, Is.EqualTo(0)); |
619 | } | ||
620 | 661 | ||
621 | // I'm commenting this test because scene setup NEEDS InventoryService to | 662 | // Check events |
622 | // be non-null | 663 | Assert.That(m_numberOfAttachEventsFired, Is.EqualTo(0)); |
623 | //[Test] | 664 | } |
624 | // public void T032_CrossAttachments() | ||
625 | // { | ||
626 | // TestHelpers.InMethod(); | ||
627 | // | ||
628 | // ScenePresence presence = scene.GetScenePresence(agent1); | ||
629 | // ScenePresence presence2 = scene2.GetScenePresence(agent1); | ||
630 | // presence2.AddAttachment(sog1); | ||
631 | // presence2.AddAttachment(sog2); | ||
632 | // | ||
633 | // ISharedRegionModule serialiser = new SerialiserModule(); | ||
634 | // SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); | ||
635 | // SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); | ||
636 | // | ||
637 | // Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); | ||
638 | // | ||
639 | // //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); | ||
640 | // Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); | ||
641 | // Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); | ||
642 | // } | ||
643 | } | 665 | } |
644 | } | 666 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 4cb4370..8496005 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -39,9 +39,12 @@ using OpenSim.Region.Framework.Interfaces; | |||
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | 41 | ||
42 | using Mono.Addins; | ||
43 | |||
42 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | 44 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory |
43 | { | 45 | { |
44 | public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule | 46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AvatarFactoryModule")] |
47 | public class AvatarFactoryModule : IAvatarFactoryModule, INonSharedRegionModule | ||
45 | { | 48 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 50 | ||
@@ -59,12 +62,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
59 | 62 | ||
60 | private object m_setAppearanceLock = new object(); | 63 | private object m_setAppearanceLock = new object(); |
61 | 64 | ||
62 | #region IRegionModule | 65 | #region Region Module interface |
63 | 66 | ||
64 | public void Initialise(Scene scene, IConfigSource config) | 67 | public void Initialise(IConfigSource config) |
65 | { | 68 | { |
66 | scene.RegisterModuleInterface<IAvatarFactoryModule>(this); | ||
67 | scene.EventManager.OnNewClient += SubscribeToClientEvents; | ||
68 | 69 | ||
69 | IConfig appearanceConfig = config.Configs["Appearance"]; | 70 | IConfig appearanceConfig = config.Configs["Appearance"]; |
70 | if (appearanceConfig != null) | 71 | if (appearanceConfig != null) |
@@ -74,11 +75,29 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
74 | // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); | 75 | // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); |
75 | } | 76 | } |
76 | 77 | ||
78 | } | ||
79 | |||
80 | public void AddRegion(Scene scene) | ||
81 | { | ||
77 | if (m_scene == null) | 82 | if (m_scene == null) |
78 | m_scene = scene; | 83 | m_scene = scene; |
84 | |||
85 | scene.RegisterModuleInterface<IAvatarFactoryModule>(this); | ||
86 | scene.EventManager.OnNewClient += SubscribeToClientEvents; | ||
87 | } | ||
88 | |||
89 | public void RemoveRegion(Scene scene) | ||
90 | { | ||
91 | if (scene == m_scene) | ||
92 | { | ||
93 | scene.UnregisterModuleInterface<IAvatarFactoryModule>(this); | ||
94 | scene.EventManager.OnNewClient -= SubscribeToClientEvents; | ||
95 | } | ||
96 | |||
97 | m_scene = null; | ||
79 | } | 98 | } |
80 | 99 | ||
81 | public void PostInitialise() | 100 | public void RegionLoaded(Scene scene) |
82 | { | 101 | { |
83 | m_updateTimer.Enabled = false; | 102 | m_updateTimer.Enabled = false; |
84 | m_updateTimer.AutoReset = true; | 103 | m_updateTimer.AutoReset = true; |
@@ -100,6 +119,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
100 | get { return false; } | 119 | get { return false; } |
101 | } | 120 | } |
102 | 121 | ||
122 | public Type ReplaceableInterface | ||
123 | { | ||
124 | get { return null; } | ||
125 | } | ||
126 | |||
127 | |||
103 | private void SubscribeToClientEvents(IClientAPI client) | 128 | private void SubscribeToClientEvents(IClientAPI client) |
104 | { | 129 | { |
105 | client.OnRequestWearables += Client_OnRequestWearables; | 130 | client.OnRequestWearables += Client_OnRequestWearables; |
@@ -533,6 +558,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
533 | // Ignore ruth's assets | 558 | // Ignore ruth's assets |
534 | if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) | 559 | if (appearance.Wearables[i][j].ItemID == AvatarWearable.DefaultWearables[i][0].ItemID) |
535 | continue; | 560 | continue; |
561 | |||
536 | InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); | 562 | InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); |
537 | baseItem = invService.GetItem(baseItem); | 563 | baseItem = invService.GetItem(baseItem); |
538 | 564 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index dbbb0ae..4c3f1cc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using Mono.Addins; | ||
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
@@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; | |||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.Chat | 39 | namespace OpenSim.Region.CoreModules.Avatar.Chat |
39 | { | 40 | { |
41 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ChatModule")] | ||
40 | public class ChatModule : ISharedRegionModule | 42 | public class ChatModule : ISharedRegionModule |
41 | { | 43 | { |
42 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
@@ -197,6 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
197 | string fromName = c.From; | 199 | string fromName = c.From; |
198 | string fromNamePrefix = ""; | 200 | string fromNamePrefix = ""; |
199 | UUID fromID = UUID.Zero; | 201 | UUID fromID = UUID.Zero; |
202 | UUID ownerID = UUID.Zero; | ||
200 | string message = c.Message; | 203 | string message = c.Message; |
201 | IScene scene = c.Scene; | 204 | IScene scene = c.Scene; |
202 | UUID destination = c.Destination; | 205 | UUID destination = c.Destination; |
@@ -224,11 +227,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
224 | fromNamePrefix = m_adminPrefix; | 227 | fromNamePrefix = m_adminPrefix; |
225 | } | 228 | } |
226 | destination = UUID.Zero; // Avatars cant "SayTo" | 229 | destination = UUID.Zero; // Avatars cant "SayTo" |
230 | ownerID = c.Sender.AgentId; | ||
231 | |||
227 | break; | 232 | break; |
228 | 233 | ||
229 | case ChatSourceType.Object: | 234 | case ChatSourceType.Object: |
230 | fromID = c.SenderUUID; | 235 | fromID = c.SenderUUID; |
231 | 236 | ||
237 | if (c.SenderObject != null && c.SenderObject is SceneObjectPart) | ||
238 | ownerID = ((SceneObjectPart)c.SenderObject).OwnerID; | ||
239 | |||
232 | break; | 240 | break; |
233 | } | 241 | } |
234 | 242 | ||
@@ -262,8 +270,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
262 | // objects on a parcel with access restrictions | 270 | // objects on a parcel with access restrictions |
263 | if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) | 271 | if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) |
264 | { | 272 | { |
265 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType)) | 273 | if (destination != UUID.Zero) |
266 | receiverIDs.Add(presence.UUID); | 274 | { |
275 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, ownerID, fromNamePrefix + fromName, c.Type, message, sourceType, true)) | ||
276 | receiverIDs.Add(presence.UUID); | ||
277 | } | ||
278 | else | ||
279 | { | ||
280 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, ownerID, fromNamePrefix + fromName, c.Type, message, sourceType, false)) | ||
281 | receiverIDs.Add(presence.UUID); | ||
282 | } | ||
267 | } | 283 | } |
268 | } | 284 | } |
269 | } | 285 | } |
@@ -324,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
324 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 340 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) |
325 | return; | 341 | return; |
326 | 342 | ||
327 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 343 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, fromID, |
328 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 344 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); |
329 | receiverIDs.Add(client.AgentId); | 345 | receiverIDs.Add(client.AgentId); |
330 | } | 346 | } |
@@ -341,15 +357,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
341 | /// <param name="fromPos"></param> | 357 | /// <param name="fromPos"></param> |
342 | /// <param name="regionPos">/param> | 358 | /// <param name="regionPos">/param> |
343 | /// <param name="fromAgentID"></param> | 359 | /// <param name="fromAgentID"></param> |
360 | /// <param name='ownerID'> | ||
361 | /// Owner of the message. For at least some messages from objects, this has to be correctly filled with the owner's UUID. | ||
362 | /// This is the case for script error messages in viewer 3 since LLViewer change EXT-7762 | ||
363 | /// </param> | ||
344 | /// <param name="fromName"></param> | 364 | /// <param name="fromName"></param> |
345 | /// <param name="type"></param> | 365 | /// <param name="type"></param> |
346 | /// <param name="message"></param> | 366 | /// <param name="message"></param> |
347 | /// <param name="src"></param> | 367 | /// <param name="src"></param> |
348 | /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a | 368 | /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a |
349 | /// precondition</returns> | 369 | /// precondition</returns> |
350 | protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, | 370 | protected virtual bool TrySendChatMessage( |
351 | UUID fromAgentID, string fromName, ChatTypeEnum type, | 371 | ScenePresence presence, Vector3 fromPos, Vector3 regionPos, |
352 | string message, ChatSourceType src) | 372 | UUID fromAgentID, UUID ownerID, string fromName, ChatTypeEnum type, |
373 | string message, ChatSourceType src, bool ignoreDistance) | ||
353 | { | 374 | { |
354 | // don't send chat to child agents | 375 | // don't send chat to child agents |
355 | if (presence.IsChildAgent) return false; | 376 | if (presence.IsChildAgent) return false; |
@@ -369,8 +390,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
369 | } | 390 | } |
370 | 391 | ||
371 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView | 392 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView |
372 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, | 393 | presence.ControllingClient.SendChatMessage( |
373 | fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully); | 394 | message, (byte) type, fromPos, fromName, |
395 | fromAgentID, ownerID, (byte)src, (byte)ChatAudibleLevel.Fully); | ||
374 | 396 | ||
375 | return true; | 397 | return true; |
376 | } | 398 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 3a91465..343cdb5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | |||
@@ -33,9 +33,12 @@ using OpenSim.Region.Framework.Interfaces; | |||
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | 35 | ||
36 | using Mono.Addins; | ||
37 | |||
36 | namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | 38 | namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule |
37 | { | 39 | { |
38 | public class CombatModule : IRegionModule | 40 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CombatModule")] |
41 | public class CombatModule : ISharedRegionModule | ||
39 | { | 42 | { |
40 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | 44 | ||
@@ -54,7 +57,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
54 | /// </summary> | 57 | /// </summary> |
55 | /// <param name="scene"></param> | 58 | /// <param name="scene"></param> |
56 | /// <param name="config"></param> | 59 | /// <param name="config"></param> |
57 | public void Initialise(Scene scene, IConfigSource config) | 60 | public void Initialise(IConfigSource config) |
61 | { | ||
62 | } | ||
63 | |||
64 | public void AddRegion(Scene scene) | ||
58 | { | 65 | { |
59 | lock (m_scenel) | 66 | lock (m_scenel) |
60 | { | 67 | { |
@@ -72,6 +79,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
72 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | 79 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; |
73 | } | 80 | } |
74 | 81 | ||
82 | public void RemoveRegion(Scene scene) | ||
83 | { | ||
84 | if (m_scenel.ContainsKey(scene.RegionInfo.RegionHandle)) | ||
85 | m_scenel.Remove(scene.RegionInfo.RegionHandle); | ||
86 | |||
87 | scene.EventManager.OnAvatarKilled -= KillAvatar; | ||
88 | scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; | ||
89 | } | ||
90 | |||
91 | public void RegionLoaded(Scene scene) | ||
92 | { | ||
93 | } | ||
94 | |||
75 | public void PostInitialise() | 95 | public void PostInitialise() |
76 | { | 96 | { |
77 | } | 97 | } |
@@ -85,11 +105,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
85 | get { return "CombatModule"; } | 105 | get { return "CombatModule"; } |
86 | } | 106 | } |
87 | 107 | ||
88 | public bool IsSharedModule | 108 | public Type ReplaceableInterface |
89 | { | 109 | { |
90 | get { return true; } | 110 | get { return null; } |
91 | } | 111 | } |
92 | 112 | ||
113 | |||
93 | private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar) | 114 | private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar) |
94 | { | 115 | { |
95 | string deadAvatarMessage; | 116 | string deadAvatarMessage; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 3c294bb..0e7ab7e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -32,6 +32,7 @@ using log4net; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using Mono.Addins; | ||
35 | 36 | ||
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
@@ -39,16 +40,27 @@ using OpenSim.Services.Interfaces; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.Avatar.Dialog | 41 | namespace OpenSim.Region.CoreModules.Avatar.Dialog |
41 | { | 42 | { |
42 | public class DialogModule : IRegionModule, IDialogModule | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DialogModule")] |
43 | { | 44 | public class DialogModule : IDialogModule, INonSharedRegionModule |
45 | { | ||
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 47 | ||
46 | protected Scene m_scene; | 48 | protected Scene m_scene; |
47 | 49 | ||
48 | public void Initialise(Scene scene, IConfigSource source) | 50 | public void Initialise(IConfigSource source) { } |
51 | |||
52 | public Type ReplaceableInterface { get { return null; } } | ||
53 | |||
54 | public void AddRegion(Scene scene) | ||
49 | { | 55 | { |
50 | m_scene = scene; | 56 | m_scene = scene; |
51 | m_scene.RegisterModuleInterface<IDialogModule>(this); | 57 | m_scene.RegisterModuleInterface<IDialogModule>(this); |
58 | } | ||
59 | |||
60 | public void RegionLoaded(Scene scene) | ||
61 | { | ||
62 | if (scene != m_scene) | ||
63 | return; | ||
52 | 64 | ||
53 | m_scene.AddCommand( | 65 | m_scene.AddCommand( |
54 | "Users", this, "alert", "alert <message>", | 66 | "Users", this, "alert", "alert <message>", |
@@ -56,46 +68,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
56 | HandleAlertConsoleCommand); | 68 | HandleAlertConsoleCommand); |
57 | 69 | ||
58 | m_scene.AddCommand( | 70 | m_scene.AddCommand( |
59 | "Users", this, "alert-user", "alert-user <first> <last> <message>", | 71 | "Users", this, "alert-user", |
72 | "alert-user <first> <last> <message>", | ||
60 | "Send an alert to a user", | 73 | "Send an alert to a user", |
61 | HandleAlertConsoleCommand); | 74 | HandleAlertConsoleCommand); |
62 | } | 75 | } |
63 | 76 | ||
64 | public void PostInitialise() {} | 77 | public void RemoveRegion(Scene scene) |
65 | public void Close() {} | 78 | { |
79 | if (scene != m_scene) | ||
80 | return; | ||
81 | |||
82 | m_scene.UnregisterModuleInterface<IDialogModule>(this); | ||
83 | } | ||
84 | |||
85 | public void Close() { } | ||
66 | public string Name { get { return "Dialog Module"; } } | 86 | public string Name { get { return "Dialog Module"; } } |
67 | public bool IsSharedModule { get { return false; } } | 87 | |
68 | |||
69 | public void SendAlertToUser(IClientAPI client, string message) | 88 | public void SendAlertToUser(IClientAPI client, string message) |
70 | { | 89 | { |
71 | SendAlertToUser(client, message, false); | 90 | SendAlertToUser(client, message, false); |
72 | } | 91 | } |
73 | 92 | ||
74 | public void SendAlertToUser(IClientAPI client, string message, bool modal) | 93 | public void SendAlertToUser(IClientAPI client, string message, |
94 | bool modal) | ||
75 | { | 95 | { |
76 | client.SendAgentAlertMessage(message, modal); | 96 | client.SendAgentAlertMessage(message, modal); |
77 | } | 97 | } |
78 | 98 | ||
79 | public void SendAlertToUser(UUID agentID, string message) | 99 | public void SendAlertToUser(UUID agentID, string message) |
80 | { | 100 | { |
81 | SendAlertToUser(agentID, message, false); | 101 | SendAlertToUser(agentID, message, false); |
82 | } | 102 | } |
83 | 103 | ||
84 | public void SendAlertToUser(UUID agentID, string message, bool modal) | 104 | public void SendAlertToUser(UUID agentID, string message, bool modal) |
85 | { | 105 | { |
86 | ScenePresence sp = m_scene.GetScenePresence(agentID); | 106 | ScenePresence sp = m_scene.GetScenePresence(agentID); |
87 | 107 | ||
88 | if (sp != null) | 108 | if (sp != null) |
89 | sp.ControllingClient.SendAgentAlertMessage(message, modal); | 109 | sp.ControllingClient.SendAgentAlertMessage(message, modal); |
90 | } | 110 | } |
91 | 111 | ||
92 | public void SendAlertToUser(string firstName, string lastName, string message, bool modal) | 112 | public void SendAlertToUser(string firstName, string lastName, |
113 | string message, bool modal) | ||
93 | { | 114 | { |
94 | ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); | 115 | ScenePresence presence = m_scene.GetScenePresence(firstName, |
116 | lastName); | ||
95 | if (presence != null) | 117 | if (presence != null) |
96 | presence.ControllingClient.SendAgentAlertMessage(message, modal); | 118 | { |
119 | presence.ControllingClient.SendAgentAlertMessage(message, | ||
120 | modal); | ||
121 | } | ||
97 | } | 122 | } |
98 | 123 | ||
99 | public void SendGeneralAlert(string message) | 124 | public void SendGeneralAlert(string message) |
100 | { | 125 | { |
101 | m_scene.ForEachRootClient(delegate(IClientAPI client) | 126 | m_scene.ForEachRootClient(delegate(IClientAPI client) |
@@ -104,11 +129,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
104 | }); | 129 | }); |
105 | } | 130 | } |
106 | 131 | ||
107 | public void SendDialogToUser( | 132 | public void SendDialogToUser(UUID avatarID, string objectName, |
108 | UUID avatarID, string objectName, UUID objectID, UUID ownerID, | 133 | UUID objectID, UUID ownerID, string message, UUID textureID, |
109 | string message, UUID textureID, int ch, string[] buttonlabels) | 134 | int ch, string[] buttonlabels) |
110 | { | 135 | { |
111 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerID); | 136 | UserAccount account = m_scene.UserAccountService.GetUserAccount( |
137 | m_scene.RegionInfo.ScopeID, ownerID); | ||
112 | string ownerFirstName, ownerLastName; | 138 | string ownerFirstName, ownerLastName; |
113 | if (account != null) | 139 | if (account != null) |
114 | { | 140 | { |
@@ -123,29 +149,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
123 | 149 | ||
124 | ScenePresence sp = m_scene.GetScenePresence(avatarID); | 150 | ScenePresence sp = m_scene.GetScenePresence(avatarID); |
125 | if (sp != null) | 151 | if (sp != null) |
126 | sp.ControllingClient.SendDialog( | 152 | { |
127 | objectName, objectID, ownerID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); | 153 | sp.ControllingClient.SendDialog(objectName, objectID, ownerID, |
154 | ownerFirstName, ownerLastName, message, textureID, ch, | ||
155 | buttonlabels); | ||
156 | } | ||
128 | } | 157 | } |
129 | 158 | ||
130 | public void SendUrlToUser( | 159 | public void SendUrlToUser(UUID avatarID, string objectName, |
131 | UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) | 160 | UUID objectID, UUID ownerID, bool groupOwned, string message, |
161 | string url) | ||
132 | { | 162 | { |
133 | ScenePresence sp = m_scene.GetScenePresence(avatarID); | 163 | ScenePresence sp = m_scene.GetScenePresence(avatarID); |
134 | 164 | ||
135 | if (sp != null) | 165 | if (sp != null) |
136 | sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); | 166 | { |
167 | sp.ControllingClient.SendLoadURL(objectName, objectID, | ||
168 | ownerID, groupOwned, message, url); | ||
169 | } | ||
137 | } | 170 | } |
138 | 171 | ||
139 | public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) | 172 | public void SendTextBoxToUser(UUID avatarid, string message, |
173 | int chatChannel, string name, UUID objectid, UUID ownerid) | ||
140 | { | 174 | { |
141 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); | 175 | UserAccount account = m_scene.UserAccountService.GetUserAccount( |
176 | m_scene.RegionInfo.ScopeID, ownerid); | ||
142 | string ownerFirstName, ownerLastName; | 177 | string ownerFirstName, ownerLastName; |
143 | UUID ownerID = UUID.Zero; | 178 | UUID ownerID = UUID.Zero; |
144 | if (account != null) | 179 | if (account != null) |
145 | { | 180 | { |
146 | ownerFirstName = account.FirstName; | 181 | ownerFirstName = account.FirstName; |
147 | ownerLastName = account.LastName; | 182 | ownerLastName = account.LastName; |
148 | ownerID = account.PrincipalID; | 183 | ownerID = account.PrincipalID; |
149 | } | 184 | } |
150 | else | 185 | else |
151 | { | 186 | { |
@@ -154,29 +189,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
154 | } | 189 | } |
155 | 190 | ||
156 | ScenePresence sp = m_scene.GetScenePresence(avatarid); | 191 | ScenePresence sp = m_scene.GetScenePresence(avatarid); |
157 | 192 | ||
158 | if (sp != null) | 193 | if (sp != null) |
159 | sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerID, ownerFirstName, ownerLastName, objectid); | 194 | { |
195 | sp.ControllingClient.SendTextBoxRequest(message, chatChannel, | ||
196 | name, ownerID, ownerFirstName, ownerLastName, | ||
197 | objectid); | ||
198 | } | ||
160 | } | 199 | } |
161 | 200 | ||
162 | public void SendNotificationToUsersInRegion( | 201 | public void SendNotificationToUsersInRegion(UUID fromAvatarID, |
163 | UUID fromAvatarID, string fromAvatarName, string message) | 202 | string fromAvatarName, string message) |
164 | { | 203 | { |
165 | m_scene.ForEachRootClient(delegate(IClientAPI client) | 204 | m_scene.ForEachRootClient(delegate(IClientAPI client) |
166 | { | 205 | { |
167 | client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); | 206 | client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, |
207 | message); | ||
168 | }); | 208 | }); |
169 | } | 209 | } |
170 | 210 | ||
171 | /// <summary> | 211 | /// <summary> |
172 | /// Handle an alert command from the console. | 212 | /// Handle an alert command from the console. |
173 | /// </summary> | 213 | /// </summary> |
174 | /// <param name="module"></param> | 214 | /// <param name="module"></param> |
175 | /// <param name="cmdparams"></param> | 215 | /// <param name="cmdparams"></param> |
176 | public void HandleAlertConsoleCommand(string module, string[] cmdparams) | 216 | public void HandleAlertConsoleCommand(string module, |
217 | string[] cmdparams) | ||
177 | { | 218 | { |
178 | if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) | 219 | if (m_scene.ConsoleScene() != null && |
220 | m_scene.ConsoleScene() != m_scene) | ||
221 | { | ||
179 | return; | 222 | return; |
223 | } | ||
180 | 224 | ||
181 | string message = string.Empty; | 225 | string message = string.Empty; |
182 | 226 | ||
@@ -184,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
184 | { | 228 | { |
185 | message = CombineParams(cmdparams, 1); | 229 | message = CombineParams(cmdparams, 1); |
186 | m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", | 230 | m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", |
187 | m_scene.RegionInfo.RegionName, message); | 231 | m_scene.RegionInfo.RegionName, message); |
188 | SendGeneralAlert(message); | 232 | SendGeneralAlert(message); |
189 | } | 233 | } |
190 | else if (cmdparams.Length > 3) | 234 | else if (cmdparams.Length > 3) |
@@ -192,9 +236,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
192 | string firstName = cmdparams[1]; | 236 | string firstName = cmdparams[1]; |
193 | string lastName = cmdparams[2]; | 237 | string lastName = cmdparams[2]; |
194 | message = CombineParams(cmdparams, 3); | 238 | message = CombineParams(cmdparams, 3); |
195 | m_log.InfoFormat( | 239 | m_log.InfoFormat("[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", |
196 | "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", | 240 | m_scene.RegionInfo.RegionName, firstName, lastName, |
197 | m_scene.RegionInfo.RegionName, firstName, lastName, message); | 241 | message); |
198 | SendAlertToUser(firstName, lastName, message, false); | 242 | SendAlertToUser(firstName, lastName, message, false); |
199 | } | 243 | } |
200 | else | 244 | else |
@@ -212,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
212 | { | 256 | { |
213 | result += commandParams[i] + " "; | 257 | result += commandParams[i] + " "; |
214 | } | 258 | } |
215 | 259 | ||
216 | return result; | 260 | return result; |
217 | } | 261 | } |
218 | } | 262 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs index d942e87..5ec0ea9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs | |||
@@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
141 | client.FirstName+" "+client.LastName, | 141 | client.FirstName+" "+client.LastName, |
142 | destID, (byte)211, false, | 142 | destID, (byte)211, false, |
143 | String.Empty, | 143 | String.Empty, |
144 | transactionID, false, new Vector3(), new byte[0]), | 144 | transactionID, false, new Vector3(), new byte[0], true), |
145 | delegate(bool success) {} ); | 145 | delegate(bool success) {} ); |
146 | } | 146 | } |
147 | } | 147 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 24ec435..8056030 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -28,12 +28,14 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Threading; | 33 | using System.Threading; |
33 | using log4net; | 34 | using log4net; |
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
36 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using Mono.Addins; | ||
37 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Servers.HttpServer; | 40 | using OpenSim.Framework.Servers.HttpServer; |
39 | using OpenSim.Framework.Communications; | 41 | using OpenSim.Framework.Communications; |
@@ -49,6 +51,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
49 | 51 | ||
50 | namespace OpenSim.Region.CoreModules.Avatar.Friends | 52 | namespace OpenSim.Region.CoreModules.Avatar.Friends |
51 | { | 53 | { |
54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FriendsModule")] | ||
52 | public class FriendsModule : ISharedRegionModule, IFriendsModule | 55 | public class FriendsModule : ISharedRegionModule, IFriendsModule |
53 | { | 56 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -482,9 +485,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
482 | Util.FireAndForget( | 485 | Util.FireAndForget( |
483 | delegate | 486 | delegate |
484 | { | 487 | { |
485 | m_log.DebugFormat( | 488 | // m_log.DebugFormat( |
486 | "[FRIENDS MODULE]: Notifying {0} friends of {1} of online status {2}", | 489 | // "[FRIENDS MODULE]: Notifying {0} friends of {1} of online status {2}", |
487 | friendList.Count, agentID, online); | 490 | // friendList.Count, agentID, online); |
488 | 491 | ||
489 | // Notify about this user status | 492 | // Notify about this user status |
490 | StatusNotify(friendList, agentID, online); | 493 | StatusNotify(friendList, agentID, online); |
@@ -495,42 +498,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
495 | 498 | ||
496 | protected virtual void StatusNotify(List<FriendInfo> friendList, UUID userID, bool online) | 499 | protected virtual void StatusNotify(List<FriendInfo> friendList, UUID userID, bool online) |
497 | { | 500 | { |
498 | foreach (FriendInfo friend in friendList) | 501 | List<string> friendStringIds = friendList.ConvertAll<string>(friend => friend.Friend); |
502 | List<string> remoteFriendStringIds = new List<string>(); | ||
503 | foreach (string friendStringId in friendStringIds) | ||
499 | { | 504 | { |
500 | UUID friendID; | 505 | UUID friendUuid; |
501 | if (UUID.TryParse(friend.Friend, out friendID)) | 506 | if (UUID.TryParse(friendStringId, out friendUuid)) |
502 | { | 507 | { |
503 | // Try local | 508 | if (LocalStatusNotification(userID, friendUuid, online)) |
504 | if (LocalStatusNotification(userID, friendID, online)) | ||
505 | continue; | 509 | continue; |
506 | 510 | ||
507 | // The friend is not here [as root]. Let's forward. | 511 | remoteFriendStringIds.Add(friendStringId); |
508 | PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); | ||
509 | if (friendSessions != null && friendSessions.Length > 0) | ||
510 | { | ||
511 | PresenceInfo friendSession = null; | ||
512 | foreach (PresenceInfo pinfo in friendSessions) | ||
513 | { | ||
514 | if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad | ||
515 | { | ||
516 | friendSession = pinfo; | ||
517 | break; | ||
518 | } | ||
519 | } | ||
520 | |||
521 | if (friendSession != null) | ||
522 | { | ||
523 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
524 | //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); | ||
525 | m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); | ||
526 | } | ||
527 | } | ||
528 | |||
529 | // Friend is not online. Ignore. | ||
530 | } | 512 | } |
531 | else | 513 | else |
532 | { | 514 | { |
533 | m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); | 515 | m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friendStringId); |
516 | } | ||
517 | } | ||
518 | |||
519 | // We do this regrouping so that we can efficiently send a single request rather than one for each | ||
520 | // friend in what may be a very large friends list. | ||
521 | PresenceInfo[] friendSessions = PresenceService.GetAgents(remoteFriendStringIds.ToArray()); | ||
522 | |||
523 | foreach (PresenceInfo friendSession in friendSessions) | ||
524 | { | ||
525 | // let's guard against sessions-gone-bad | ||
526 | if (friendSession.RegionID != UUID.Zero) | ||
527 | { | ||
528 | GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); | ||
529 | //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); | ||
530 | m_FriendsSimConnector.StatusNotify(region, userID, friendSession.UserID, online); | ||
534 | } | 531 | } |
535 | } | 532 | } |
536 | } | 533 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 06f27e2..bf5c0bb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -46,6 +46,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
46 | 46 | ||
47 | namespace OpenSim.Region.CoreModules.Avatar.Friends | 47 | namespace OpenSim.Region.CoreModules.Avatar.Friends |
48 | { | 48 | { |
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGFriendsModule")] | ||
49 | public class HGFriendsModule : FriendsModule, ISharedRegionModule, IFriendsModule, IFriendsSimConnector | 50 | public class HGFriendsModule : FriendsModule, ISharedRegionModule, IFriendsModule, IFriendsSimConnector |
50 | { | 51 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs index 7df2beb..095c57b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Reflection; | 29 | using System.Reflection; |
29 | using log4net; | 30 | using log4net; |
30 | using Nini.Config; | 31 | using Nini.Config; |
@@ -35,26 +36,46 @@ using OpenSim.Region.Framework.Interfaces; | |||
35 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | 38 | ||
39 | using Mono.Addins; | ||
40 | |||
38 | namespace OpenSim.Region.CoreModules.Avatar.Gestures | 41 | namespace OpenSim.Region.CoreModules.Avatar.Gestures |
39 | { | 42 | { |
40 | public class GesturesModule : IRegionModule | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GesturesModule")] |
44 | public class GesturesModule : INonSharedRegionModule | ||
41 | { | 45 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 47 | ||
44 | protected Scene m_scene; | 48 | protected Scene m_scene; |
45 | 49 | ||
46 | public void Initialise(Scene scene, IConfigSource source) | 50 | public void Initialise(IConfigSource source) |
51 | { | ||
52 | } | ||
53 | |||
54 | public void AddRegion(Scene scene) | ||
47 | { | 55 | { |
48 | m_scene = scene; | 56 | m_scene = scene; |
49 | 57 | ||
50 | m_scene.EventManager.OnNewClient += OnNewClient; | 58 | m_scene.EventManager.OnNewClient += OnNewClient; |
51 | } | 59 | } |
60 | |||
61 | public void RegionLoaded(Scene scene) | ||
62 | { | ||
63 | } | ||
64 | |||
65 | public void RemoveRegion(Scene scene) | ||
66 | { | ||
67 | m_scene.EventManager.OnNewClient -= OnNewClient; | ||
68 | m_scene = null; | ||
69 | } | ||
52 | 70 | ||
53 | public void PostInitialise() {} | ||
54 | public void Close() {} | 71 | public void Close() {} |
55 | public string Name { get { return "Gestures Module"; } } | 72 | public string Name { get { return "Gestures Module"; } } |
56 | public bool IsSharedModule { get { return false; } } | 73 | |
57 | 74 | public Type ReplaceableInterface | |
75 | { | ||
76 | get { return null; } | ||
77 | } | ||
78 | |||
58 | private void OnNewClient(IClientAPI client) | 79 | private void OnNewClient(IClientAPI client) |
59 | { | 80 | { |
60 | client.OnActivateGesture += ActivateGesture; | 81 | client.OnActivateGesture += ActivateGesture; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 716cc69..9fa9be1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
@@ -50,9 +51,12 @@ using Caps = OpenSim.Framework.Capabilities.Caps; | |||
50 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | 51 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; |
51 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | 52 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; |
52 | 53 | ||
54 | using Mono.Addins; | ||
55 | |||
53 | namespace OpenSim.Region.CoreModules.Avatar.Gods | 56 | namespace OpenSim.Region.CoreModules.Avatar.Gods |
54 | { | 57 | { |
55 | public class GodsModule : IRegionModule, IGodsModule | 58 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GodsModule")] |
59 | public class GodsModule : INonSharedRegionModule, IGodsModule | ||
56 | { | 60 | { |
57 | private static readonly ILog m_log = | 61 | private static readonly ILog m_log = |
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 62 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -66,10 +70,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
66 | protected Dictionary<UUID, string> m_capsDict = | 70 | protected Dictionary<UUID, string> m_capsDict = |
67 | new Dictionary<UUID, string>(); | 71 | new Dictionary<UUID, string>(); |
68 | 72 | ||
69 | public void Initialise(Scene scene, IConfigSource source) | 73 | protected IDialogModule DialogModule |
74 | { | ||
75 | get | ||
76 | { | ||
77 | if (m_dialogModule == null) | ||
78 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | ||
79 | |||
80 | return m_dialogModule; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | public void Initialise(IConfigSource source) | ||
85 | { | ||
86 | } | ||
87 | |||
88 | public void AddRegion(Scene scene) | ||
70 | { | 89 | { |
71 | m_scene = scene; | 90 | m_scene = scene; |
72 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | ||
73 | m_scene.RegisterModuleInterface<IGodsModule>(this); | 91 | m_scene.RegisterModuleInterface<IGodsModule>(this); |
74 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 92 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
75 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; | 93 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; |
@@ -77,12 +95,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
77 | scene.EventManager.OnIncomingInstantMessage += | 95 | scene.EventManager.OnIncomingInstantMessage += |
78 | OnIncomingInstantMessage; | 96 | OnIncomingInstantMessage; |
79 | } | 97 | } |
80 | 98 | ||
81 | public void PostInitialise() {} | 99 | public void RemoveRegion(Scene scene) |
100 | { | ||
101 | m_scene.UnregisterModuleInterface<IGodsModule>(this); | ||
102 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | ||
103 | m_scene = null; | ||
104 | } | ||
105 | |||
106 | public void RegionLoaded(Scene scene) | ||
107 | { | ||
108 | } | ||
109 | |||
82 | public void Close() {} | 110 | public void Close() {} |
83 | public string Name { get { return "Gods Module"; } } | 111 | public string Name { get { return "Gods Module"; } } |
84 | public bool IsSharedModule { get { return false; } } | 112 | |
85 | 113 | public Type ReplaceableInterface | |
114 | { | ||
115 | get { return null; } | ||
116 | } | ||
117 | |||
86 | public void SubscribeToClientEvents(IClientAPI client) | 118 | public void SubscribeToClientEvents(IClientAPI client) |
87 | { | 119 | { |
88 | client.OnGodKickUser += KickUser; | 120 | client.OnGodKickUser += KickUser; |
@@ -172,8 +204,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
172 | } | 204 | } |
173 | else | 205 | else |
174 | { | 206 | { |
175 | if (m_dialogModule != null) | 207 | if (DialogModule != null) |
176 | m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); | 208 | DialogModule.SendAlertToUser(agentID, "Request for god powers denied"); |
177 | } | 209 | } |
178 | } | 210 | } |
179 | } | 211 | } |
@@ -206,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
206 | transferModule.SendInstantMessage(new GridInstantMessage( | 238 | transferModule.SendInstantMessage(new GridInstantMessage( |
207 | m_scene, godID, "God", agentID, (byte)250, false, | 239 | m_scene, godID, "God", agentID, (byte)250, false, |
208 | Utils.BytesToString(reason), UUID.Zero, true, | 240 | Utils.BytesToString(reason), UUID.Zero, true, |
209 | new Vector3(), new byte[] {(byte)kickflags}), | 241 | new Vector3(), new byte[] {(byte)kickflags}, true), |
210 | delegate(bool success) {} ); | 242 | delegate(bool success) {} ); |
211 | } | 243 | } |
212 | return; | 244 | return; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs index b258e13..af54c1a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using log4net; | 31 | using log4net; |
@@ -34,9 +35,12 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
36 | 37 | ||
38 | using Mono.Addins; | ||
39 | |||
37 | namespace OpenSim.Region.CoreModules.Avatar.Groups | 40 | namespace OpenSim.Region.CoreModules.Avatar.Groups |
38 | { | 41 | { |
39 | public class GroupsModule : IRegionModule | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GroupsModule")] |
43 | public class GroupsModule : ISharedRegionModule | ||
40 | { | 44 | { |
41 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
42 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -55,9 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
55 | private static GroupMembershipData osGroup = | 59 | private static GroupMembershipData osGroup = |
56 | new GroupMembershipData(); | 60 | new GroupMembershipData(); |
57 | 61 | ||
58 | #region IRegionModule Members | 62 | private bool m_Enabled = false; |
63 | |||
64 | #region ISharedRegionModule Members | ||
59 | 65 | ||
60 | public void Initialise(Scene scene, IConfigSource config) | 66 | public void Initialise(IConfigSource config) |
61 | { | 67 | { |
62 | IConfig groupsConfig = config.Configs["Groups"]; | 68 | IConfig groupsConfig = config.Configs["Groups"]; |
63 | 69 | ||
@@ -67,7 +73,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
67 | } | 73 | } |
68 | else | 74 | else |
69 | { | 75 | { |
70 | if (!groupsConfig.GetBoolean("Enabled", false)) | 76 | m_Enabled = groupsConfig.GetBoolean("Enabled", false); |
77 | if (!m_Enabled) | ||
71 | { | 78 | { |
72 | m_log.Info("[GROUPS]: Groups disabled in configuration"); | 79 | m_log.Info("[GROUPS]: Groups disabled in configuration"); |
73 | return; | 80 | return; |
@@ -77,6 +84,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
77 | return; | 84 | return; |
78 | } | 85 | } |
79 | 86 | ||
87 | } | ||
88 | |||
89 | public void AddRegion(Scene scene) | ||
90 | { | ||
91 | if (!m_Enabled) | ||
92 | return; | ||
93 | |||
80 | lock (m_SceneList) | 94 | lock (m_SceneList) |
81 | { | 95 | { |
82 | if (!m_SceneList.Contains(scene)) | 96 | if (!m_SceneList.Contains(scene)) |
@@ -96,7 +110,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
96 | 110 | ||
97 | scene.EventManager.OnNewClient += OnNewClient; | 111 | scene.EventManager.OnNewClient += OnNewClient; |
98 | scene.EventManager.OnClientClosed += OnClientClosed; | 112 | scene.EventManager.OnClientClosed += OnClientClosed; |
99 | // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 113 | // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
114 | } | ||
115 | |||
116 | public void RemoveRegion(Scene scene) | ||
117 | { | ||
118 | if (!m_Enabled) | ||
119 | return; | ||
120 | |||
121 | lock (m_SceneList) | ||
122 | { | ||
123 | if (m_SceneList.Contains(scene)) | ||
124 | m_SceneList.Remove(scene); | ||
125 | } | ||
126 | |||
127 | scene.EventManager.OnNewClient -= OnNewClient; | ||
128 | scene.EventManager.OnClientClosed -= OnClientClosed; | ||
129 | } | ||
130 | |||
131 | public void RegionLoaded(Scene scene) | ||
132 | { | ||
100 | } | 133 | } |
101 | 134 | ||
102 | public void PostInitialise() | 135 | public void PostInitialise() |
@@ -105,6 +138,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
105 | 138 | ||
106 | public void Close() | 139 | public void Close() |
107 | { | 140 | { |
141 | if (!m_Enabled) | ||
142 | return; | ||
143 | |||
108 | // m_log.Debug("[GROUPS]: Shutting down group module."); | 144 | // m_log.Debug("[GROUPS]: Shutting down group module."); |
109 | 145 | ||
110 | lock (m_ClientMap) | 146 | lock (m_ClientMap) |
@@ -123,9 +159,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
123 | get { return "GroupsModule"; } | 159 | get { return "GroupsModule"; } |
124 | } | 160 | } |
125 | 161 | ||
126 | public bool IsSharedModule | 162 | public Type ReplaceableInterface |
127 | { | 163 | { |
128 | get { return true; } | 164 | get { return null; } |
129 | } | 165 | } |
130 | 166 | ||
131 | #endregion | 167 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index bf1d787..7bf19c2 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs | |||
@@ -48,7 +48,7 @@ using OpenSim.Server.Handlers.Hypergrid; | |||
48 | 48 | ||
49 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 49 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
50 | { | 50 | { |
51 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 51 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGMessageTransferModule")] |
52 | public class HGMessageTransferModule : ISharedRegionModule, IMessageTransferModule, IInstantMessageSimConnector | 52 | public class HGMessageTransferModule : ISharedRegionModule, IMessageTransferModule, IInstantMessageSimConnector |
53 | { | 53 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index 727f1c9..55e30a0 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -29,6 +29,7 @@ using System.Collections.Generic; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Timers; | 30 | using System.Timers; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -38,6 +39,7 @@ using OpenSim.Region.Framework.Scenes; | |||
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 40 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
40 | { | 41 | { |
42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InstantMessageModule")] | ||
41 | public class InstantMessageModule : ISharedRegionModule | 43 | public class InstantMessageModule : ISharedRegionModule |
42 | { | 44 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger( | 45 | private static readonly ILog m_log = LogManager.GetLogger( |
@@ -54,7 +56,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
54 | 56 | ||
55 | private readonly List<Scene> m_scenes = new List<Scene>(); | 57 | private readonly List<Scene> m_scenes = new List<Scene>(); |
56 | 58 | ||
57 | #region IRegionModule Members | 59 | #region Region Module interface |
58 | 60 | ||
59 | private IMessageTransferModule m_TransferModule = null; | 61 | private IMessageTransferModule m_TransferModule = null; |
60 | 62 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index edd9707..cc266df 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Addins; | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
@@ -43,6 +44,7 @@ using OpenSim.Services.Interfaces; | |||
43 | 44 | ||
44 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 45 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
45 | { | 46 | { |
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MessageTransferModule")] | ||
46 | public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule | 48 | public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule |
47 | { | 49 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs index 24cbaeb..7ce2813 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs | |||
@@ -29,6 +29,7 @@ using System.Collections.Generic; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using log4net; | 30 | using log4net; |
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using Mono.Addins; | ||
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
@@ -39,6 +40,7 @@ using OpenSim.Region.Framework.Scenes; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 41 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MuteListModule")] | ||
42 | public class MuteListModule : ISharedRegionModule | 44 | public class MuteListModule : ISharedRegionModule |
43 | { | 45 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index b27b07d..3a44cc5 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -28,6 +28,7 @@ using System; | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using log4net; | 30 | using log4net; |
31 | using Mono.Addins; | ||
31 | using Nini.Config; | 32 | using Nini.Config; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -39,6 +40,7 @@ using OpenSim.Region.Framework.Scenes; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 41 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OfflineMessageModule")] | ||
42 | public class OfflineMessageModule : ISharedRegionModule | 44 | public class OfflineMessageModule : ISharedRegionModule |
43 | { | 45 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs index dd17f3c..4c678c2 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs | |||
@@ -33,6 +33,7 @@ using log4net; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using Mono.Addins; | ||
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
@@ -42,6 +43,7 @@ using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | |||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 44 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
44 | { | 45 | { |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PresenceModule")] | ||
45 | public class PresenceModule : ISharedRegionModule, IPresenceModule | 47 | public class PresenceModule : ISharedRegionModule, IPresenceModule |
46 | { | 48 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger( | 49 | private static readonly ILog m_log = LogManager.GetLogger( |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 0833154..dc2b0e0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -411,18 +411,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
411 | { | 411 | { |
412 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); | 412 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); |
413 | 413 | ||
414 | item.CreatorIdAsUuid = ospResolvedId; | 414 | // item.CreatorIdAsUuid = ospResolvedId; |
415 | 415 | ||
416 | // Don't preserve the OSPA in the creator id (which actually gets persisted to the | 416 | // Don't preserve the OSPA in the creator id (which actually gets persisted to the |
417 | // database). Instead, replace with the UUID that we found. | 417 | // database). Instead, replace with the UUID that we found. |
418 | item.CreatorId = ospResolvedId.ToString(); | 418 | item.CreatorId = ospResolvedId.ToString(); |
419 | |||
420 | item.CreatorData = string.Empty; | 419 | item.CreatorData = string.Empty; |
421 | } | 420 | } |
422 | else if (item.CreatorData == null || item.CreatorData == String.Empty) | 421 | else if (item.CreatorData == null || item.CreatorData == String.Empty) |
423 | { | 422 | { |
424 | item.CreatorId = m_userInfo.PrincipalID.ToString(); | 423 | item.CreatorId = m_userInfo.PrincipalID.ToString(); |
425 | item.CreatorIdAsUuid = new UUID(item.CreatorId); | 424 | // item.CreatorIdAsUuid = new UUID(item.CreatorId); |
426 | } | 425 | } |
427 | 426 | ||
428 | item.Owner = m_userInfo.PrincipalID; | 427 | item.Owner = m_userInfo.PrincipalID; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 6587ead..d0e88f6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
166 | 166 | ||
167 | if (options.ContainsKey("verbose")) | 167 | if (options.ContainsKey("verbose")) |
168 | m_log.InfoFormat( | 168 | m_log.InfoFormat( |
169 | "[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}", | 169 | "[INVENTORY ARCHIVER]: Saving item {0} {1} (asset UUID {2})", |
170 | inventoryItem.ID, inventoryItem.Name, inventoryItem.AssetID); | 170 | inventoryItem.ID, inventoryItem.Name, inventoryItem.AssetID); |
171 | 171 | ||
172 | string filename = path + CreateArchiveItemName(inventoryItem); | 172 | string filename = path + CreateArchiveItemName(inventoryItem); |
@@ -337,11 +337,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
337 | { | 337 | { |
338 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetUuids.Count); | 338 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetUuids.Count); |
339 | 339 | ||
340 | new AssetsRequest( | 340 | AssetsRequest ar |
341 | new AssetsArchiver(m_archiveWriter), | 341 | = new AssetsRequest( |
342 | m_assetUuids, m_scene.AssetService, | 342 | new AssetsArchiver(m_archiveWriter), |
343 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, | 343 | m_assetUuids, m_scene.AssetService, |
344 | options, ReceivedAllAssets).Execute(); | 344 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, |
345 | options, ReceivedAllAssets); | ||
346 | |||
347 | Util.FireAndForget(o => ar.Execute()); | ||
345 | } | 348 | } |
346 | else | 349 | else |
347 | { | 350 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 7d1fe68..f4f9e2d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -35,23 +35,22 @@ using Nini.Config; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
38 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
42 | using Mono.Addins; | ||
41 | 43 | ||
42 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | 44 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver |
43 | { | 45 | { |
44 | /// <summary> | 46 | /// <summary> |
45 | /// This module loads and saves OpenSimulator inventory archives | 47 | /// This module loads and saves OpenSimulator inventory archives |
46 | /// </summary> | 48 | /// </summary> |
47 | public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule | 49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InventoryArchiverModule")] |
50 | public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule | ||
48 | { | 51 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 53 | ||
51 | public string Name { get { return "Inventory Archiver Module"; } } | ||
52 | |||
53 | public bool IsSharedModule { get { return true; } } | ||
54 | |||
55 | /// <value> | 54 | /// <value> |
56 | /// Enable or disable checking whether the iar user is actually logged in | 55 | /// Enable or disable checking whether the iar user is actually logged in |
57 | /// </value> | 56 | /// </value> |
@@ -98,9 +97,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
98 | // public InventoryArchiverModule(bool disablePresenceChecks) | 97 | // public InventoryArchiverModule(bool disablePresenceChecks) |
99 | // { | 98 | // { |
100 | // DisablePresenceChecks = disablePresenceChecks; | 99 | // DisablePresenceChecks = disablePresenceChecks; |
101 | // } | 100 | // } |
101 | |||
102 | #region ISharedRegionModule | ||
103 | |||
104 | public void Initialise(IConfigSource source) | ||
105 | { | ||
106 | } | ||
102 | 107 | ||
103 | public void Initialise(Scene scene, IConfigSource source) | 108 | public void AddRegion(Scene scene) |
104 | { | 109 | { |
105 | if (m_scenes.Count == 0) | 110 | if (m_scenes.Count == 0) |
106 | { | 111 | { |
@@ -143,10 +148,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
143 | m_scenes[scene.RegionInfo.RegionID] = scene; | 148 | m_scenes[scene.RegionInfo.RegionID] = scene; |
144 | } | 149 | } |
145 | 150 | ||
146 | public void PostInitialise() {} | 151 | public void RemoveRegion(Scene scene) |
152 | { | ||
153 | } | ||
147 | 154 | ||
148 | public void Close() {} | 155 | public void Close() {} |
149 | 156 | ||
157 | public void RegionLoaded(Scene scene) | ||
158 | { | ||
159 | } | ||
160 | |||
161 | public void PostInitialise() | ||
162 | { | ||
163 | } | ||
164 | |||
165 | public Type ReplaceableInterface | ||
166 | { | ||
167 | get { return null; } | ||
168 | } | ||
169 | |||
170 | public string Name { get { return "Inventory Archiver Module"; } } | ||
171 | |||
172 | #endregion | ||
173 | |||
150 | /// <summary> | 174 | /// <summary> |
151 | /// Trigger the inventory archive saved event. | 175 | /// Trigger the inventory archive saved event. |
152 | /// </summary> | 176 | /// </summary> |
@@ -209,6 +233,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
209 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, | 233 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, |
210 | Dictionary<string, object> options) | 234 | Dictionary<string, object> options) |
211 | { | 235 | { |
236 | // if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath)) | ||
237 | // return false; | ||
238 | |||
212 | if (m_scenes.Count > 0) | 239 | if (m_scenes.Count > 0) |
213 | { | 240 | { |
214 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 241 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index 1056865..db78da9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -82,7 +82,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
82 | 82 | ||
83 | protected string m_item1Name = "Ray Gun Item"; | 83 | protected string m_item1Name = "Ray Gun Item"; |
84 | protected string m_coaItemName = "Coalesced Item"; | 84 | protected string m_coaItemName = "Coalesced Item"; |
85 | 85 | ||
86 | [TestFixtureSetUp] | ||
87 | public void FixtureSetup() | ||
88 | { | ||
89 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
90 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
91 | |||
92 | ConstructDefaultIarBytesForTestLoad(); | ||
93 | } | ||
94 | |||
95 | [TestFixtureTearDown] | ||
96 | public void TearDown() | ||
97 | { | ||
98 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
99 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
100 | // tests really shouldn't). | ||
101 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
102 | } | ||
103 | |||
86 | [SetUp] | 104 | [SetUp] |
87 | public override void SetUp() | 105 | public override void SetUp() |
88 | { | 106 | { |
@@ -90,12 +108,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
90 | m_iarStream = new MemoryStream(m_iarStreamBytes); | 108 | m_iarStream = new MemoryStream(m_iarStreamBytes); |
91 | } | 109 | } |
92 | 110 | ||
93 | [TestFixtureSetUp] | ||
94 | public void FixtureSetup() | ||
95 | { | ||
96 | ConstructDefaultIarBytesForTestLoad(); | ||
97 | } | ||
98 | |||
99 | protected void ConstructDefaultIarBytesForTestLoad() | 111 | protected void ConstructDefaultIarBytesForTestLoad() |
100 | { | 112 | { |
101 | // log4net.Config.XmlConfigurator.Configure(); | 113 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -122,7 +134,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
122 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 134 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
123 | item1.AssetID = asset1.FullID; | 135 | item1.AssetID = asset1.FullID; |
124 | item1.GroupID = UUID.Random(); | 136 | item1.GroupID = UUID.Random(); |
125 | item1.CreatorIdAsUuid = m_uaLL1.PrincipalID; | 137 | item1.CreatorId = m_uaLL1.PrincipalID.ToString(); |
126 | item1.Owner = m_uaLL1.PrincipalID; | 138 | item1.Owner = m_uaLL1.PrincipalID; |
127 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | 139 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; |
128 | scene.AddInventoryItem(item1); | 140 | scene.AddInventoryItem(item1); |
@@ -145,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
145 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); | 157 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); |
146 | coaItem.AssetID = coaAsset.FullID; | 158 | coaItem.AssetID = coaAsset.FullID; |
147 | coaItem.GroupID = UUID.Random(); | 159 | coaItem.GroupID = UUID.Random(); |
148 | coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID; | 160 | coaItem.CreatorId = m_uaLL1.PrincipalID.ToString(); |
149 | coaItem.Owner = m_uaLL1.PrincipalID; | 161 | coaItem.Owner = m_uaLL1.PrincipalID; |
150 | coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | 162 | coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; |
151 | scene.AddInventoryItem(coaItem); | 163 | scene.AddInventoryItem(coaItem); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index b112b6d..06f6e49 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
49 | { | 49 | { |
50 | [TestFixture] | 50 | [TestFixture] |
51 | public class InventoryArchiverTests : InventoryArchiveTestCase | 51 | public class InventoryArchiverTests : InventoryArchiveTestCase |
52 | { | 52 | { |
53 | protected TestScene m_scene; | 53 | protected TestScene m_scene; |
54 | protected InventoryArchiverModule m_archiverModule; | 54 | protected InventoryArchiverModule m_archiverModule; |
55 | 55 | ||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
69 | public void TestLoadCoalesecedItem() | 69 | public void TestLoadCoalesecedItem() |
70 | { | 70 | { |
71 | TestHelpers.InMethod(); | 71 | TestHelpers.InMethod(); |
72 | // log4net.Config.XmlConfigurator.Configure(); | 72 | // TestHelpers.EnableLogging(); |
73 | 73 | ||
74 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | 74 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); |
75 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | 75 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); |
@@ -350,38 +350,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
350 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID)); | 350 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID)); |
351 | } | 351 | } |
352 | 352 | ||
353 | /// <summary> | 353 | // /// <summary> |
354 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 354 | // /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
355 | /// an account exists with the same name as the creator, though not the same id. | 355 | // /// an account exists with the same name as the creator, though not the same id. |
356 | /// </summary> | 356 | // /// </summary> |
357 | [Test] | 357 | // [Test] |
358 | public void TestLoadIarV0_1SameNameCreator() | 358 | // public void TestLoadIarV0_1SameNameCreator() |
359 | { | 359 | // { |
360 | TestHelpers.InMethod(); | 360 | // TestHelpers.InMethod(); |
361 | // log4net.Config.XmlConfigurator.Configure(); | 361 | // TestHelpers.EnableLogging(); |
362 | 362 | // | |
363 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); | 363 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); |
364 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire"); | 364 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire"); |
365 | 365 | // | |
366 | m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); | 366 | // m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); |
367 | InventoryItemBase foundItem1 | 367 | // InventoryItemBase foundItem1 |
368 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | 368 | // = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); |
369 | 369 | // | |
370 | Assert.That( | 370 | // Assert.That( |
371 | foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()), | 371 | // foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()), |
372 | "Loaded item non-uuid creator doesn't match original"); | 372 | // "Loaded item non-uuid creator doesn't match original"); |
373 | Assert.That( | 373 | // Assert.That( |
374 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID), | 374 | // foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID), |
375 | "Loaded item uuid creator doesn't match original"); | 375 | // "Loaded item uuid creator doesn't match original"); |
376 | Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID), | 376 | // Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID), |
377 | "Loaded item owner doesn't match inventory reciever"); | 377 | // "Loaded item owner doesn't match inventory reciever"); |
378 | 378 | // | |
379 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); | 379 | // AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); |
380 | string xmlData = Utils.BytesToString(asset1.Data); | 380 | // string xmlData = Utils.BytesToString(asset1.Data); |
381 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 381 | // SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
382 | 382 | // | |
383 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID)); | 383 | // Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID)); |
384 | } | 384 | // } |
385 | 385 | ||
386 | /// <summary> | 386 | /// <summary> |
387 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 387 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index c14cb17..4cfa33d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -38,20 +39,21 @@ using OpenSim.Services.Interfaces; | |||
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | 40 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer |
40 | { | 41 | { |
41 | public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InventoryTransferModule")] |
43 | public class InventoryTransferModule : ISharedRegionModule | ||
42 | { | 44 | { |
43 | private static readonly ILog m_log | 45 | private static readonly ILog m_log |
44 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 47 | ||
46 | /// <summary> | 48 | /// <summary> |
47 | private List<Scene> m_Scenelist = new List<Scene>(); | 49 | private List<Scene> m_Scenelist = new List<Scene>(); |
48 | private Dictionary<UUID, Scene> m_AgentRegions = | 50 | // private Dictionary<UUID, Scene> m_AgentRegions = |
49 | new Dictionary<UUID, Scene>(); | 51 | // new Dictionary<UUID, Scene>(); |
50 | 52 | ||
51 | private IMessageTransferModule m_TransferModule = null; | 53 | private IMessageTransferModule m_TransferModule = null; |
52 | private bool m_Enabled = true; | 54 | private bool m_Enabled = true; |
53 | 55 | ||
54 | #region IRegionModule Members | 56 | #region Region Module interface |
55 | 57 | ||
56 | public void Initialise(IConfigSource config) | 58 | public void Initialise(IConfigSource config) |
57 | { | 59 | { |
@@ -76,12 +78,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
76 | 78 | ||
77 | m_Scenelist.Add(scene); | 79 | m_Scenelist.Add(scene); |
78 | 80 | ||
79 | scene.RegisterModuleInterface<IInventoryTransferModule>(this); | 81 | // scene.RegisterModuleInterface<IInventoryTransferModule>(this); |
80 | 82 | ||
81 | scene.EventManager.OnNewClient += OnNewClient; | 83 | scene.EventManager.OnNewClient += OnNewClient; |
82 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 84 | // scene.EventManager.OnClientClosed += ClientLoggedOut; |
83 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 85 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
84 | scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; | 86 | // scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; |
85 | } | 87 | } |
86 | 88 | ||
87 | public void RegionLoaded(Scene scene) | 89 | public void RegionLoaded(Scene scene) |
@@ -96,9 +98,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
96 | 98 | ||
97 | m_Scenelist.Clear(); | 99 | m_Scenelist.Clear(); |
98 | scene.EventManager.OnNewClient -= OnNewClient; | 100 | scene.EventManager.OnNewClient -= OnNewClient; |
99 | scene.EventManager.OnClientClosed -= ClientLoggedOut; | 101 | // scene.EventManager.OnClientClosed -= ClientLoggedOut; |
100 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | 102 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; |
101 | scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; | 103 | // scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; |
102 | } | 104 | } |
103 | } | 105 | } |
104 | } | 106 | } |
@@ -106,9 +108,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
106 | public void RemoveRegion(Scene scene) | 108 | public void RemoveRegion(Scene scene) |
107 | { | 109 | { |
108 | scene.EventManager.OnNewClient -= OnNewClient; | 110 | scene.EventManager.OnNewClient -= OnNewClient; |
109 | scene.EventManager.OnClientClosed -= ClientLoggedOut; | 111 | // scene.EventManager.OnClientClosed -= ClientLoggedOut; |
110 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | 112 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; |
111 | scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; | 113 | // scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; |
112 | m_Scenelist.Remove(scene); | 114 | m_Scenelist.Remove(scene); |
113 | } | 115 | } |
114 | 116 | ||
@@ -138,10 +140,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
138 | client.OnInstantMessage += OnInstantMessage; | 140 | client.OnInstantMessage += OnInstantMessage; |
139 | } | 141 | } |
140 | 142 | ||
141 | protected void OnSetRootAgentScene(UUID id, Scene scene) | 143 | // protected void OnSetRootAgentScene(UUID id, Scene scene) |
142 | { | 144 | // { |
143 | m_AgentRegions[id] = scene; | 145 | // m_AgentRegions[id] = scene; |
144 | } | 146 | // } |
145 | 147 | ||
146 | private Scene FindClientScene(UUID agentId) | 148 | private Scene FindClientScene(UUID agentId) |
147 | { | 149 | { |
@@ -313,45 +315,77 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
313 | m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); | 315 | m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); |
314 | } | 316 | } |
315 | } | 317 | } |
316 | else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | ||
317 | { | ||
318 | UUID destinationFolderID = UUID.Zero; | ||
319 | |||
320 | if (im.binaryBucket != null && im.binaryBucket.Length >= 16) | ||
321 | { | ||
322 | destinationFolderID = new UUID(im.binaryBucket, 0); | ||
323 | } | ||
324 | |||
325 | if (destinationFolderID != UUID.Zero) | ||
326 | { | ||
327 | IInventoryService invService = scene.InventoryService; | ||
328 | |||
329 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | ||
330 | 318 | ||
331 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); | 319 | // Disabled for now as it looks like http://opensimulator.org/mantis/view.php?id=6311 was fixed by fixes |
332 | item = invService.GetItem(item); | 320 | // to inventory folder versioning allowing the viewer to move the received folder itself as happens on the |
333 | InventoryFolderBase folder = null; | 321 | // LL grid. Doing it again server-side then wrongly does a second create and move |
334 | 322 | // // XXX: This code was placed here to try and accomdate RLV which moves given folders named #RLV/~<name> | |
335 | if (item != null) // It's an item | 323 | // // to a folder called name in #RLV. However, this approach may not be ultimately correct - from analysis |
336 | { | 324 | // // of Firestorm 4.2.2 on sending an InventoryOffered instead of TaskInventoryOffered (as was previously |
337 | item.Folder = destinationFolderID; | 325 | // // done), the viewer itself would appear to move and rename the folder, rather than the simulator doing it here. |
338 | 326 | // else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | |
339 | invService.DeleteItems(item.Owner, new List<UUID>() { item.ID }); | 327 | // { |
340 | scene.AddInventoryItem(client, item); | 328 | // UUID destinationFolderID = UUID.Zero; |
341 | } | 329 | // |
342 | else | 330 | // if (im.binaryBucket != null && im.binaryBucket.Length >= 16) |
343 | { | 331 | // { |
344 | folder = new InventoryFolderBase(inventoryID, client.AgentId); | 332 | // destinationFolderID = new UUID(im.binaryBucket, 0); |
345 | folder = invService.GetFolder(folder); | 333 | // } |
346 | 334 | // | |
347 | if (folder != null) // It's a folder | 335 | // if (destinationFolderID != UUID.Zero) |
348 | { | 336 | // { |
349 | folder.ParentID = destinationFolderID; | 337 | // InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId); |
350 | invService.MoveFolder(folder); | 338 | // if (destinationFolder == null) |
351 | } | 339 | // { |
352 | } | 340 | // m_log.WarnFormat( |
353 | } | 341 | // "[INVENTORY TRANSFER]: TaskInventoryAccepted message from {0} in {1} specified folder {2} which does not exist", |
354 | } | 342 | // client.Name, scene.Name, destinationFolderID); |
343 | // | ||
344 | // return; | ||
345 | // } | ||
346 | // | ||
347 | // IInventoryService invService = scene.InventoryService; | ||
348 | // | ||
349 | // UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | ||
350 | // | ||
351 | // InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); | ||
352 | // item = invService.GetItem(item); | ||
353 | // InventoryFolderBase folder = null; | ||
354 | // UUID? previousParentFolderID = null; | ||
355 | // | ||
356 | // if (item != null) // It's an item | ||
357 | // { | ||
358 | // previousParentFolderID = item.Folder; | ||
359 | // item.Folder = destinationFolderID; | ||
360 | // | ||
361 | // invService.DeleteItems(item.Owner, new List<UUID>() { item.ID }); | ||
362 | // scene.AddInventoryItem(client, item); | ||
363 | // } | ||
364 | // else | ||
365 | // { | ||
366 | // folder = new InventoryFolderBase(inventoryID, client.AgentId); | ||
367 | // folder = invService.GetFolder(folder); | ||
368 | // | ||
369 | // if (folder != null) // It's a folder | ||
370 | // { | ||
371 | // previousParentFolderID = folder.ParentID; | ||
372 | // folder.ParentID = destinationFolderID; | ||
373 | // invService.MoveFolder(folder); | ||
374 | // } | ||
375 | // } | ||
376 | // | ||
377 | // // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). | ||
378 | // if (previousParentFolderID != null) | ||
379 | // { | ||
380 | // InventoryFolderBase previousParentFolder | ||
381 | // = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); | ||
382 | // previousParentFolder = invService.GetFolder(previousParentFolder); | ||
383 | // scene.SendInventoryUpdate(client, previousParentFolder, true, true); | ||
384 | // | ||
385 | // scene.SendInventoryUpdate(client, destinationFolder, true, true); | ||
386 | // } | ||
387 | // } | ||
388 | // } | ||
355 | else if ( | 389 | else if ( |
356 | im.dialog == (byte)InstantMessageDialog.InventoryDeclined | 390 | im.dialog == (byte)InstantMessageDialog.InventoryDeclined |
357 | || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) | 391 | || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) |
@@ -370,9 +404,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
370 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); | 404 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); |
371 | item = invService.GetItem(item); | 405 | item = invService.GetItem(item); |
372 | InventoryFolderBase folder = null; | 406 | InventoryFolderBase folder = null; |
407 | UUID? previousParentFolderID = null; | ||
373 | 408 | ||
374 | if (item != null && trashFolder != null) | 409 | if (item != null && trashFolder != null) |
375 | { | 410 | { |
411 | previousParentFolderID = item.Folder; | ||
376 | item.Folder = trashFolder.ID; | 412 | item.Folder = trashFolder.ID; |
377 | 413 | ||
378 | // Diva comment: can't we just update this item??? | 414 | // Diva comment: can't we just update this item??? |
@@ -388,6 +424,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
388 | 424 | ||
389 | if (folder != null & trashFolder != null) | 425 | if (folder != null & trashFolder != null) |
390 | { | 426 | { |
427 | previousParentFolderID = folder.ParentID; | ||
391 | folder.ParentID = trashFolder.ID; | 428 | folder.ParentID = trashFolder.ID; |
392 | invService.MoveFolder(folder); | 429 | invService.MoveFolder(folder); |
393 | client.SendBulkUpdateInventory(folder); | 430 | client.SendBulkUpdateInventory(folder); |
@@ -408,84 +445,97 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
408 | client.SendAgentAlertMessage("Unable to delete "+ | 445 | client.SendAgentAlertMessage("Unable to delete "+ |
409 | "received inventory" + reason, false); | 446 | "received inventory" + reason, false); |
410 | } | 447 | } |
411 | 448 | // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). | |
412 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); | 449 | else if (previousParentFolderID != null) |
413 | |||
414 | if (user != null) // Local | ||
415 | { | 450 | { |
416 | user.ControllingClient.SendInstantMessage(im); | 451 | InventoryFolderBase previousParentFolder |
417 | } | 452 | = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); |
418 | else | 453 | previousParentFolder = invService.GetFolder(previousParentFolder); |
419 | { | 454 | scene.SendInventoryUpdate(client, previousParentFolder, true, true); |
420 | if (m_TransferModule != null) | ||
421 | m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); | ||
422 | } | ||
423 | } | ||
424 | } | ||
425 | 455 | ||
426 | public bool NeedSceneCacheClear(UUID agentID, Scene scene) | 456 | scene.SendInventoryUpdate(client, trashFolder, true, true); |
427 | { | 457 | } |
428 | if (!m_AgentRegions.ContainsKey(agentID)) | ||
429 | { | ||
430 | // Since we can get here two ways, we need to scan | ||
431 | // the scenes here. This is somewhat more expensive | ||
432 | // but helps avoid a nasty bug | ||
433 | // | ||
434 | 458 | ||
435 | foreach (Scene s in m_Scenelist) | 459 | if (im.dialog == (byte)InstantMessageDialog.InventoryDeclined) |
436 | { | 460 | { |
437 | ScenePresence presence; | 461 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
438 | 462 | ||
439 | if (s.TryGetScenePresence(agentID, out presence)) | 463 | if (user != null) // Local |
440 | { | 464 | { |
441 | // If the agent is in this scene, then we | 465 | user.ControllingClient.SendInstantMessage(im); |
442 | // are being called twice in a single | 466 | } |
443 | // teleport. This is wasteful of cycles | 467 | else |
444 | // but harmless due to this 2nd level check | 468 | { |
445 | // | 469 | if (m_TransferModule != null) |
446 | // If the agent is found in another scene | 470 | m_TransferModule.SendInstantMessage(im, delegate(bool success) { }); |
447 | // then the list wasn't current | ||
448 | // | ||
449 | // If the agent is totally unknown, then what | ||
450 | // are we even doing here?? | ||
451 | // | ||
452 | if (s == scene) | ||
453 | { | ||
454 | //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName); | ||
455 | return true; | ||
456 | } | ||
457 | else | ||
458 | { | ||
459 | //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName); | ||
460 | return false; | ||
461 | } | ||
462 | } | 471 | } |
463 | } | 472 | } |
464 | //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName); | ||
465 | return true; | ||
466 | } | 473 | } |
467 | |||
468 | // The agent is left in current Scene, so we must be | ||
469 | // going to another instance | ||
470 | // | ||
471 | if (m_AgentRegions[agentID] == scene) | ||
472 | { | ||
473 | //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName); | ||
474 | m_AgentRegions.Remove(agentID); | ||
475 | return true; | ||
476 | } | ||
477 | |||
478 | // Another region has claimed the agent | ||
479 | // | ||
480 | //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName); | ||
481 | return false; | ||
482 | } | 474 | } |
483 | 475 | ||
484 | public void ClientLoggedOut(UUID agentID, Scene scene) | 476 | // public bool NeedSceneCacheClear(UUID agentID, Scene scene) |
485 | { | 477 | // { |
486 | if (m_AgentRegions.ContainsKey(agentID)) | 478 | // if (!m_AgentRegions.ContainsKey(agentID)) |
487 | m_AgentRegions.Remove(agentID); | 479 | // { |
488 | } | 480 | // // Since we can get here two ways, we need to scan |
481 | // // the scenes here. This is somewhat more expensive | ||
482 | // // but helps avoid a nasty bug | ||
483 | // // | ||
484 | // | ||
485 | // foreach (Scene s in m_Scenelist) | ||
486 | // { | ||
487 | // ScenePresence presence; | ||
488 | // | ||
489 | // if (s.TryGetScenePresence(agentID, out presence)) | ||
490 | // { | ||
491 | // // If the agent is in this scene, then we | ||
492 | // // are being called twice in a single | ||
493 | // // teleport. This is wasteful of cycles | ||
494 | // // but harmless due to this 2nd level check | ||
495 | // // | ||
496 | // // If the agent is found in another scene | ||
497 | // // then the list wasn't current | ||
498 | // // | ||
499 | // // If the agent is totally unknown, then what | ||
500 | // // are we even doing here?? | ||
501 | // // | ||
502 | // if (s == scene) | ||
503 | // { | ||
504 | // //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName); | ||
505 | // return true; | ||
506 | // } | ||
507 | // else | ||
508 | // { | ||
509 | // //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName); | ||
510 | // return false; | ||
511 | // } | ||
512 | // } | ||
513 | // } | ||
514 | // //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName); | ||
515 | // return true; | ||
516 | // } | ||
517 | // | ||
518 | // // The agent is left in current Scene, so we must be | ||
519 | // // going to another instance | ||
520 | // // | ||
521 | // if (m_AgentRegions[agentID] == scene) | ||
522 | // { | ||
523 | // //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName); | ||
524 | // m_AgentRegions.Remove(agentID); | ||
525 | // return true; | ||
526 | // } | ||
527 | // | ||
528 | // // Another region has claimed the agent | ||
529 | // // | ||
530 | // //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName); | ||
531 | // return false; | ||
532 | // } | ||
533 | // | ||
534 | // public void ClientLoggedOut(UUID agentID, Scene scene) | ||
535 | // { | ||
536 | // if (m_AgentRegions.ContainsKey(agentID)) | ||
537 | // m_AgentRegions.Remove(agentID); | ||
538 | // } | ||
489 | 539 | ||
490 | /// <summary> | 540 | /// <summary> |
491 | /// | 541 | /// |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs index 92cf9d1..232a4fe 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | |||
@@ -42,7 +42,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
42 | 42 | ||
43 | namespace OpenSim.Region.CoreModules.Avatar.Lure | 43 | namespace OpenSim.Region.CoreModules.Avatar.Lure |
44 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGLureModule")] |
46 | public class HGLureModule : ISharedRegionModule | 46 | public class HGLureModule : ISharedRegionModule |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger( | 48 | private static readonly ILog m_log = LogManager.GetLogger( |
@@ -186,7 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
186 | client.FirstName+" "+client.LastName, targetid, | 186 | client.FirstName+" "+client.LastName, targetid, |
187 | (byte)InstantMessageDialog.RequestTeleport, false, | 187 | (byte)InstantMessageDialog.RequestTeleport, false, |
188 | message, sessionID, false, presence.AbsolutePosition, | 188 | message, sessionID, false, presence.AbsolutePosition, |
189 | new Byte[0]); | 189 | new Byte[0], true); |
190 | m.RegionID = client.Scene.RegionInfo.RegionID.Guid; | 190 | m.RegionID = client.Scene.RegionInfo.RegionID.Guid; |
191 | 191 | ||
192 | m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", m.imSessionID, m.RegionID, m.message); | 192 | m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", m.imSessionID, m.RegionID, m.message); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index a889984..f3adb95 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; | |||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.Lure | 39 | namespace OpenSim.Region.CoreModules.Avatar.Lure |
39 | { | 40 | { |
41 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LureModule")] | ||
40 | public class LureModule : ISharedRegionModule | 42 | public class LureModule : ISharedRegionModule |
41 | { | 43 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger( | 44 | private static readonly ILog m_log = LogManager.GetLogger( |
@@ -173,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
173 | client.FirstName+" "+client.LastName, targetid, | 175 | client.FirstName+" "+client.LastName, targetid, |
174 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, | 176 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, |
175 | message, dest, false, presence.AbsolutePosition, | 177 | message, dest, false, presence.AbsolutePosition, |
176 | new Byte[0]); | 178 | new Byte[0], true); |
177 | } | 179 | } |
178 | else | 180 | else |
179 | { | 181 | { |
@@ -181,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
181 | client.FirstName+" "+client.LastName, targetid, | 183 | client.FirstName+" "+client.LastName, targetid, |
182 | (byte)InstantMessageDialog.RequestTeleport, false, | 184 | (byte)InstantMessageDialog.RequestTeleport, false, |
183 | message, dest, false, presence.AbsolutePosition, | 185 | message, dest, false, presence.AbsolutePosition, |
184 | new Byte[0]); | 186 | new Byte[0], true); |
185 | } | 187 | } |
186 | 188 | ||
187 | if (m_TransferModule != null) | 189 | if (m_TransferModule != null) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index 87ca327..bf24030 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | |||
@@ -42,7 +42,7 @@ using OpenSim.Services.Interfaces; | |||
42 | 42 | ||
43 | namespace OpenSim.Region.CoreModules.Avatar.Profile | 43 | namespace OpenSim.Region.CoreModules.Avatar.Profile |
44 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicProfileModule")] |
46 | public class BasicProfileModule : IProfileModule, ISharedRegionModule | 46 | public class BasicProfileModule : IProfileModule, ISharedRegionModule |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |