aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2013-07-30 21:10:00 -0700
committerDiva Canto2013-07-30 21:10:00 -0700
commitfd050fca7caef83d72d00241d0c0db5c1ec5d1ff (patch)
tree7f6c05282088c75b51aa900e1c7f85f0e0735f6f
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-fd050fca7caef83d72d00241d0c0db5c1ec5d1ff.zip
opensim-SC_OLD-fd050fca7caef83d72d00241d0c0db5c1ec5d1ff.tar.gz
opensim-SC_OLD-fd050fca7caef83d72d00241d0c0db5c1ec5d1ff.tar.bz2
opensim-SC_OLD-fd050fca7caef83d72d00241d0c0db5c1ec5d1ff.tar.xz
Doing the HG Map / SimulatorFeatures "the right way": moved it to HGMapModule, hooking on to SimulatorFeatures.OnSimulatorFeaturesRequest event (similar to what the DynamicMenuModule does).
Only HG Visitors get this var, to avoid spamming local users. The config var is now called MapTileURL, to be consistent with the login one, and its being picked up from either [LoginService], [HGWorldMap] or [SimulatorFeatures], just because I have a bad memory.
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs47
2 files changed, 48 insertions, 14 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs
index 4bd17b1..e4d8a20 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
68 /// </summary> 68 /// </summary>
69 private OSDMap m_features = new OSDMap(); 69 private OSDMap m_features = new OSDMap();
70 70
71 private string m_MapImageServerURL = string.Empty;
72 private string m_SearchURL = string.Empty; 71 private string m_SearchURL = string.Empty;
73 private bool m_ExportSupported = false; 72 private bool m_ExportSupported = false;
74 73
@@ -78,15 +77,7 @@ namespace OpenSim.Region.ClientStack.Linden
78 { 77 {
79 IConfig config = source.Configs["SimulatorFeatures"]; 78 IConfig config = source.Configs["SimulatorFeatures"];
80 if (config != null) 79 if (config != null)
81 { 80 {
82 m_MapImageServerURL = config.GetString("MapImageServerURI", string.Empty);
83 if (m_MapImageServerURL != string.Empty)
84 {
85 m_MapImageServerURL = m_MapImageServerURL.Trim();
86 if (!m_MapImageServerURL.EndsWith("/"))
87 m_MapImageServerURL = m_MapImageServerURL + "/";
88 }
89
90 m_SearchURL = config.GetString("SearchServerURI", string.Empty); 81 m_SearchURL = config.GetString("SearchServerURI", string.Empty);
91 82
92 m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); 83 m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported);
@@ -149,13 +140,13 @@ namespace OpenSim.Region.ClientStack.Linden
149 m_features["PhysicsShapeTypes"] = typesMap; 140 m_features["PhysicsShapeTypes"] = typesMap;
150 141
151 // Extra information for viewers that want to use it 142 // Extra information for viewers that want to use it
143 // TODO: Take these out of here into their respective modules, like map-server-url
152 OSDMap extrasMap = new OSDMap(); 144 OSDMap extrasMap = new OSDMap();
153 if (m_MapImageServerURL != string.Empty)
154 extrasMap["map-server-url"] = m_MapImageServerURL;
155 if (m_SearchURL != string.Empty) 145 if (m_SearchURL != string.Empty)
156 extrasMap["search-server-url"] = m_SearchURL; 146 extrasMap["search-server-url"] = m_SearchURL;
157 if (m_ExportSupported) 147 if (m_ExportSupported)
158 extrasMap["ExportSupported"] = true; 148 extrasMap["ExportSupported"] = true;
149
159 if (extrasMap.Count > 0) 150 if (extrasMap.Count > 0)
160 m_features["OpenSimExtras"] = extrasMap; 151 m_features["OpenSimExtras"] = extrasMap;
161 152
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
index c4255b9..4a5a352 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenMetaverse.StructuredData;
34using Mono.Addins; 35using Mono.Addins;
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Region.CoreModules.World.WorldMap; 37using OpenSim.Region.CoreModules.World.WorldMap;
@@ -48,13 +49,30 @@ namespace OpenSim.Region.CoreModules.Hypergrid
48 // Remember the map area that each client has been exposed to in this region 49 // Remember the map area that each client has been exposed to in this region
49 private Dictionary<UUID, List<MapBlockData>> m_SeenMapBlocks = new Dictionary<UUID, List<MapBlockData>>(); 50 private Dictionary<UUID, List<MapBlockData>> m_SeenMapBlocks = new Dictionary<UUID, List<MapBlockData>>();
50 51
52 private string m_MapImageServerURL = string.Empty;
53
54 private IUserManagement m_UserManagement;
55
51 #region INonSharedRegionModule Members 56 #region INonSharedRegionModule Members
52 57
53 public override void Initialise(IConfigSource config) 58 public override void Initialise(IConfigSource source)
54 { 59 {
55 if (Util.GetConfigVarFromSections<string>( 60 if (Util.GetConfigVarFromSections<string>(
56 config, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap") 61 source, "WorldMapModule", new string[] { "Map", "Startup" }, "WorldMap") == "HGWorldMap")
62 {
57 m_Enabled = true; 63 m_Enabled = true;
64
65 m_MapImageServerURL = Util.GetConfigVarFromSections<string>(source, "MapTileURL", new string[] {"LoginService", "HGWorldMap", "SimulatorFeatures"});
66
67 if (m_MapImageServerURL != string.Empty)
68 {
69 m_MapImageServerURL = m_MapImageServerURL.Trim();
70 if (!m_MapImageServerURL.EndsWith("/"))
71 m_MapImageServerURL = m_MapImageServerURL + "/";
72 }
73
74
75 }
58 } 76 }
59 77
60 public override void AddRegion(Scene scene) 78 public override void AddRegion(Scene scene)
@@ -64,6 +82,17 @@ namespace OpenSim.Region.CoreModules.Hypergrid
64 scene.EventManager.OnClientClosed += new EventManager.ClientClosed(EventManager_OnClientClosed); 82 scene.EventManager.OnClientClosed += new EventManager.ClientClosed(EventManager_OnClientClosed);
65 } 83 }
66 84
85 public override void RegionLoaded(Scene scene)
86 {
87 base.RegionLoaded(scene);
88 ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();
89
90 if (featuresModule != null)
91 featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;
92
93 m_UserManagement = m_scene.RequestModuleInterface<IUserManagement>();
94
95 }
67 public override string Name 96 public override string Name
68 { 97 {
69 get { return "HGWorldMap"; } 98 get { return "HGWorldMap"; }
@@ -115,6 +144,20 @@ namespace OpenSim.Region.CoreModules.Hypergrid
115 return mapBlocks; 144 return mapBlocks;
116 } 145 }
117 146
147 private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
148 {
149 if (m_UserManagement != null && !m_UserManagement.IsLocalGridUser(agentID) && m_MapImageServerURL != string.Empty)
150 {
151 OSD extras = new OSDMap();
152 if (features.ContainsKey("OpenSimExtras"))
153 extras = features["OpenSimExtras"];
154 else
155 features["OpenSimExtras"] = extras;
156
157 ((OSDMap)extras)["map-server-url"] = m_MapImageServerURL;
158
159 }
160 }
118 } 161 }
119 162
120 class MapArea 163 class MapArea