From 21a6ef5bb63e56612b8e03002dbee9ff1fcdc4c0 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 21 Sep 2012 17:58:44 -0700 Subject: This fixes HG attachments' missing assets (textures, etc). Also, further improvements on HGUuidGatherer: if the assets are already in this grid don't fetch them again. --- .../EntityTransfer/HGEntityTransferModule.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 0b386d3..a6698e6 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -150,6 +150,34 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_Enabled) scene.RegisterModuleInterface(this); + + scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject; + } + + void OnIncomingSceneObject(SceneObjectGroup so) + { + if (!so.IsAttachment) + return; + + if (so.Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar)) + return; + + // foreign user + AgentCircuitData aCircuit = so.Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar); + if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0) + { + if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) + { + string url = aCircuit.ServiceURLs["AssetServerURI"].ToString(); + m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachement {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url); + Dictionary ids = new Dictionary(); + HGUuidGatherer uuidGatherer = new HGUuidGatherer(so.Scene.AssetService, url); + uuidGatherer.GatherAssetUuids(so, ids); + + foreach (KeyValuePair kvp in ids) + uuidGatherer.FetchAsset(kvp.Key); + } + } } protected override void OnNewClient(IClientAPI client) -- cgit v1.1