diff options
Diffstat (limited to 'OpenSim')
4 files changed, 121 insertions, 79 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ba88089..09e8204 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -2700,5 +2700,69 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
2700 | } | 2700 | } |
2701 | #endregion | 2701 | #endregion |
2702 | 2702 | ||
2703 | public virtual bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition) | ||
2704 | { | ||
2705 | // If the user is banned, we won't let any of their objects | ||
2706 | // enter. Period. | ||
2707 | // | ||
2708 | if (Scene.RegionInfo.EstateSettings.IsBanned(so.OwnerID)) | ||
2709 | { | ||
2710 | m_log.DebugFormat( | ||
2711 | "[ENTITY TRANSFER MODULE]: Denied prim crossing of {0} {1} into {2} for banned avatar {3}", | ||
2712 | so.Name, so.UUID, Scene.Name, so.OwnerID); | ||
2713 | |||
2714 | return false; | ||
2715 | } | ||
2716 | |||
2717 | if (newPosition != Vector3.Zero) | ||
2718 | so.RootPart.GroupPosition = newPosition; | ||
2719 | |||
2720 | if (!Scene.AddSceneObject(so)) | ||
2721 | { | ||
2722 | m_log.DebugFormat( | ||
2723 | "[ENTITY TRANSFER MODULE]: Problem adding scene object {0} {1} into {2} ", | ||
2724 | so.Name, so.UUID, Scene.Name); | ||
2725 | |||
2726 | return false; | ||
2727 | } | ||
2728 | |||
2729 | if (!so.IsAttachment) | ||
2730 | { | ||
2731 | // FIXME: It would be better to never add the scene object at all rather than add it and then delete | ||
2732 | // it | ||
2733 | if (!Scene.Permissions.CanObjectEntry(so.UUID, true, so.AbsolutePosition)) | ||
2734 | { | ||
2735 | // Deny non attachments based on parcel settings | ||
2736 | // | ||
2737 | m_log.Info("[ENTITY TRANSFER MODULE]: Denied prim crossing because of parcel settings"); | ||
2738 | |||
2739 | Scene.DeleteSceneObject(so, false); | ||
2740 | |||
2741 | return false; | ||
2742 | } | ||
2743 | |||
2744 | // For attachments, we need to wait until the agent is root | ||
2745 | // before we restart the scripts, or else some functions won't work. | ||
2746 | so.RootPart.ParentGroup.CreateScriptInstances( | ||
2747 | 0, false, Scene.DefaultScriptEngine, GetStateSource(so)); | ||
2748 | |||
2749 | so.ResumeScripts(); | ||
2750 | |||
2751 | if (so.RootPart.KeyframeMotion != null) | ||
2752 | so.RootPart.KeyframeMotion.UpdateSceneObject(so); | ||
2753 | } | ||
2754 | |||
2755 | return true; | ||
2756 | } | ||
2757 | |||
2758 | private int GetStateSource(SceneObjectGroup sog) | ||
2759 | { | ||
2760 | ScenePresence sp = Scene.GetScenePresence(sog.OwnerID); | ||
2761 | |||
2762 | if (sp != null) | ||
2763 | return sp.GetStateSource(); | ||
2764 | |||
2765 | return 2; // StateSource.PrimCrossing | ||
2766 | } | ||
2703 | } | 2767 | } |
2704 | } | 2768 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 72d6bac..519c18b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -153,33 +153,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
153 | if (m_Enabled) | 153 | if (m_Enabled) |
154 | { | 154 | { |
155 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); | 155 | scene.RegisterModuleInterface<IUserAgentVerificationModule>(this); |
156 | scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject; | 156 | //scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject; |
157 | } | ||
158 | } | ||
159 | |||
160 | void OnIncomingSceneObject(SceneObjectGroup so) | ||
161 | { | ||
162 | if (!so.IsAttachment) | ||
163 | return; | ||
164 | 157 | ||
165 | if (so.AttachedAvatar == UUID.Zero || Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar)) | 158 | m_incomingSceneObjectEngine.Start(); |
166 | return; | ||
167 | |||
168 | // foreign user | ||
169 | AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar); | ||
170 | if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | ||
171 | { | ||
172 | if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServRezerURI")) | ||
173 | { | ||
174 | string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | ||
175 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url); | ||
176 | Dictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>(); | ||
177 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(Scene.AssetService, url); | ||
178 | uuidGatherer.GatherAssetUuids(so, ids); | ||
179 | |||
180 | foreach (KeyValuePair<UUID, sbyte> kvp in ids) | ||
181 | uuidGatherer.FetchAsset(kvp.Key); | ||
182 | } | ||
183 | } | 159 | } |
184 | } | 160 | } |
185 | 161 | ||
@@ -209,12 +185,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
209 | base.RemoveRegion(scene); | 185 | base.RemoveRegion(scene); |
210 | 186 | ||
211 | if (m_Enabled) | 187 | if (m_Enabled) |
188 | { | ||
212 | scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); | 189 | scene.UnregisterModuleInterface<IUserAgentVerificationModule>(this); |
190 | m_incomingSceneObjectEngine.Stop(); | ||
191 | } | ||
213 | } | 192 | } |
214 | 193 | ||
215 | #endregion | 194 | #endregion |
216 | 195 | ||
217 | #region HG overrides of IEntiryTransferModule | 196 | #region HG overrides of IEntityTransferModule |
218 | 197 | ||
219 | protected override GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message) | 198 | protected override GridRegion GetFinalDestination(GridRegion region, UUID agentID, string agentHomeURI, out string message) |
220 | { | 199 | { |
@@ -561,6 +540,53 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
561 | } | 540 | } |
562 | } | 541 | } |
563 | 542 | ||
543 | private HGIncomingSceneObjectEngine m_incomingSceneObjectEngine = new HGIncomingSceneObjectEngine(); | ||
544 | |||
545 | public override bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition) | ||
546 | { | ||
547 | // FIXME: We must make it so that we can use SOG.IsAttachment here. At the moment it is always null! | ||
548 | if (!so.IsAttachmentCheckFull()) | ||
549 | return base.HandleIncomingSceneObject(so, newPosition); | ||
550 | |||
551 | // Equally, we can't use so.AttachedAvatar here. | ||
552 | if (so.OwnerID == UUID.Zero || Scene.UserManagementModule.IsLocalGridUser(so.OwnerID)) | ||
553 | return base.HandleIncomingSceneObject(so, newPosition); | ||
554 | |||
555 | // foreign user | ||
556 | AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(so.OwnerID); | ||
557 | if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) | ||
558 | { | ||
559 | if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | ||
560 | { | ||
561 | m_incomingSceneObjectEngine.QueueRequest( | ||
562 | string.Format("HG UUID Gather for attachment {0} for {1}", so.Name, aCircuit.Name), | ||
563 | o => | ||
564 | { | ||
565 | string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | ||
566 | m_log.DebugFormat( | ||
567 | "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset server {2}", | ||
568 | so.Name, so.AttachedAvatar, url); | ||
569 | |||
570 | Dictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>(); | ||
571 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(Scene.AssetService, url); | ||
572 | uuidGatherer.GatherAssetUuids(so, ids); | ||
573 | |||
574 | foreach (KeyValuePair<UUID, sbyte> kvp in ids) | ||
575 | uuidGatherer.FetchAsset(kvp.Key); | ||
576 | |||
577 | base.HandleIncomingSceneObject(so, newPosition); | ||
578 | |||
579 | m_log.DebugFormat( | ||
580 | "[HG ENTITY TRANSFER MODULE]: Completed incoming attachment {0} for HG user {1} with asset server {2}", | ||
581 | so.Name, so.OwnerID, url); | ||
582 | }, | ||
583 | null); | ||
584 | } | ||
585 | } | ||
586 | |||
587 | return true; | ||
588 | } | ||
589 | |||
564 | #endregion | 590 | #endregion |
565 | 591 | ||
566 | #region IUserAgentVerificationModule | 592 | #region IUserAgentVerificationModule |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs index 5d07a5f..1ebef90 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityTransferModule.cs | |||
@@ -98,6 +98,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
98 | void Cross(SceneObjectGroup sog, Vector3 position, bool silent); | 98 | void Cross(SceneObjectGroup sog, Vector3 position, bool silent); |
99 | 99 | ||
100 | ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); | 100 | ScenePresence CrossAgentToNewRegionAsync(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion, bool isFlying, string version); |
101 | |||
102 | bool HandleIncomingSceneObject(SceneObjectGroup so, Vector3 newPosition); | ||
101 | } | 103 | } |
102 | 104 | ||
103 | public interface IUserAgentVerificationModule | 105 | public interface IUserAgentVerificationModule |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7e6f942..171f066 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2623,48 +2623,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2623 | return false; | 2623 | return false; |
2624 | } | 2624 | } |
2625 | 2625 | ||
2626 | // If the user is banned, we won't let any of their objects | 2626 | if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition)) |
2627 | // enter. Period. | 2627 | return false; |
2628 | // | ||
2629 | if (RegionInfo.EstateSettings.IsBanned(newObject.OwnerID)) | ||
2630 | { | ||
2631 | m_log.InfoFormat("[INTERREGION]: Denied prim crossing for banned avatar {0}", newObject.OwnerID); | ||
2632 | return false; | ||
2633 | } | ||
2634 | |||
2635 | if (newPosition != Vector3.Zero) | ||
2636 | newObject.RootPart.GroupPosition = newPosition; | ||
2637 | |||
2638 | if (!AddSceneObject(newObject)) | ||
2639 | { | ||
2640 | m_log.DebugFormat( | ||
2641 | "[INTERREGION]: Problem adding scene object {0} in {1} ", newObject.UUID, RegionInfo.RegionName); | ||
2642 | return false; | ||
2643 | } | ||
2644 | |||
2645 | if (!newObject.IsAttachment) | ||
2646 | { | ||
2647 | // FIXME: It would be better to never add the scene object at all rather than add it and then delete | ||
2648 | // it | ||
2649 | if (!Permissions.CanObjectEntry(newObject.UUID, true, newObject.AbsolutePosition)) | ||
2650 | { | ||
2651 | // Deny non attachments based on parcel settings | ||
2652 | // | ||
2653 | m_log.Info("[INTERREGION]: Denied prim crossing because of parcel settings"); | ||
2654 | |||
2655 | DeleteSceneObject(newObject, false); | ||
2656 | |||
2657 | return false; | ||
2658 | } | ||
2659 | |||
2660 | // For attachments, we need to wait until the agent is root | ||
2661 | // before we restart the scripts, or else some functions won't work. | ||
2662 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); | ||
2663 | newObject.ResumeScripts(); | ||
2664 | |||
2665 | if (newObject.RootPart.KeyframeMotion != null) | ||
2666 | newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); | ||
2667 | } | ||
2668 | 2628 | ||
2669 | // Do this as late as possible so that listeners have full access to the incoming object | 2629 | // Do this as late as possible so that listeners have full access to the incoming object |
2670 | EventManager.TriggerOnIncomingSceneObject(newObject); | 2630 | EventManager.TriggerOnIncomingSceneObject(newObject); |
@@ -2733,16 +2693,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2733 | return true; | 2693 | return true; |
2734 | } | 2694 | } |
2735 | 2695 | ||
2736 | private int GetStateSource(SceneObjectGroup sog) | ||
2737 | { | ||
2738 | ScenePresence sp = GetScenePresence(sog.OwnerID); | ||
2739 | |||
2740 | if (sp != null) | ||
2741 | return sp.GetStateSource(); | ||
2742 | |||
2743 | return 2; // StateSource.PrimCrossing | ||
2744 | } | ||
2745 | |||
2746 | #endregion | 2696 | #endregion |
2747 | 2697 | ||
2748 | #region Add/Remove Avatar Methods | 2698 | #region Add/Remove Avatar Methods |