diff options
author | Melanie | 2012-11-12 15:46:45 +0000 |
---|---|---|
committer | Melanie | 2012-11-12 15:46:45 +0000 |
commit | d9b149b3756442224492ca24c2be3196a873489a (patch) | |
tree | ec1e0649b7aef62ecb9475f78b467062f353866c /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Fix mantis #6425 (diff) | |
download | opensim-SC_OLD-d9b149b3756442224492ca24c2be3196a873489a.zip opensim-SC_OLD-d9b149b3756442224492ca24c2be3196a873489a.tar.gz opensim-SC_OLD-d9b149b3756442224492ca24c2be3196a873489a.tar.bz2 opensim-SC_OLD-d9b149b3756442224492ca24c2be3196a873489a.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
Diffstat (limited to 'OpenSim/Region/CoreModules')
8 files changed, 416 insertions, 254 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 2879154..a54fec7 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -55,6 +55,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
55 | private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>(); | 55 | private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>(); |
56 | /// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary> | 56 | /// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary> |
57 | private IImprovedAssetCache m_cache; | 57 | private IImprovedAssetCache m_cache; |
58 | private IImprovedAssetCache Cache | ||
59 | { | ||
60 | get | ||
61 | { | ||
62 | if (m_cache == null) | ||
63 | m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); | ||
64 | |||
65 | return m_cache; | ||
66 | } | ||
67 | } | ||
58 | /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary> | 68 | /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary> |
59 | private UUID m_CreatorID = UUID.Zero; | 69 | private UUID m_CreatorID = UUID.Zero; |
60 | private Scene m_scene; | 70 | private Scene m_scene; |
@@ -98,7 +108,6 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
98 | 108 | ||
99 | public void PostInitialise() | 109 | public void PostInitialise() |
100 | { | 110 | { |
101 | m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); | ||
102 | } | 111 | } |
103 | 112 | ||
104 | public void Close() | 113 | public void Close() |
@@ -297,7 +306,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
297 | { | 306 | { |
298 | m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10)); | 307 | m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10)); |
299 | 308 | ||
300 | if (m_cache != null) | 309 | if (Cache != null) |
301 | { | 310 | { |
302 | string assetID = "j2kCache_" + AssetId.ToString(); | 311 | string assetID = "j2kCache_" + AssetId.ToString(); |
303 | 312 | ||
@@ -321,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
321 | 330 | ||
322 | #endregion Serialize Layer Data | 331 | #endregion Serialize Layer Data |
323 | 332 | ||
324 | m_cache.Cache(layerDecodeAsset); | 333 | Cache.Cache(layerDecodeAsset); |
325 | } | 334 | } |
326 | } | 335 | } |
327 | 336 | ||
@@ -331,10 +340,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
331 | { | 340 | { |
332 | return true; | 341 | return true; |
333 | } | 342 | } |
334 | else if (m_cache != null) | 343 | else if (Cache != null) |
335 | { | 344 | { |
336 | string assetName = "j2kCache_" + AssetId.ToString(); | 345 | string assetName = "j2kCache_" + AssetId.ToString(); |
337 | AssetBase layerDecodeAsset = m_cache.Get(assetName); | 346 | AssetBase layerDecodeAsset = Cache.Get(assetName); |
338 | 347 | ||
339 | if (layerDecodeAsset != null) | 348 | if (layerDecodeAsset != null) |
340 | { | 349 | { |
@@ -346,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
346 | if (lines.Length == 0) | 355 | if (lines.Length == 0) |
347 | { | 356 | { |
348 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName); | 357 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName); |
349 | m_cache.Expire(assetName); | 358 | Cache.Expire(assetName); |
350 | return false; | 359 | return false; |
351 | } | 360 | } |
352 | 361 | ||
@@ -367,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
367 | catch (FormatException) | 376 | catch (FormatException) |
368 | { | 377 | { |
369 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName); | 378 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName); |
370 | m_cache.Expire(assetName); | 379 | Cache.Expire(assetName); |
371 | return false; | 380 | return false; |
372 | } | 381 | } |
373 | 382 | ||
@@ -378,7 +387,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
378 | else | 387 | else |
379 | { | 388 | { |
380 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName); | 389 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName); |
381 | m_cache.Expire(assetName); | 390 | Cache.Expire(assetName); |
382 | return false; | 391 | return false; |
383 | } | 392 | } |
384 | } | 393 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 93a045e..9d77b19 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -37,10 +37,12 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using log4net; | 38 | using log4net; |
39 | using System.Reflection; | 39 | using System.Reflection; |
40 | using Mono.Addins; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | 42 | namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture |
42 | { | 43 | { |
43 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DynamicTextureModule")] |
45 | public class DynamicTextureModule : ISharedRegionModule, IDynamicTextureManager | ||
44 | { | 46 | { |
45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 48 | ||
@@ -81,6 +83,16 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
81 | /// </remarks> | 83 | /// </remarks> |
82 | private Cache m_reuseableDynamicTextures; | 84 | private Cache m_reuseableDynamicTextures; |
83 | 85 | ||
86 | /// <summary> | ||
87 | /// This constructor is only here because of the Unit Tests... | ||
88 | /// Don't use it. | ||
89 | /// </summary> | ||
90 | public DynamicTextureModule() | ||
91 | { | ||
92 | m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); | ||
93 | m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0); | ||
94 | } | ||
95 | |||
84 | #region IDynamicTextureManager Members | 96 | #region IDynamicTextureManager Members |
85 | 97 | ||
86 | public void RegisterRender(string handleType, IDynamicTextureRender render) | 98 | public void RegisterRender(string handleType, IDynamicTextureRender render) |
@@ -323,17 +335,30 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
323 | 335 | ||
324 | #endregion | 336 | #endregion |
325 | 337 | ||
326 | #region IRegionModule Members | 338 | #region ISharedRegionModule Members |
327 | 339 | ||
328 | public void Initialise(Scene scene, IConfigSource config) | 340 | public void Initialise(IConfigSource config) |
329 | { | 341 | { |
330 | IConfig texturesConfig = config.Configs["Textures"]; | 342 | IConfig texturesConfig = config.Configs["Textures"]; |
331 | if (texturesConfig != null) | 343 | if (texturesConfig != null) |
332 | { | 344 | { |
333 | ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false); | 345 | ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false); |
334 | ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false); | 346 | ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false); |
347 | |||
348 | if (ReuseTextures) | ||
349 | { | ||
350 | m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); | ||
351 | m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0); | ||
352 | } | ||
335 | } | 353 | } |
354 | } | ||
336 | 355 | ||
356 | public void PostInitialise() | ||
357 | { | ||
358 | } | ||
359 | |||
360 | public void AddRegion(Scene scene) | ||
361 | { | ||
337 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) | 362 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) |
338 | { | 363 | { |
339 | RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); | 364 | RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); |
@@ -341,13 +366,14 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
341 | } | 366 | } |
342 | } | 367 | } |
343 | 368 | ||
344 | public void PostInitialise() | 369 | public void RegionLoaded(Scene scene) |
345 | { | 370 | { |
346 | if (ReuseTextures) | 371 | } |
347 | { | 372 | |
348 | m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); | 373 | public void RemoveRegion(Scene scene) |
349 | m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0); | 374 | { |
350 | } | 375 | if (RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) |
376 | RegisteredScenes.Remove(scene.RegionInfo.RegionID); | ||
351 | } | 377 | } |
352 | 378 | ||
353 | public void Close() | 379 | public void Close() |
@@ -359,9 +385,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
359 | get { return "DynamicTextureModule"; } | 385 | get { return "DynamicTextureModule"; } |
360 | } | 386 | } |
361 | 387 | ||
362 | public bool IsSharedModule | 388 | public Type ReplaceableInterface |
363 | { | 389 | { |
364 | get { return true; } | 390 | get { return null; } |
365 | } | 391 | } |
366 | 392 | ||
367 | #endregion | 393 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs index e91e8b9..d943b20 100644 --- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs | |||
@@ -37,10 +37,12 @@ using OpenMetaverse; | |||
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using Mono.Addins; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Scripting.EmailModules | 42 | namespace OpenSim.Region.CoreModules.Scripting.EmailModules |
42 | { | 43 | { |
43 | public class EmailModule : IRegionModule, IEmailModule | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EmailModule")] |
45 | public class EmailModule : ISharedRegionModule, IEmailModule | ||
44 | { | 46 | { |
45 | // | 47 | // |
46 | // Log | 48 | // Log |
@@ -72,31 +74,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
72 | 74 | ||
73 | private bool m_Enabled = false; | 75 | private bool m_Enabled = false; |
74 | 76 | ||
75 | public void InsertEmail(UUID to, Email email) | 77 | #region ISharedRegionModule |
76 | { | ||
77 | // It's tempting to create the queue here. Don't; objects which have | ||
78 | // not yet called GetNextEmail should have no queue, and emails to them | ||
79 | // should be silently dropped. | ||
80 | |||
81 | lock (m_MailQueues) | ||
82 | { | ||
83 | if (m_MailQueues.ContainsKey(to)) | ||
84 | { | ||
85 | if (m_MailQueues[to].Count >= m_MaxQueueSize) | ||
86 | { | ||
87 | // fail silently | ||
88 | return; | ||
89 | } | ||
90 | |||
91 | lock (m_MailQueues[to]) | ||
92 | { | ||
93 | m_MailQueues[to].Add(email); | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | 78 | ||
99 | public void Initialise(Scene scene, IConfigSource config) | 79 | public void Initialise(IConfigSource config) |
100 | { | 80 | { |
101 | m_Config = config; | 81 | m_Config = config; |
102 | IConfig SMTPConfig; | 82 | IConfig SMTPConfig; |
@@ -129,36 +109,44 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
129 | SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); | 109 | SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); |
130 | SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); | 110 | SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); |
131 | SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); | 111 | SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); |
132 | m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize); | 112 | m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize); |
133 | } | 113 | } |
134 | catch (Exception e) | 114 | catch (Exception e) |
135 | { | 115 | { |
136 | m_log.Error("[EMAIL] DefaultEmailModule not configured: "+ e.Message); | 116 | m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message); |
137 | m_Enabled = false; | 117 | m_Enabled = false; |
138 | return; | 118 | return; |
139 | } | 119 | } |
140 | 120 | ||
141 | // It's a go! | 121 | } |
142 | if (m_Enabled) | 122 | |
123 | public void AddRegion(Scene scene) | ||
124 | { | ||
125 | if (!m_Enabled) | ||
126 | return; | ||
127 | |||
128 | // It's a go! | ||
129 | lock (m_Scenes) | ||
143 | { | 130 | { |
144 | lock (m_Scenes) | 131 | // Claim the interface slot |
145 | { | 132 | scene.RegisterModuleInterface<IEmailModule>(this); |
146 | // Claim the interface slot | ||
147 | scene.RegisterModuleInterface<IEmailModule>(this); | ||
148 | 133 | ||
149 | // Add to scene list | 134 | // Add to scene list |
150 | if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle)) | 135 | if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle)) |
151 | { | 136 | { |
152 | m_Scenes[scene.RegionInfo.RegionHandle] = scene; | 137 | m_Scenes[scene.RegionInfo.RegionHandle] = scene; |
153 | } | 138 | } |
154 | else | 139 | else |
155 | { | 140 | { |
156 | m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); | 141 | m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); |
157 | } | ||
158 | } | 142 | } |
159 | |||
160 | m_log.Info("[EMAIL] Activated DefaultEmailModule"); | ||
161 | } | 143 | } |
144 | |||
145 | m_log.Info("[EMAIL] Activated DefaultEmailModule"); | ||
146 | } | ||
147 | |||
148 | public void RemoveRegion(Scene scene) | ||
149 | { | ||
162 | } | 150 | } |
163 | 151 | ||
164 | public void PostInitialise() | 152 | public void PostInitialise() |
@@ -174,9 +162,39 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
174 | get { return "DefaultEmailModule"; } | 162 | get { return "DefaultEmailModule"; } |
175 | } | 163 | } |
176 | 164 | ||
177 | public bool IsSharedModule | 165 | public Type ReplaceableInterface |
166 | { | ||
167 | get { return null; } | ||
168 | } | ||
169 | |||
170 | public void RegionLoaded(Scene scene) | ||
178 | { | 171 | { |
179 | get { return true; } | 172 | } |
173 | |||
174 | #endregion | ||
175 | |||
176 | public void InsertEmail(UUID to, Email email) | ||
177 | { | ||
178 | // It's tempting to create the queue here. Don't; objects which have | ||
179 | // not yet called GetNextEmail should have no queue, and emails to them | ||
180 | // should be silently dropped. | ||
181 | |||
182 | lock (m_MailQueues) | ||
183 | { | ||
184 | if (m_MailQueues.ContainsKey(to)) | ||
185 | { | ||
186 | if (m_MailQueues[to].Count >= m_MaxQueueSize) | ||
187 | { | ||
188 | // fail silently | ||
189 | return; | ||
190 | } | ||
191 | |||
192 | lock (m_MailQueues[to]) | ||
193 | { | ||
194 | m_MailQueues[to].Add(email); | ||
195 | } | ||
196 | } | ||
197 | } | ||
180 | } | 198 | } |
181 | 199 | ||
182 | private bool IsLocal(UUID objectID) | 200 | private bool IsLocal(UUID objectID) |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 9dac6b9..a0ae203 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Framework.Servers; | |||
41 | using OpenSim.Framework.Servers.HttpServer; | 41 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
44 | using Mono.Addins; | ||
44 | 45 | ||
45 | /***************************************************** | 46 | /***************************************************** |
46 | * | 47 | * |
@@ -87,7 +88,8 @@ using OpenSim.Region.Framework.Scenes; | |||
87 | 88 | ||
88 | namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | 89 | namespace OpenSim.Region.CoreModules.Scripting.HttpRequest |
89 | { | 90 | { |
90 | public class HttpRequestModule : IRegionModule, IHttpRequestModule | 91 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HttpRequestModule")] |
92 | public class HttpRequestModule : ISharedRegionModule, IHttpRequestModule | ||
91 | { | 93 | { |
92 | private object HttpListLock = new object(); | 94 | private object HttpListLock = new object(); |
93 | private int httpTimeout = 30000; | 95 | private int httpTimeout = 30000; |
@@ -270,24 +272,38 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
270 | 272 | ||
271 | #endregion | 273 | #endregion |
272 | 274 | ||
273 | #region IRegionModule Members | 275 | #region ISharedRegionModule Members |
274 | 276 | ||
275 | public void Initialise(Scene scene, IConfigSource config) | 277 | public void Initialise(IConfigSource config) |
276 | { | 278 | { |
277 | m_scene = scene; | ||
278 | |||
279 | m_scene.RegisterModuleInterface<IHttpRequestModule>(this); | ||
280 | |||
281 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); | 279 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); |
282 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); | 280 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); |
283 | 281 | ||
284 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); | 282 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); |
285 | } | 283 | } |
286 | 284 | ||
285 | public void AddRegion(Scene scene) | ||
286 | { | ||
287 | m_scene = scene; | ||
288 | |||
289 | m_scene.RegisterModuleInterface<IHttpRequestModule>(this); | ||
290 | } | ||
291 | |||
292 | public void RemoveRegion(Scene scene) | ||
293 | { | ||
294 | scene.UnregisterModuleInterface<IHttpRequestModule>(this); | ||
295 | if (scene == m_scene) | ||
296 | m_scene = null; | ||
297 | } | ||
298 | |||
287 | public void PostInitialise() | 299 | public void PostInitialise() |
288 | { | 300 | { |
289 | } | 301 | } |
290 | 302 | ||
303 | public void RegionLoaded(Scene scene) | ||
304 | { | ||
305 | } | ||
306 | |||
291 | public void Close() | 307 | public void Close() |
292 | { | 308 | { |
293 | } | 309 | } |
@@ -297,9 +313,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
297 | get { return m_name; } | 313 | get { return m_name; } |
298 | } | 314 | } |
299 | 315 | ||
300 | public bool IsSharedModule | 316 | public Type ReplaceableInterface |
301 | { | 317 | { |
302 | get { return true; } | 318 | get { return null; } |
303 | } | 319 | } |
304 | 320 | ||
305 | #endregion | 321 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 45e6527..65737fa 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs | |||
@@ -37,10 +37,12 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using log4net; | 38 | using log4net; |
39 | using System.Reflection; | 39 | using System.Reflection; |
40 | using Mono.Addins; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | 42 | namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL |
42 | { | 43 | { |
43 | public class LoadImageURLModule : IRegionModule, IDynamicTextureRender | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LoadImageURLModule")] |
45 | public class LoadImageURLModule : ISharedRegionModule, IDynamicTextureRender | ||
44 | { | 46 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 48 | ||
@@ -104,22 +106,32 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
104 | 106 | ||
105 | #endregion | 107 | #endregion |
106 | 108 | ||
107 | #region IRegionModule Members | 109 | #region ISharedRegionModule Members |
108 | 110 | ||
109 | public void Initialise(Scene scene, IConfigSource config) | 111 | public void Initialise(IConfigSource config) |
110 | { | 112 | { |
111 | if (m_scene == null) | ||
112 | { | ||
113 | m_scene = scene; | ||
114 | } | ||
115 | |||
116 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); | 113 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); |
117 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); | 114 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); |
118 | } | 115 | } |
119 | 116 | ||
120 | public void PostInitialise() | 117 | public void PostInitialise() |
121 | { | 118 | { |
122 | if (m_scene != null) | 119 | } |
120 | |||
121 | public void AddRegion(Scene scene) | ||
122 | { | ||
123 | if (m_scene == null) | ||
124 | m_scene = scene; | ||
125 | |||
126 | } | ||
127 | |||
128 | public void RemoveRegion(Scene scene) | ||
129 | { | ||
130 | } | ||
131 | |||
132 | public void RegionLoaded(Scene scene) | ||
133 | { | ||
134 | if (m_textureManager == null && m_scene == scene) | ||
123 | { | 135 | { |
124 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | 136 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); |
125 | if (m_textureManager != null) | 137 | if (m_textureManager != null) |
@@ -138,9 +150,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
138 | get { return m_name; } | 150 | get { return m_name; } |
139 | } | 151 | } |
140 | 152 | ||
141 | public bool IsSharedModule | 153 | public Type ReplaceableInterface |
142 | { | 154 | { |
143 | get { return true; } | 155 | get { return null; } |
144 | } | 156 | } |
145 | 157 | ||
146 | #endregion | 158 | #endregion |
@@ -172,6 +184,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
172 | 184 | ||
173 | private void HttpRequestReturn(IAsyncResult result) | 185 | private void HttpRequestReturn(IAsyncResult result) |
174 | { | 186 | { |
187 | if (m_textureManager == null) | ||
188 | { | ||
189 | m_log.WarnFormat("[LOADIMAGEURLMODULE]: No texture manager. Can't function."); | ||
190 | return; | ||
191 | } | ||
192 | |||
175 | RequestState state = (RequestState) result.AsyncState; | 193 | RequestState state = (RequestState) result.AsyncState; |
176 | WebRequest request = (WebRequest) state.Request; | 194 | WebRequest request = (WebRequest) state.Request; |
177 | Stream stream = null; | 195 | Stream stream = null; |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 673c2d1..f395441 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -40,12 +40,14 @@ using OpenSim.Region.Framework.Interfaces; | |||
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using log4net; | 41 | using log4net; |
42 | using System.Reflection; | 42 | using System.Reflection; |
43 | using Mono.Addins; | ||
43 | 44 | ||
44 | //using Cairo; | 45 | //using Cairo; |
45 | 46 | ||
46 | namespace OpenSim.Region.CoreModules.Scripting.VectorRender | 47 | namespace OpenSim.Region.CoreModules.Scripting.VectorRender |
47 | { | 48 | { |
48 | public class VectorRenderModule : IRegionModule, IDynamicTextureRender | 49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VectorRenderModule")] |
50 | public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender | ||
49 | { | 51 | { |
50 | // These fields exist for testing purposes, please do not remove. | 52 | // These fields exist for testing purposes, please do not remove. |
51 | // private static bool s_flipper; | 53 | // private static bool s_flipper; |
@@ -56,6 +58,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
56 | 58 | ||
57 | private Scene m_scene; | 59 | private Scene m_scene; |
58 | private IDynamicTextureManager m_textureManager; | 60 | private IDynamicTextureManager m_textureManager; |
61 | |||
59 | private Graphics m_graph; | 62 | private Graphics m_graph; |
60 | private string m_fontName = "Arial"; | 63 | private string m_fontName = "Arial"; |
61 | 64 | ||
@@ -103,6 +106,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
103 | 106 | ||
104 | public bool AsyncConvertData(UUID id, string bodyData, string extraParams) | 107 | public bool AsyncConvertData(UUID id, string bodyData, string extraParams) |
105 | { | 108 | { |
109 | if (m_textureManager == null) | ||
110 | { | ||
111 | m_log.Warn("[VECTORRENDERMODULE]: No texture manager. Can't function"); | ||
112 | return false; | ||
113 | } | ||
106 | // XXX: This isn't actually being done asynchronously! | 114 | // XXX: This isn't actually being done asynchronously! |
107 | m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); | 115 | m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); |
108 | 116 | ||
@@ -131,45 +139,49 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
131 | 139 | ||
132 | #endregion | 140 | #endregion |
133 | 141 | ||
134 | #region IRegionModule Members | 142 | #region ISharedRegionModule Members |
135 | 143 | ||
136 | public void Initialise(Scene scene, IConfigSource config) | 144 | public void Initialise(IConfigSource config) |
137 | { | 145 | { |
138 | if (m_scene == null) | ||
139 | { | ||
140 | m_scene = scene; | ||
141 | } | ||
142 | |||
143 | if (m_graph == null) | ||
144 | { | ||
145 | // We won't dispose of these explicitly since this module is only removed when the entire simulator | ||
146 | // is shut down. | ||
147 | Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); | ||
148 | m_graph = Graphics.FromImage(bitmap); | ||
149 | } | ||
150 | |||
151 | IConfig cfg = config.Configs["VectorRender"]; | 146 | IConfig cfg = config.Configs["VectorRender"]; |
152 | if (null != cfg) | 147 | if (null != cfg) |
153 | { | 148 | { |
154 | m_fontName = cfg.GetString("font_name", m_fontName); | 149 | m_fontName = cfg.GetString("font_name", m_fontName); |
155 | } | 150 | } |
156 | m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); | 151 | m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); |
152 | |||
153 | // We won't dispose of these explicitly since this module is only removed when the entire simulator | ||
154 | // is shut down. | ||
155 | Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); | ||
156 | m_graph = Graphics.FromImage(bitmap); | ||
157 | } | 157 | } |
158 | 158 | ||
159 | public void PostInitialise() | 159 | public void PostInitialise() |
160 | { | 160 | { |
161 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | 161 | } |
162 | if (m_textureManager != null) | 162 | |
163 | public void AddRegion(Scene scene) | ||
164 | { | ||
165 | if (m_scene == null) | ||
163 | { | 166 | { |
164 | m_textureManager.RegisterRender(GetContentType(), this); | 167 | m_scene = scene; |
165 | } | 168 | } |
169 | } | ||
166 | 170 | ||
167 | // This code exists for testing purposes, please do not remove. | 171 | public void RegionLoaded(Scene scene) |
168 | // s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data; | 172 | { |
169 | // s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data; | 173 | if (m_textureManager == null && m_scene == scene) |
174 | { | ||
175 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | ||
176 | if (m_textureManager != null) | ||
177 | { | ||
178 | m_textureManager.RegisterRender(GetContentType(), this); | ||
179 | } | ||
180 | } | ||
181 | } | ||
170 | 182 | ||
171 | // Terrain dirt - smallest bin/assets file (6004 bytes) | 183 | public void RemoveRegion(Scene scene) |
172 | // s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data; | 184 | { |
173 | } | 185 | } |
174 | 186 | ||
175 | public void Close() | 187 | public void Close() |
@@ -181,9 +193,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
181 | get { return "VectorRenderModule"; } | 193 | get { return "VectorRenderModule"; } |
182 | } | 194 | } |
183 | 195 | ||
184 | public bool IsSharedModule | 196 | public Type ReplaceableInterface |
185 | { | 197 | { |
186 | get { return true; } | 198 | get { return null; } |
187 | } | 199 | } |
188 | 200 | ||
189 | #endregion | 201 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index 0003af2..385f5ad 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Framework.Servers; | |||
40 | using OpenSim.Framework.Servers.HttpServer; | 40 | using OpenSim.Framework.Servers.HttpServer; |
41 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using Mono.Addins; | ||
43 | 44 | ||
44 | /***************************************************** | 45 | /***************************************************** |
45 | * | 46 | * |
@@ -76,7 +77,8 @@ using OpenSim.Region.Framework.Scenes; | |||
76 | 77 | ||
77 | namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | 78 | namespace OpenSim.Region.CoreModules.Scripting.XMLRPC |
78 | { | 79 | { |
79 | public class XMLRPCModule : IRegionModule, IXMLRPC | 80 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XMLRPCModule")] |
81 | public class XMLRPCModule : ISharedRegionModule, IXMLRPC | ||
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 | 84 | ||
@@ -86,6 +88,10 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | |||
86 | private Dictionary<UUID, RPCChannelInfo> m_openChannels; | 88 | private Dictionary<UUID, RPCChannelInfo> m_openChannels; |
87 | private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses; | 89 | private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses; |
88 | private int m_remoteDataPort = 0; | 90 | private int m_remoteDataPort = 0; |
91 | public int Port | ||
92 | { | ||
93 | get { return m_remoteDataPort; } | ||
94 | } | ||
89 | 95 | ||
90 | private Dictionary<UUID, RPCRequestInfo> m_rpcPending; | 96 | private Dictionary<UUID, RPCRequestInfo> m_rpcPending; |
91 | private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses; | 97 | private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses; |
@@ -94,34 +100,24 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | |||
94 | private int RemoteReplyScriptWait = 300; | 100 | private int RemoteReplyScriptWait = 300; |
95 | private object XMLRPCListLock = new object(); | 101 | private object XMLRPCListLock = new object(); |
96 | 102 | ||
97 | #region IRegionModule Members | 103 | #region ISharedRegionModule Members |
98 | 104 | ||
99 | public void Initialise(Scene scene, IConfigSource config) | 105 | public void Initialise(IConfigSource config) |
100 | { | 106 | { |
101 | // We need to create these early because the scripts might be calling | 107 | // We need to create these early because the scripts might be calling |
102 | // But since this gets called for every region, we need to make sure they | 108 | // But since this gets called for every region, we need to make sure they |
103 | // get called only one time (or we lose any open channels) | 109 | // get called only one time (or we lose any open channels) |
104 | if (null == m_openChannels) | 110 | m_openChannels = new Dictionary<UUID, RPCChannelInfo>(); |
105 | { | 111 | m_rpcPending = new Dictionary<UUID, RPCRequestInfo>(); |
106 | m_openChannels = new Dictionary<UUID, RPCChannelInfo>(); | 112 | m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>(); |
107 | m_rpcPending = new Dictionary<UUID, RPCRequestInfo>(); | 113 | m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>(); |
108 | m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>(); | ||
109 | m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>(); | ||
110 | 114 | ||
111 | try | 115 | try |
112 | { | 116 | { |
113 | m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort); | 117 | m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort); |
114 | } | ||
115 | catch (Exception) | ||
116 | { | ||
117 | } | ||
118 | } | 118 | } |
119 | 119 | catch (Exception) | |
120 | if (!m_scenes.Contains(scene)) | ||
121 | { | 120 | { |
122 | m_scenes.Add(scene); | ||
123 | |||
124 | scene.RegisterModuleInterface<IXMLRPC>(this); | ||
125 | } | 121 | } |
126 | } | 122 | } |
127 | 123 | ||
@@ -131,32 +127,56 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | |||
131 | { | 127 | { |
132 | // Start http server | 128 | // Start http server |
133 | // Attach xmlrpc handlers | 129 | // Attach xmlrpc handlers |
134 | // m_log.InfoFormat( | 130 | // m_log.InfoFormat( |
135 | // "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.", | 131 | // "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.", |
136 | // m_remoteDataPort); | 132 | // m_remoteDataPort); |
137 | 133 | ||
138 | IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort); | 134 | IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort); |
139 | httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); | 135 | httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); |
140 | } | 136 | } |
141 | } | 137 | } |
142 | 138 | ||
143 | public void Close() | 139 | public void AddRegion(Scene scene) |
140 | { | ||
141 | if (!IsEnabled()) | ||
142 | return; | ||
143 | |||
144 | if (!m_scenes.Contains(scene)) | ||
145 | { | ||
146 | m_scenes.Add(scene); | ||
147 | |||
148 | scene.RegisterModuleInterface<IXMLRPC>(this); | ||
149 | } | ||
150 | } | ||
151 | |||
152 | public void RegionLoaded(Scene scene) | ||
144 | { | 153 | { |
145 | } | 154 | } |
146 | 155 | ||
147 | public string Name | 156 | public void RemoveRegion(Scene scene) |
148 | { | 157 | { |
149 | get { return m_name; } | 158 | if (!IsEnabled()) |
159 | return; | ||
160 | |||
161 | if (m_scenes.Contains(scene)) | ||
162 | { | ||
163 | scene.UnregisterModuleInterface<IXMLRPC>(this); | ||
164 | m_scenes.Remove(scene); | ||
165 | } | ||
150 | } | 166 | } |
151 | 167 | ||
152 | public bool IsSharedModule | 168 | public void Close() |
153 | { | 169 | { |
154 | get { return true; } | ||
155 | } | 170 | } |
156 | 171 | ||
157 | public int Port | 172 | public string Name |
158 | { | 173 | { |
159 | get { return m_remoteDataPort; } | 174 | get { return m_name; } |
175 | } | ||
176 | |||
177 | public Type ReplaceableInterface | ||
178 | { | ||
179 | get { return null; } | ||
160 | } | 180 | } |
161 | 181 | ||
162 | #endregion | 182 | #endregion |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index f3d38bc..ddaa227 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -37,13 +37,17 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
39 | 39 | ||
40 | using Mono.Addins; | ||
41 | |||
40 | namespace OpenSim.Region.CoreModules.World.Permissions | 42 | namespace OpenSim.Region.CoreModules.World.Permissions |
41 | { | 43 | { |
42 | public class PermissionsModule : IRegionModule, IPermissionsModule | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PermissionsModule")] |
45 | public class PermissionsModule : INonSharedRegionModule, IPermissionsModule | ||
43 | { | 46 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 48 | ||
46 | protected Scene m_scene; | 49 | protected Scene m_scene; |
50 | protected bool m_Enabled; | ||
47 | 51 | ||
48 | private InventoryFolderImpl m_libraryRootFolder; | 52 | private InventoryFolderImpl m_libraryRootFolder; |
49 | protected InventoryFolderImpl LibraryRootFolder | 53 | protected InventoryFolderImpl LibraryRootFolder |
@@ -114,18 +118,44 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
114 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); | 118 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); |
115 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); | 119 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); |
116 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); | 120 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); |
121 | |||
117 | private IFriendsModule m_friendsModule; | 122 | private IFriendsModule m_friendsModule; |
123 | private IFriendsModule FriendsModule | ||
124 | { | ||
125 | get | ||
126 | { | ||
127 | if (m_friendsModule == null) | ||
128 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | ||
129 | return m_friendsModule; | ||
130 | } | ||
131 | } | ||
118 | private IGroupsModule m_groupsModule; | 132 | private IGroupsModule m_groupsModule; |
119 | private IMoapModule m_moapModule; | 133 | private IGroupsModule GroupsModule |
134 | { | ||
135 | get | ||
136 | { | ||
137 | if (m_groupsModule == null) | ||
138 | m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
139 | return m_groupsModule; | ||
140 | } | ||
141 | } | ||
120 | 142 | ||
143 | private IMoapModule m_moapModule; | ||
144 | private IMoapModule MoapModule | ||
145 | { | ||
146 | get | ||
147 | { | ||
148 | if (m_moapModule == null) | ||
149 | m_moapModule = m_scene.RequestModuleInterface<IMoapModule>(); | ||
150 | return m_moapModule; | ||
151 | } | ||
152 | } | ||
121 | #endregion | 153 | #endregion |
122 | 154 | ||
123 | #region IRegionModule Members | 155 | #region INonSharedRegionModule Members |
124 | 156 | ||
125 | public void Initialise(Scene scene, IConfigSource config) | 157 | public void Initialise(IConfigSource config) |
126 | { | 158 | { |
127 | m_scene = scene; | ||
128 | |||
129 | IConfig myConfig = config.Configs["Startup"]; | 159 | IConfig myConfig = config.Configs["Startup"]; |
130 | 160 | ||
131 | string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); | 161 | string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); |
@@ -135,6 +165,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
135 | if (!modules.Contains("DefaultPermissionsModule")) | 165 | if (!modules.Contains("DefaultPermissionsModule")) |
136 | return; | 166 | return; |
137 | 167 | ||
168 | m_Enabled = true; | ||
169 | |||
138 | m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false); | 170 | m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false); |
139 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); | 171 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); |
140 | m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); | 172 | m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); |
@@ -144,7 +176,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
144 | 176 | ||
145 | m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); | 177 | m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); |
146 | 178 | ||
147 | m_allowedScriptCreators | 179 | m_allowedScriptCreators |
148 | = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); | 180 | = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); |
149 | m_allowedScriptEditors | 181 | m_allowedScriptEditors |
150 | = ParseUserSetConfigSetting(myConfig, "allowed_script_editors", m_allowedScriptEditors); | 182 | = ParseUserSetConfigSetting(myConfig, "allowed_script_editors", m_allowedScriptEditors); |
@@ -154,6 +186,64 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
154 | else | 186 | else |
155 | m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); | 187 | m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); |
156 | 188 | ||
189 | string grant = myConfig.GetString("GrantLSL", ""); | ||
190 | if (grant.Length > 0) | ||
191 | { | ||
192 | foreach (string uuidl in grant.Split(',')) | ||
193 | { | ||
194 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
195 | GrantLSL.Add(uuid, true); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | grant = myConfig.GetString("GrantCS", ""); | ||
200 | if (grant.Length > 0) | ||
201 | { | ||
202 | foreach (string uuidl in grant.Split(',')) | ||
203 | { | ||
204 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
205 | GrantCS.Add(uuid, true); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | grant = myConfig.GetString("GrantVB", ""); | ||
210 | if (grant.Length > 0) | ||
211 | { | ||
212 | foreach (string uuidl in grant.Split(',')) | ||
213 | { | ||
214 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
215 | GrantVB.Add(uuid, true); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | grant = myConfig.GetString("GrantJS", ""); | ||
220 | if (grant.Length > 0) | ||
221 | { | ||
222 | foreach (string uuidl in grant.Split(',')) | ||
223 | { | ||
224 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
225 | GrantJS.Add(uuid, true); | ||
226 | } | ||
227 | } | ||
228 | |||
229 | grant = myConfig.GetString("GrantYP", ""); | ||
230 | if (grant.Length > 0) | ||
231 | { | ||
232 | foreach (string uuidl in grant.Split(',')) | ||
233 | { | ||
234 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
235 | GrantYP.Add(uuid, true); | ||
236 | } | ||
237 | } | ||
238 | } | ||
239 | |||
240 | public void AddRegion(Scene scene) | ||
241 | { | ||
242 | if (!m_Enabled) | ||
243 | return; | ||
244 | |||
245 | m_scene = scene; | ||
246 | |||
157 | scene.RegisterModuleInterface<IPermissionsModule>(this); | 247 | scene.RegisterModuleInterface<IPermissionsModule>(this); |
158 | 248 | ||
159 | //Register functions with Scene External Checks! | 249 | //Register functions with Scene External Checks! |
@@ -169,44 +259,44 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
169 | m_scene.Permissions.OnIsGridGod += IsGridGod; | 259 | m_scene.Permissions.OnIsGridGod += IsGridGod; |
170 | m_scene.Permissions.OnIsAdministrator += IsAdministrator; | 260 | m_scene.Permissions.OnIsAdministrator += IsAdministrator; |
171 | m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; | 261 | m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; |
172 | m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED | 262 | m_scene.Permissions.OnDeleteObject += CanDeleteObject; |
173 | m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED | 263 | m_scene.Permissions.OnEditObject += CanEditObject; |
174 | m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED | 264 | m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; |
175 | m_scene.Permissions.OnInstantMessage += CanInstantMessage; | 265 | m_scene.Permissions.OnInstantMessage += CanInstantMessage; |
176 | m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED | 266 | m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; |
177 | m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED | 267 | m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; |
178 | m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED | 268 | m_scene.Permissions.OnMoveObject += CanMoveObject; |
179 | m_scene.Permissions.OnObjectEntry += CanObjectEntry; | 269 | m_scene.Permissions.OnObjectEntry += CanObjectEntry; |
180 | m_scene.Permissions.OnReturnObjects += CanReturnObjects; //NOT YET IMPLEMENTED | 270 | m_scene.Permissions.OnReturnObjects += CanReturnObjects; |
181 | m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED | 271 | m_scene.Permissions.OnRezObject += CanRezObject; |
182 | m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; | 272 | m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; |
183 | m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED | 273 | m_scene.Permissions.OnRunScript += CanRunScript; |
184 | m_scene.Permissions.OnCompileScript += CanCompileScript; | 274 | m_scene.Permissions.OnCompileScript += CanCompileScript; |
185 | m_scene.Permissions.OnSellParcel += CanSellParcel; | 275 | m_scene.Permissions.OnSellParcel += CanSellParcel; |
186 | m_scene.Permissions.OnTakeObject += CanTakeObject; | 276 | m_scene.Permissions.OnTakeObject += CanTakeObject; |
187 | m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; | 277 | m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; |
188 | m_scene.Permissions.OnTerraformLand += CanTerraformLand; | 278 | m_scene.Permissions.OnTerraformLand += CanTerraformLand; |
189 | m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED | 279 | m_scene.Permissions.OnLinkObject += CanLinkObject; |
190 | m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED | 280 | m_scene.Permissions.OnDelinkObject += CanDelinkObject; |
191 | m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED | 281 | m_scene.Permissions.OnBuyLand += CanBuyLand; |
192 | 282 | ||
193 | m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED | 283 | m_scene.Permissions.OnViewNotecard += CanViewNotecard; |
194 | m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED | 284 | m_scene.Permissions.OnViewScript += CanViewScript; |
195 | m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED | 285 | m_scene.Permissions.OnEditNotecard += CanEditNotecard; |
196 | m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED | 286 | m_scene.Permissions.OnEditScript += CanEditScript; |
197 | 287 | ||
198 | m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; | 288 | m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; |
199 | m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED | 289 | m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory; |
200 | m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED | 290 | m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; |
201 | m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED | 291 | m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; |
202 | m_scene.Permissions.OnResetScript += CanResetScript; | 292 | m_scene.Permissions.OnResetScript += CanResetScript; |
203 | 293 | ||
204 | m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED | 294 | m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; |
205 | m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED | 295 | m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; |
206 | m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED | 296 | m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; |
207 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED | 297 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; |
208 | 298 | ||
209 | m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED | 299 | m_scene.Permissions.OnTeleport += CanTeleport; |
210 | 300 | ||
211 | m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; | 301 | m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; |
212 | m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; | 302 | m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; |
@@ -226,52 +316,38 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
226 | "Turn on permissions debugging", | 316 | "Turn on permissions debugging", |
227 | HandleDebugPermissions); | 317 | HandleDebugPermissions); |
228 | 318 | ||
229 | string grant = myConfig.GetString("GrantLSL",""); | 319 | } |
230 | if (grant.Length > 0) { | ||
231 | foreach (string uuidl in grant.Split(',')) { | ||
232 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
233 | GrantLSL.Add(uuid, true); | ||
234 | } | ||
235 | } | ||
236 | 320 | ||
237 | grant = myConfig.GetString("GrantCS",""); | 321 | public void RegionLoaded(Scene scene) |
238 | if (grant.Length > 0) { | 322 | { |
239 | foreach (string uuidl in grant.Split(',')) { | 323 | } |
240 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
241 | GrantCS.Add(uuid, true); | ||
242 | } | ||
243 | } | ||
244 | 324 | ||
245 | grant = myConfig.GetString("GrantVB",""); | 325 | public void RemoveRegion(Scene scene) |
246 | if (grant.Length > 0) { | 326 | { |
247 | foreach (string uuidl in grant.Split(',')) { | 327 | if (!m_Enabled) |
248 | string uuid = uuidl.Trim(" \t".ToCharArray()); | 328 | return; |
249 | GrantVB.Add(uuid, true); | ||
250 | } | ||
251 | } | ||
252 | 329 | ||
253 | grant = myConfig.GetString("GrantJS", ""); | 330 | m_scene.UnregisterModuleInterface<IPermissionsModule>(this); |
254 | if (grant.Length > 0) | 331 | } |
255 | { | ||
256 | foreach (string uuidl in grant.Split(',')) | ||
257 | { | ||
258 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
259 | GrantJS.Add(uuid, true); | ||
260 | } | ||
261 | } | ||
262 | 332 | ||
263 | grant = myConfig.GetString("GrantYP", ""); | 333 | public void Close() |
264 | if (grant.Length > 0) | 334 | { |
265 | { | 335 | } |
266 | foreach (string uuidl in grant.Split(',')) | 336 | |
267 | { | 337 | public string Name |
268 | string uuid = uuidl.Trim(" \t".ToCharArray()); | 338 | { |
269 | GrantYP.Add(uuid, true); | 339 | get { return "PermissionsModule"; } |
270 | } | 340 | } |
271 | } | ||
272 | 341 | ||
342 | public Type ReplaceableInterface | ||
343 | { | ||
344 | get { return null; } | ||
273 | } | 345 | } |
274 | 346 | ||
347 | #endregion | ||
348 | |||
349 | #region Console command handlers | ||
350 | |||
275 | public void HandleBypassPermissions(string module, string[] args) | 351 | public void HandleBypassPermissions(string module, string[] args) |
276 | { | 352 | { |
277 | if (m_scene.ConsoleScene() != null && | 353 | if (m_scene.ConsoleScene() != null && |
@@ -290,7 +366,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
290 | m_bypassPermissions = val; | 366 | m_bypassPermissions = val; |
291 | 367 | ||
292 | m_log.InfoFormat( | 368 | m_log.InfoFormat( |
293 | "[PERMISSIONS]: Set permissions bypass to {0} for {1}", | 369 | "[PERMISSIONS]: Set permissions bypass to {0} for {1}", |
294 | m_bypassPermissions, m_scene.RegionInfo.RegionName); | 370 | m_bypassPermissions, m_scene.RegionInfo.RegionName); |
295 | } | 371 | } |
296 | } | 372 | } |
@@ -343,39 +419,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
343 | } | 419 | } |
344 | } | 420 | } |
345 | 421 | ||
346 | public void PostInitialise() | ||
347 | { | ||
348 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | ||
349 | |||
350 | if (m_friendsModule == null) | ||
351 | m_log.Debug("[PERMISSIONS]: Friends module not found, friend permissions will not work"); | ||
352 | |||
353 | m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
354 | |||
355 | if (m_groupsModule == null) | ||
356 | m_log.Debug("[PERMISSIONS]: Groups module not found, group permissions will not work"); | ||
357 | |||
358 | m_moapModule = m_scene.RequestModuleInterface<IMoapModule>(); | ||
359 | |||
360 | // This log line will be commented out when no longer required for debugging | ||
361 | // if (m_moapModule == null) | ||
362 | // m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); | ||
363 | } | ||
364 | |||
365 | public void Close() | ||
366 | { | ||
367 | } | ||
368 | |||
369 | public string Name | ||
370 | { | ||
371 | get { return "DefaultPermissionsModule"; } | ||
372 | } | ||
373 | |||
374 | public bool IsSharedModule | ||
375 | { | ||
376 | get { return false; } | ||
377 | } | ||
378 | |||
379 | #endregion | 422 | #endregion |
380 | 423 | ||
381 | #region Helper Functions | 424 | #region Helper Functions |
@@ -400,10 +443,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
400 | /// <returns></returns> | 443 | /// <returns></returns> |
401 | protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) | 444 | protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) |
402 | { | 445 | { |
403 | if (null == m_groupsModule) | 446 | if (null == GroupsModule) |
404 | return false; | 447 | return false; |
405 | 448 | ||
406 | GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID); | 449 | GroupMembershipData gmd = GroupsModule.GetMembershipData(groupID, userID); |
407 | 450 | ||
408 | if (gmd != null) | 451 | if (gmd != null) |
409 | { | 452 | { |
@@ -503,10 +546,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
503 | if (user == UUID.Zero) | 546 | if (user == UUID.Zero) |
504 | return false; | 547 | return false; |
505 | 548 | ||
506 | if (m_friendsModule == null) | 549 | if (FriendsModule == null) |
507 | return false; | 550 | return false; |
508 | 551 | ||
509 | int friendPerms = m_friendsModule.GetRightsGrantedByFriend(user, objectOwner); | 552 | int friendPerms = FriendsModule.GetRightsGrantedByFriend(user, objectOwner); |
510 | return (friendPerms & (int)FriendRights.CanModifyObjects) != 0; | 553 | return (friendPerms & (int)FriendRights.CanModifyObjects) != 0; |
511 | } | 554 | } |
512 | 555 | ||
@@ -1915,14 +1958,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1915 | // "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}", | 1958 | // "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}", |
1916 | // agentID, primID, face); | 1959 | // agentID, primID, face); |
1917 | 1960 | ||
1918 | if (null == m_moapModule) | 1961 | if (null == MoapModule) |
1919 | return false; | 1962 | return false; |
1920 | 1963 | ||
1921 | SceneObjectPart part = m_scene.GetSceneObjectPart(primID); | 1964 | SceneObjectPart part = m_scene.GetSceneObjectPart(primID); |
1922 | if (null == part) | 1965 | if (null == part) |
1923 | return false; | 1966 | return false; |
1924 | 1967 | ||
1925 | MediaEntry me = m_moapModule.GetMediaEntry(part, face); | 1968 | MediaEntry me = MoapModule.GetMediaEntry(part, face); |
1926 | 1969 | ||
1927 | // If there is no existing media entry then it can be controlled (in this context, created). | 1970 | // If there is no existing media entry then it can be controlled (in this context, created). |
1928 | if (null == me) | 1971 | if (null == me) |
@@ -1941,14 +1984,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1941 | // "[PERMISSONS]: Performing CanInteractWithPrimMedia check with agentID {0}, primID {1}, face {2}", | 1984 | // "[PERMISSONS]: Performing CanInteractWithPrimMedia check with agentID {0}, primID {1}, face {2}", |
1942 | // agentID, primID, face); | 1985 | // agentID, primID, face); |
1943 | 1986 | ||
1944 | if (null == m_moapModule) | 1987 | if (null == MoapModule) |
1945 | return false; | 1988 | return false; |
1946 | 1989 | ||
1947 | SceneObjectPart part = m_scene.GetSceneObjectPart(primID); | 1990 | SceneObjectPart part = m_scene.GetSceneObjectPart(primID); |
1948 | if (null == part) | 1991 | if (null == part) |
1949 | return false; | 1992 | return false; |
1950 | 1993 | ||
1951 | MediaEntry me = m_moapModule.GetMediaEntry(part, face); | 1994 | MediaEntry me = MoapModule.GetMediaEntry(part, face); |
1952 | 1995 | ||
1953 | // If there is no existing media entry then it can be controlled (in this context, created). | 1996 | // If there is no existing media entry then it can be controlled (in this context, created). |
1954 | if (null == me) | 1997 | if (null == me) |