diff options
author | Melanie | 2012-05-27 19:24:30 +0100 |
---|---|---|
committer | Melanie | 2012-05-27 19:24:30 +0100 |
commit | 884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f (patch) | |
tree | dd692a54213f86fd64bd29c6662584df85088193 /OpenSim/Region/CoreModules/Avatar | |
parent | Merge branch 'master' into careminster (diff) | |
parent | minor: code formatting from 0b72f773 (diff) | |
download | opensim-SC_OLD-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.zip opensim-SC_OLD-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.tar.gz opensim-SC_OLD-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.tar.bz2 opensim-SC_OLD-884c0e7bb10bd2c2a951901c6f1dd56a86ef6b9f.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Data/MySQL/MySQLSimulationData.cs
OpenSim/Data/MySQL/Resources/RegionStore.migrations
OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
OpenSim/Region/Framework/Scenes/Scene.cs
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
3 files changed, 91 insertions, 83 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2bfe190..7a91481 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
52 | private Scene m_scene; | 52 | private Scene m_scene; |
53 | private IDialogModule m_dialogModule; | 53 | private IInventoryAccessModule m_invAccessModule; |
54 | 54 | ||
55 | /// <summary> | 55 | /// <summary> |
56 | /// Are attachments enabled? | 56 | /// Are attachments enabled? |
@@ -72,7 +72,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
72 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
73 | { | 73 | { |
74 | m_scene = scene; | 74 | m_scene = scene; |
75 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | ||
76 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); | 75 | m_scene.RegisterModuleInterface<IAttachmentsModule>(this); |
77 | 76 | ||
78 | if (Enabled) | 77 | if (Enabled) |
@@ -89,7 +88,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
89 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | 88 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; |
90 | } | 89 | } |
91 | 90 | ||
92 | public void RegionLoaded(Scene scene) {} | 91 | public void RegionLoaded(Scene scene) |
92 | { | ||
93 | m_invAccessModule = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | ||
94 | } | ||
93 | 95 | ||
94 | public void Close() | 96 | public void Close() |
95 | { | 97 | { |
@@ -629,6 +631,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
629 | /// <returns>The user inventory item created that holds the attachment.</returns> | 631 | /// <returns>The user inventory item created that holds the attachment.</returns> |
630 | private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IScenePresence sp, SceneObjectGroup grp) | 632 | private InventoryItemBase AddSceneObjectAsNewAttachmentInInv(IScenePresence sp, SceneObjectGroup grp) |
631 | { | 633 | { |
634 | if (m_invAccessModule == null) | ||
635 | return null; | ||
636 | |||
632 | // m_log.DebugFormat( | 637 | // m_log.DebugFormat( |
633 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", | 638 | // "[ATTACHMENTS MODULE]: Called AddSceneObjectAsAttachment for object {0} {1} for {2}", |
634 | // grp.Name, grp.LocalId, remoteClient.Name); | 639 | // grp.Name, grp.LocalId, remoteClient.Name); |
@@ -702,16 +707,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
702 | // sets itemID so client can show item as 'attached' in inventory | 707 | // sets itemID so client can show item as 'attached' in inventory |
703 | grp.FromItemID = item.ID; | 708 | grp.FromItemID = item.ID; |
704 | 709 | ||
705 | if (m_scene.AddInventoryItem(item)) | ||
706 | { | ||
707 | sp.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
708 | } | ||
709 | else | ||
710 | { | ||
711 | if (m_dialogModule != null) | ||
712 | m_dialogModule.SendAlertToUser(sp.ControllingClient, "Operation failed"); | ||
713 | } | ||
714 | |||
715 | return item; | 710 | return item; |
716 | } | 711 | } |
717 | 712 | ||
@@ -760,76 +755,75 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
760 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 755 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
761 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) | 756 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) |
762 | { | 757 | { |
763 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 758 | if (m_invAccessModule == null) |
764 | if (invAccess != null) | 759 | return null; |
760 | |||
761 | lock (sp.AttachmentsSyncLock) | ||
765 | { | 762 | { |
766 | lock (sp.AttachmentsSyncLock) | 763 | SceneObjectGroup objatt; |
764 | |||
765 | if (itemID != UUID.Zero) | ||
766 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | ||
767 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
768 | false, false, sp.UUID, true); | ||
769 | else | ||
770 | objatt = m_invAccessModule.RezObject(sp.ControllingClient, | ||
771 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
772 | false, false, sp.UUID, true); | ||
773 | |||
774 | // m_log.DebugFormat( | ||
775 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
776 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
777 | |||
778 | if (objatt != null) | ||
767 | { | 779 | { |
768 | SceneObjectGroup objatt; | 780 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. |
769 | 781 | objatt.HasGroupChanged = false; | |
770 | if (itemID != UUID.Zero) | 782 | bool tainted = false; |
771 | objatt = invAccess.RezObject(sp.ControllingClient, | 783 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) |
772 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | 784 | tainted = true; |
773 | false, false, sp.UUID, true); | ||
774 | else | ||
775 | objatt = invAccess.RezObject(sp.ControllingClient, | ||
776 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | ||
777 | false, false, sp.UUID, true); | ||
778 | |||
779 | // m_log.DebugFormat( | ||
780 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | ||
781 | // objatt.Name, remoteClient.Name, AttachmentPt); | ||
782 | |||
783 | if (objatt != null) | ||
784 | { | ||
785 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. | ||
786 | objatt.HasGroupChanged = false; | ||
787 | bool tainted = false; | ||
788 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) | ||
789 | tainted = true; | ||
790 | |||
791 | // This will throw if the attachment fails | ||
792 | try | ||
793 | { | ||
794 | AttachObject(sp, objatt, attachmentPt, false); | ||
795 | } | ||
796 | catch (Exception e) | ||
797 | { | ||
798 | m_log.ErrorFormat( | ||
799 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", | ||
800 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); | ||
801 | |||
802 | // Make sure the object doesn't stick around and bail | ||
803 | sp.RemoveAttachment(objatt); | ||
804 | m_scene.DeleteSceneObject(objatt, false); | ||
805 | return null; | ||
806 | } | ||
807 | |||
808 | if (tainted) | ||
809 | objatt.HasGroupChanged = true; | ||
810 | |||
811 | if (doc != null) | ||
812 | { | ||
813 | objatt.LoadScriptState(doc); | ||
814 | objatt.ResetOwnerChangeFlag(); | ||
815 | } | ||
816 | |||
817 | // Fire after attach, so we don't get messy perms dialogs | ||
818 | // 4 == AttachedRez | ||
819 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | ||
820 | objatt.ResumeScripts(); | ||
821 | |||
822 | // Do this last so that event listeners have access to all the effects of the attachment | ||
823 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); | ||
824 | 785 | ||
825 | return objatt; | 786 | // This will throw if the attachment fails |
787 | try | ||
788 | { | ||
789 | AttachObject(sp, objatt, attachmentPt, false); | ||
826 | } | 790 | } |
827 | else | 791 | catch (Exception e) |
828 | { | 792 | { |
829 | m_log.WarnFormat( | 793 | m_log.ErrorFormat( |
830 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | 794 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", |
831 | itemID, sp.Name, attachmentPt); | 795 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); |
796 | |||
797 | // Make sure the object doesn't stick around and bail | ||
798 | sp.RemoveAttachment(objatt); | ||
799 | m_scene.DeleteSceneObject(objatt, false); | ||
800 | return null; | ||
832 | } | 801 | } |
802 | |||
803 | if (doc != null) | ||
804 | { | ||
805 | objatt.LoadScriptState(doc); | ||
806 | objatt.ResetOwnerChangeFlag(); | ||
807 | } | ||
808 | |||
809 | if (tainted) | ||
810 | objatt.HasGroupChanged = true; | ||
811 | |||
812 | // Fire after attach, so we don't get messy perms dialogs | ||
813 | // 4 == AttachedRez | ||
814 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | ||
815 | objatt.ResumeScripts(); | ||
816 | |||
817 | // Do this last so that event listeners have access to all the effects of the attachment | ||
818 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); | ||
819 | |||
820 | return objatt; | ||
821 | } | ||
822 | else | ||
823 | { | ||
824 | m_log.WarnFormat( | ||
825 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | ||
826 | itemID, sp.Name, attachmentPt); | ||
833 | } | 827 | } |
834 | } | 828 | } |
835 | 829 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 42d07fd..5e89eec 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -99,12 +99,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
99 | public void TestAddAttachmentFromGround() | 99 | public void TestAddAttachmentFromGround() |
100 | { | 100 | { |
101 | TestHelpers.InMethod(); | 101 | TestHelpers.InMethod(); |
102 | // log4net.Config.XmlConfigurator.Configure(); | 102 | // TestHelpers.EnableLogging(); |
103 | 103 | ||
104 | AddPresence(); | 104 | AddPresence(); |
105 | string attName = "att"; | 105 | string attName = "att"; |
106 | 106 | ||
107 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName).ParentGroup; | 107 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup; |
108 | 108 | ||
109 | m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); | 109 | m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false); |
110 | 110 | ||
@@ -123,6 +123,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
123 | Assert.That( | 123 | Assert.That( |
124 | m_presence.Appearance.GetAttachpoint(attSo.FromItemID), | 124 | m_presence.Appearance.GetAttachpoint(attSo.FromItemID), |
125 | Is.EqualTo((int)AttachmentPoint.Chest)); | 125 | Is.EqualTo((int)AttachmentPoint.Chest)); |
126 | |||
127 | InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); | ||
128 | Assert.That(attachmentItem, Is.Not.Null); | ||
129 | Assert.That(attachmentItem.Name, Is.EqualTo(attName)); | ||
130 | |||
131 | InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(m_presence.UUID, AssetType.Object); | ||
132 | Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); | ||
133 | |||
134 | // TestHelpers.DisableLogging(); | ||
126 | } | 135 | } |
127 | 136 | ||
128 | [Test] | 137 | [Test] |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 3728b85..06f27e2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -415,12 +415,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
415 | 415 | ||
416 | protected override void StoreBackwards(UUID friendID, UUID agentID) | 416 | protected override void StoreBackwards(UUID friendID, UUID agentID) |
417 | { | 417 | { |
418 | Boolean agentIsLocal = true; | 418 | bool agentIsLocal = true; |
419 | Boolean friendIsLocal = true; | 419 | // bool friendIsLocal = true; |
420 | |||
420 | if (UserManagementModule != null) | 421 | if (UserManagementModule != null) |
421 | { | 422 | { |
422 | agentIsLocal = UserManagementModule.IsLocalGridUser(agentID); | 423 | agentIsLocal = UserManagementModule.IsLocalGridUser(agentID); |
423 | friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); | 424 | // friendIsLocal = UserManagementModule.IsLocalGridUser(friendID); |
424 | } | 425 | } |
425 | 426 | ||
426 | // Is the requester a local user? | 427 | // Is the requester a local user? |
@@ -507,7 +508,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
507 | { | 508 | { |
508 | friendUUI = finfo.Friend; | 509 | friendUUI = finfo.Friend; |
509 | theFriendUUID = friendUUI; | 510 | theFriendUUID = friendUUI; |
510 | UUID utmp = UUID.Zero; String url = String.Empty; String first = String.Empty, last = String.Empty, tmp = String.Empty; | 511 | UUID utmp = UUID.Zero; |
512 | string url = String.Empty; | ||
513 | string first = String.Empty; | ||
514 | string last = String.Empty; | ||
515 | |||
511 | // If it's confirming the friendship, we already have the full UUI with the secret | 516 | // If it's confirming the friendship, we already have the full UUI with the secret |
512 | if (Util.ParseUniversalUserIdentifier(theFriendUUID, out utmp, out url, out first, out last, out secret)) | 517 | if (Util.ParseUniversalUserIdentifier(theFriendUUID, out utmp, out url, out first, out last, out secret)) |
513 | { | 518 | { |