diff options
Updates all IRegionModules to the new style region modules.
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | 100 |
1 files changed, 62 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 10a3232..8bb0fa9 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | |||
@@ -35,6 +35,7 @@ using System.Security.Cryptography.X509Certificates; | |||
35 | using System.Threading; | 35 | using System.Threading; |
36 | using System.Web; | 36 | using System.Web; |
37 | using log4net; | 37 | using log4net; |
38 | using Mono.Addins; | ||
38 | using Nini.Config; | 39 | using Nini.Config; |
39 | using OpenMetaverse; | 40 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | 41 | using OpenMetaverse.StructuredData; |
@@ -75,8 +76,9 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
75 | public bool visible_to_parent; | 76 | public bool visible_to_parent; |
76 | public string teleported_into_region; | 77 | public string teleported_into_region; |
77 | } | 78 | } |
78 | 79 | ||
79 | public class OpenGridProtocolModule : IRegionModule | 80 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
81 | public class OpenGridProtocolModule : ISharedRegionModule | ||
80 | { | 82 | { |
81 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 83 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
82 | private List<Scene> m_scene = new List<Scene>(); | 84 | private List<Scene> m_scene = new List<Scene>(); |
@@ -92,21 +94,22 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
92 | private bool httpSSL = false; | 94 | private bool httpSSL = false; |
93 | private uint httpsslport = 0; | 95 | private uint httpsslport = 0; |
94 | private bool GridMode = false; | 96 | private bool GridMode = false; |
97 | private bool m_enabled = false; | ||
98 | private IConfig cfg = null; | ||
99 | private IConfig httpcfg = null; | ||
100 | private IConfig startupcfg = null; | ||
101 | |||
102 | #region ISharedRegionModule Members | ||
95 | 103 | ||
96 | #region IRegionModule Members | 104 | public void Initialise(IConfigSource config) |
97 | |||
98 | public void Initialise(Scene scene, IConfigSource config) | ||
99 | { | 105 | { |
100 | bool enabled = false; | ||
101 | IConfig cfg = null; | ||
102 | IConfig httpcfg = null; | ||
103 | IConfig startupcfg = null; | ||
104 | try | 106 | try |
105 | { | 107 | { |
106 | cfg = config.Configs["OpenGridProtocol"]; | 108 | cfg = config.Configs["OpenGridProtocol"]; |
107 | } catch (NullReferenceException) | 109 | } |
110 | catch (NullReferenceException) | ||
108 | { | 111 | { |
109 | enabled = false; | 112 | m_enabled = false; |
110 | } | 113 | } |
111 | 114 | ||
112 | try | 115 | try |
@@ -128,15 +131,15 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
128 | 131 | ||
129 | if (startupcfg != null) | 132 | if (startupcfg != null) |
130 | { | 133 | { |
131 | GridMode = enabled = startupcfg.GetBoolean("gridmode", false); | 134 | GridMode = m_enabled = startupcfg.GetBoolean("gridmode", false); |
132 | } | 135 | } |
133 | 136 | ||
134 | if (cfg != null) | 137 | if (cfg != null) |
135 | { | 138 | { |
136 | enabled = cfg.GetBoolean("ogp_enabled", false); | 139 | m_enabled = cfg.GetBoolean("ogp_enabled", false); |
137 | LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); | 140 | LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); |
138 | FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); | 141 | FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); |
139 | if (enabled) | 142 | if (m_enabled) |
140 | { | 143 | { |
141 | m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); | 144 | m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); |
142 | lock (m_scene) | 145 | lock (m_scene) |
@@ -165,35 +168,61 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
165 | } | 168 | } |
166 | 169 | ||
167 | } | 170 | } |
168 | // can't pick the region 'agent' because it would conflict with our agent domain handler | ||
169 | // a zero length region name would conflict with are base region seed cap | ||
170 | if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) | ||
171 | { | ||
172 | MainServer.Instance.AddLLSDHandler( | ||
173 | "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), | ||
174 | ProcessRegionDomainSeed); | ||
175 | } | ||
176 | |||
177 | if (!m_scene.Contains(scene)) | ||
178 | m_scene.Add(scene); | ||
179 | } | 171 | } |
180 | } | 172 | } |
181 | } | 173 | } |
182 | lock (m_scene) | 174 | } |
175 | |||
176 | public Type ReplaceableInterface | ||
177 | { | ||
178 | get { return null; } | ||
179 | } | ||
180 | |||
181 | public void AddRegion(Scene scene) | ||
182 | { | ||
183 | if (m_enabled) | ||
183 | { | 184 | { |
184 | if (m_scene.Count == 1) | 185 | lock (m_scene) |
185 | { | 186 | { |
186 | if (httpcfg != null) | 187 | if (m_scene.Count == 1) |
187 | { | 188 | { |
188 | httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); | 189 | if (httpcfg != null) |
189 | httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); | 190 | { |
190 | if (httpsCN.Length == 0) | 191 | httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); |
191 | httpsCN = scene.RegionInfo.ExternalHostName; | 192 | httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); |
192 | httpsslport = (uint)httpcfg.GetInt("http_listener_sslport",((int)scene.RegionInfo.HttpPort + 1)); | 193 | if (httpsCN.Length == 0) |
194 | httpsCN = scene.RegionInfo.ExternalHostName; | ||
195 | httpsslport = (uint)httpcfg.GetInt("http_listener_sslport", ((int)scene.RegionInfo.HttpPort + 1)); | ||
196 | } | ||
193 | } | 197 | } |
194 | } | 198 | } |
199 | // can't pick the region 'agent' because it would conflict with our agent domain handler | ||
200 | // a zero length region name would conflict with are base region seed cap | ||
201 | if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) | ||
202 | { | ||
203 | MainServer.Instance.AddLLSDHandler( | ||
204 | "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), | ||
205 | ProcessRegionDomainSeed); | ||
206 | } | ||
207 | |||
208 | if (!m_scene.Contains(scene)) | ||
209 | m_scene.Add(scene); | ||
195 | } | 210 | } |
196 | } | 211 | } |
212 | |||
213 | public void RegionLoaded(Scene scene) | ||
214 | { | ||
215 | } | ||
216 | |||
217 | public void RemoveRegion(Scene scene) | ||
218 | { | ||
219 | MainServer.Instance.RemoveLLSDHandler( | ||
220 | "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), | ||
221 | ProcessRegionDomainSeed); | ||
222 | |||
223 | if (m_scene.Contains(scene)) | ||
224 | m_scene.Remove(scene); | ||
225 | } | ||
197 | 226 | ||
198 | public void PostInitialise() | 227 | public void PostInitialise() |
199 | { | 228 | { |
@@ -209,11 +238,6 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
209 | get { return "OpenGridProtocolModule"; } | 238 | get { return "OpenGridProtocolModule"; } |
210 | } | 239 | } |
211 | 240 | ||
212 | public bool IsSharedModule | ||
213 | { | ||
214 | get { return true; } | ||
215 | } | ||
216 | |||
217 | #endregion | 241 | #endregion |
218 | 242 | ||
219 | public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) | 243 | public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) |