diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 4bd17b1b8c..e4d8a20fb6 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -68,7 +68,6 @@ namespace OpenSim.Region.ClientStack.Linden /// private OSDMap m_features = new OSDMap(); - private string m_MapImageServerURL = string.Empty; private string m_SearchURL = string.Empty; private bool m_ExportSupported = false; @@ -78,15 +77,7 @@ namespace OpenSim.Region.ClientStack.Linden { IConfig config = source.Configs["SimulatorFeatures"]; if (config != null) - { - m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty); - if (m_MapImageServerURL != string.Empty) - { - m_MapImageServerURL = m_MapImageServerURL.Trim(); - if (!m_MapImageServerURL.EndsWith("/")) - m_MapImageServerURL = m_MapImageServerURL + "/"; - } - + { m_SearchURL = config.GetString("SearchServerURI", string.Empty); m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); @@ -149,13 +140,13 @@ namespace OpenSim.Region.ClientStack.Linden m_features["PhysicsShapeTypes"] = typesMap; // Extra information for viewers that want to use it + // TODO: Take these out of here into their respective modules, like map-server-url OSDMap extrasMap = new OSDMap(); - if (m_MapImageServerURL != string.Empty) - extrasMap["map-server-url"] = m_MapImageServerURL; if (m_SearchURL != string.Empty) extrasMap["search-server-url"] = m_SearchURL; if (m_ExportSupported) extrasMap["ExportSupported"] = true; + if (extrasMap.Count > 0) m_features["OpenSimExtras"] = extrasMap; diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index c4255b951d..4a5a35250b 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs @@ -31,6 +31,7 @@ using System.Reflection; using log4net; using Nini.Config; using OpenMetaverse; +using OpenMetaverse.StructuredData; using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.CoreModules.World.WorldMap; @@ -48,13 +49,30 @@ namespace OpenSim.Region.CoreModules.Hypergrid // Remember the map area that each client has been exposed to in this region private Dictionary> m_SeenMapBlocks = new Dictionary>(); + private string m_MapImageServerURL = string.Empty; + + private IUserManagement m_UserManagement; + #region INonSharedRegionModule Members - public override void Initialise(IConfigSource config) + public override void Initialise(IConfigSource source) { if (Util.GetConfigVarFromSections( - config, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap") + source, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap") + { m_Enabled = true; + + m_MapImageServerURL = Util.GetConfigVarFromSections(source, "MapTileURL", new string[] {"LoginService", "HGWorldMap", "SimulatorFeatures"}); + + if (m_MapImageServerURL != string.Empty) + { + m_MapImageServerURL = m_MapImageServerURL.Trim(); + if (!m_MapImageServerURL.EndsWith("/")) + m_MapImageServerURL = m_MapImageServerURL + "/"; + } + + + } } public override void AddRegion(Scene scene) @@ -64,6 +82,17 @@ namespace OpenSim.Region.CoreModules.Hypergrid scene.EventManager.OnClientClosed += new EventManager.ClientClosed(EventManager_OnClientClosed); } + public override void RegionLoaded(Scene scene) + { + base.RegionLoaded(scene); + ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface(); + + if (featuresModule != null) + featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest; + + m_UserManagement = m_scene.RequestModuleInterface(); + + } public override string Name { get { return "HGWorldMap"; } @@ -115,6 +144,20 @@ namespace OpenSim.Region.CoreModules.Hypergrid return mapBlocks; } + private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) + { + if (m_UserManagement != null && !m_UserManagement.IsLocalGridUser(agentID) && m_MapImageServerURL != string.Empty) + { + OSD extras = new OSDMap(); + if (features.ContainsKey("OpenSimExtras")) + extras = features["OpenSimExtras"]; + else + features["OpenSimExtras"] = extras; + + ((OSDMap)extras)["map-server-url"] = m_MapImageServerURL; + + } + } } class MapArea