diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 64 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 80 |
2 files changed, 117 insertions, 27 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 |