aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-11-12 15:46:45 +0000
committerMelanie2012-11-12 15:46:45 +0000
commitd9b149b3756442224492ca24c2be3196a873489a (patch)
treeec1e0649b7aef62ecb9475f78b467062f353866c /OpenSim
parentMerge branch 'master' into careminster (diff)
parentFix mantis #6425 (diff)
downloadopensim-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')
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs12
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs48
-rw-r--r--OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs110
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs34
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs64
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs82
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs267
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs114
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs54
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs91
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs36
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs49
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs124
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs169
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs10
17 files changed, 828 insertions, 501 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 0065702..a8a3237 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -99,12 +99,12 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
99 RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); 99 RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
100 100
101 m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules..."); 101 m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules...");
102 m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule..."); 102 //m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule...");
103 m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); 103 //m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
104 m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule..."); 104 //m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule...");
105 m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); 105 //m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
106 m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule..."); 106 //m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule...");
107 m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); 107 //m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
108// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule..."); 108// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
109// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); 109// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
110 m_log.Info("[LOAD REGIONS PLUGIN]: Done."); 110 m_log.Info("[LOAD REGIONS PLUGIN]: Done.");
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;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using log4net; 38using log4net;
39using System.Reflection; 39using System.Reflection;
40using Mono.Addins;
40 41
41namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture 42namespace 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;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using Mono.Addins;
40 41
41namespace OpenSim.Region.CoreModules.Scripting.EmailModules 42namespace 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;
41using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
44using Mono.Addins;
44 45
45/***************************************************** 46/*****************************************************
46 * 47 *
@@ -87,7 +88,8 @@ using OpenSim.Region.Framework.Scenes;
87 88
88namespace OpenSim.Region.CoreModules.Scripting.HttpRequest 89namespace 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;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using log4net; 38using log4net;
39using System.Reflection; 39using System.Reflection;
40using Mono.Addins;
40 41
41namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL 42namespace 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;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using log4net; 41using log4net;
42using System.Reflection; 42using System.Reflection;
43using Mono.Addins;
43 44
44//using Cairo; 45//using Cairo;
45 46
46namespace OpenSim.Region.CoreModules.Scripting.VectorRender 47namespace 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;
40using OpenSim.Framework.Servers.HttpServer; 40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43using Mono.Addins;
43 44
44/***************************************************** 45/*****************************************************
45 * 46 *
@@ -76,7 +77,8 @@ using OpenSim.Region.Framework.Scenes;
76 77
77namespace OpenSim.Region.CoreModules.Scripting.XMLRPC 78namespace 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;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39 39
40using Mono.Addins;
41
40namespace OpenSim.Region.CoreModules.World.Permissions 42namespace 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)
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index d582149..9817cf7 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -32,14 +32,16 @@ using OpenSim.Region.Framework.Scenes;
32namespace OpenSim.Region.Framework.Interfaces 32namespace OpenSim.Region.Framework.Interfaces
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// Temporary interface. More methods to come at some point to make NPCs more object oriented rather than 35 /// Temporary interface. More methods to come at some point to make NPCs
36 /// controlling purely through module level interface calls (e.g. sit/stand). 36 /// more object oriented rather than controlling purely through module
37 /// level interface calls (e.g. sit/stand).
37 /// </summary> 38 /// </summary>
38 public interface INPC 39 public interface INPC
39 { 40 {
40 /// <summary> 41 /// <summary>
41 /// Should this NPC be sensed by LSL sensors as an 'agent' (interpreted here to mean a normal user) 42 /// Should this NPC be sensed by LSL sensors as an 'agent'
42 /// rather than an OpenSim specific NPC extension? 43 /// (interpreted here to mean a normal user) rather than an OpenSim
44 /// specific NPC extension?
43 /// </summary> 45 /// </summary>
44 bool SenseAsAgent { get; } 46 bool SenseAsAgent { get; }
45 } 47 }
@@ -53,35 +55,42 @@ namespace OpenSim.Region.Framework.Interfaces
53 /// <param name="lastname"></param> 55 /// <param name="lastname"></param>
54 /// <param name="position"></param> 56 /// <param name="position"></param>
55 /// <param name="senseAsAgent"> 57 /// <param name="senseAsAgent">
56 /// Make the NPC show up as an agent on LSL sensors. The default is that they 58 /// Make the NPC show up as an agent on LSL sensors. The default is
57 /// show up as the NPC type instead, but this is currently an OpenSim-only extension. 59 /// that they show up as the NPC type instead, but this is currently
60 /// an OpenSim-only extension.
58 /// </param> 61 /// </param>
59 /// <param name="scene"></param> 62 /// <param name="scene"></param>
60 /// <param name="appearance">The avatar appearance to use for the new NPC.</param> 63 /// <param name="appearance">
61 /// <returns>The UUID of the ScenePresence created. UUID.Zero if there was a failure.</returns> 64 /// The avatar appearance to use for the new NPC.
62 UUID CreateNPC( 65 /// </param>
63 string firstname, 66 /// <returns>
64 string lastname, 67 /// The UUID of the ScenePresence created. UUID.Zero if there was a
65 Vector3 position, 68 /// failure.
66 UUID owner, 69 /// </returns>
67 bool senseAsAgent, 70 UUID CreateNPC(string firstname, string lastname, Vector3 position,
68 Scene scene, 71 UUID owner, bool senseAsAgent, Scene scene,
69 AvatarAppearance appearance); 72 AvatarAppearance appearance);
70 73
71 /// <summary> 74 /// <summary>
72 /// Check if the agent is an NPC. 75 /// Check if the agent is an NPC.
73 /// </summary> 76 /// </summary>
74 /// <param name="agentID"></param> 77 /// <param name="agentID"></param>
75 /// <param name="scene"></param> 78 /// <param name="scene"></param>
76 /// <returns>True if the agent is an NPC in the given scene. False otherwise.</returns> 79 /// <returns>
80 /// True if the agent is an NPC in the given scene. False otherwise.
81 /// </returns>
77 bool IsNPC(UUID agentID, Scene scene); 82 bool IsNPC(UUID agentID, Scene scene);
78 83
79 /// <summary> 84 /// <summary>
80 /// Get the NPC. This is not currently complete - manipulation of NPCs still occurs through the region interface 85 /// Get the NPC.
81 /// </summary> 86 /// </summary>
87 /// <remarks>
88 /// This is not currently complete - manipulation of NPCs still occurs
89 /// through the region interface.
90 /// </remarks>
82 /// <param name="agentID"></param> 91 /// <param name="agentID"></param>
83 /// <param name="scene"></param> 92 /// <param name="scene"></param>
84 /// <returns>The NPC. null if it does not exist.</returns> 93 /// <returns>The NPC. null if it does not exist.</returns>
85 INPC GetNPC(UUID agentID, Scene scene); 94 INPC GetNPC(UUID agentID, Scene scene);
86 95
87 /// <summary> 96 /// <summary>
@@ -89,7 +98,10 @@ namespace OpenSim.Region.Framework.Interfaces
89 /// </summary> 98 /// </summary>
90 /// <param name="npcID"></param> 99 /// <param name="npcID"></param>
91 /// <param name="callerID"></param> 100 /// <param name="callerID"></param>
92 /// <returns>true if they do, false if they don't or if there's no NPC with the given ID.</returns> 101 /// <returns>
102 /// true if they do, false if they don't or if there's no NPC with the
103 /// given ID.
104 /// </returns>
93 bool CheckPermissions(UUID npcID, UUID callerID); 105 bool CheckPermissions(UUID npcID, UUID callerID);
94 106
95 /// <summary> 107 /// <summary>
@@ -98,8 +110,12 @@ namespace OpenSim.Region.Framework.Interfaces
98 /// <param name="agentID"></param> 110 /// <param name="agentID"></param>
99 /// <param name="appearance"></param> 111 /// <param name="appearance"></param>
100 /// <param name="scene"></param> 112 /// <param name="scene"></param>
101 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 113 /// <returns>
102 bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene); 114 /// True if the operation succeeded, false if there was no such agent
115 /// or the agent was not an NPC.
116 /// </returns>
117 bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance,
118 Scene scene);
103 119
104 /// <summary> 120 /// <summary>
105 /// Move an NPC to a target over time. 121 /// Move an NPC to a target over time.
@@ -108,23 +124,29 @@ namespace OpenSim.Region.Framework.Interfaces
108 /// <param name="scene"></param> 124 /// <param name="scene"></param>
109 /// <param name="pos"></param> 125 /// <param name="pos"></param>
110 /// <param name="noFly"> 126 /// <param name="noFly">
111 /// If true, then the avatar will attempt to walk to the location even if it's up in the air. 127 /// If true, then the avatar will attempt to walk to the location even
112 /// This is to allow walking on prims. 128 /// if it's up in the air. This is to allow walking on prims.
113 /// </param> 129 /// </param>
114 /// <param name="landAtTarget"> 130 /// <param name="landAtTarget">
115 /// If true and the avatar is flying when it reaches the target, land. 131 /// If true and the avatar is flying when it reaches the target, land.
116 /// </param> name="running"> 132 /// </param> name="running">
117 /// If true, NPC moves with running speed. 133 /// If true, NPC moves with running speed.
118 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 134 /// <returns>
119 /// 135 /// True if the operation succeeded, false if there was no such agent
120 bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running); 136 /// or the agent was not an NPC.
137 /// </returns>
138 bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly,
139 bool landAtTarget, bool running);
121 140
122 /// <summary> 141 /// <summary>
123 /// Stop the NPC's current movement. 142 /// Stop the NPC's current movement.
124 /// </summary> 143 /// </summary>
125 /// <param name="agentID">The UUID of the NPC</param> 144 /// <param name="agentID">The UUID of the NPC</param>
126 /// <param name="scene"></param> 145 /// <param name="scene"></param>
127 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 146 /// <returns>
147 /// True if the operation succeeded, false if there was no such agent
148 /// or the agent was not an NPC.
149 /// </returns>
128 bool StopMoveToTarget(UUID agentID, Scene scene); 150 bool StopMoveToTarget(UUID agentID, Scene scene);
129 151
130 /// <summary> 152 /// <summary>
@@ -133,7 +155,10 @@ namespace OpenSim.Region.Framework.Interfaces
133 /// <param name="agentID">The UUID of the NPC</param> 155 /// <param name="agentID">The UUID of the NPC</param>
134 /// <param name="scene"></param> 156 /// <param name="scene"></param>
135 /// <param name="text"></param> 157 /// <param name="text"></param>
136 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 158 /// <returns>
159 /// True if the operation succeeded, false if there was no such agent
160 /// or the agent was not an NPC.
161 /// </returns>
137 bool Say(UUID agentID, Scene scene, string text); 162 bool Say(UUID agentID, Scene scene, string text);
138 163
139 /// <summary> 164 /// <summary>
@@ -143,7 +168,10 @@ namespace OpenSim.Region.Framework.Interfaces
143 /// <param name="scene"></param> 168 /// <param name="scene"></param>
144 /// <param name="text"></param> 169 /// <param name="text"></param>
145 /// <param name="channel"></param> 170 /// <param name="channel"></param>
146 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 171 /// <returns>
172 /// True if the operation succeeded, false if there was no such agent
173 /// or the agent was not an NPC.
174 /// </returns>
147 bool Say(UUID agentID, Scene scene, string text, int channel); 175 bool Say(UUID agentID, Scene scene, string text, int channel);
148 176
149 /// <summary> 177 /// <summary>
@@ -153,7 +181,10 @@ namespace OpenSim.Region.Framework.Interfaces
153 /// <param name="scene"></param> 181 /// <param name="scene"></param>
154 /// <param name="text"></param> 182 /// <param name="text"></param>
155 /// <param name="channel"></param> 183 /// <param name="channel"></param>
156 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 184 /// <returns>
185 /// True if the operation succeeded, false if there was no such agent
186 /// or the agent was not an NPC.
187 /// </returns>
157 bool Shout(UUID agentID, Scene scene, string text, int channel); 188 bool Shout(UUID agentID, Scene scene, string text, int channel);
158 189
159 /// <summary> 190 /// <summary>
@@ -163,7 +194,10 @@ namespace OpenSim.Region.Framework.Interfaces
163 /// <param name="scene"></param> 194 /// <param name="scene"></param>
164 /// <param name="text"></param> 195 /// <param name="text"></param>
165 /// <param name="channel"></param> 196 /// <param name="channel"></param>
166 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 197 /// <returns>
198 /// True if the operation succeeded, false if there was no such agent
199 /// or the agent was not an NPC.
200 /// </returns>
167 bool Whisper(UUID agentID, Scene scene, string text, int channel); 201 bool Whisper(UUID agentID, Scene scene, string text, int channel);
168 202
169 /// <summary> 203 /// <summary>
@@ -188,7 +222,9 @@ namespace OpenSim.Region.Framework.Interfaces
188 /// </summary> 222 /// </summary>
189 /// <param name="agentID"></param> 223 /// <param name="agentID"></param>
190 /// <param name="partID"></param> 224 /// <param name="partID"></param>
191 /// <returns>true if the touch is actually attempted, false if not</returns> 225 /// <returns>
226 /// true if the touch is actually attempted, false if not.
227 /// </returns>
192 bool Touch(UUID agentID, UUID partID); 228 bool Touch(UUID agentID, UUID partID);
193 229
194 /// <summary> 230 /// <summary>
@@ -196,14 +232,20 @@ namespace OpenSim.Region.Framework.Interfaces
196 /// </summary> 232 /// </summary>
197 /// <param name="agentID">The UUID of the NPC</param> 233 /// <param name="agentID">The UUID of the NPC</param>
198 /// <param name="scene"></param> 234 /// <param name="scene"></param>
199 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns> 235 /// <returns>
236 /// True if the operation succeeded, false if there was no such agent
237 /// or the agent was not an NPC.
238 /// </returns>
200 bool DeleteNPC(UUID agentID, Scene scene); 239 bool DeleteNPC(UUID agentID, Scene scene);
201 240
202 /// <summary> 241 /// <summary>
203 /// Get the owner of a NPC 242 /// Get the owner of a NPC
204 /// </summary> 243 /// </summary>
205 /// <param name="agentID">The UUID of the NPC</param> 244 /// <param name="agentID">The UUID of the NPC</param>
206 /// <returns>UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC</returns> 245 /// <returns>
246 /// UUID of owner if the NPC exists, UUID.Zero if there was no such
247 /// agent, the agent is unowned or the agent was not an NPC.
248 /// </returns>
207 UUID GetOwner(UUID agentID); 249 UUID GetOwner(UUID agentID);
208 } 250 }
209} \ No newline at end of file 251}
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs
index cfe1278..406b715 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Net; 29using System.Net;
29using System.Reflection; 30using System.Reflection;
30using log4net; 31using log4net;
@@ -33,49 +34,51 @@ using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server; 35using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server;
35 36
37using Mono.Addins;
38
36namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView 39namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
37{ 40{
38 public class IRCStackModule : IRegionModule 41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "IRCStackModule")]
42 public class IRCStackModule : INonSharedRegionModule
39 { 43 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 45
42 private IRCServer m_server; 46 private IRCServer m_server;
47 private int m_Port;
43// private Scene m_scene; 48// private Scene m_scene;
49 private bool m_Enabled;
44 50
45 #region Implementation of IRegionModule 51 #region Implementation of INonSharedRegionModule
46 52
47 public void Initialise(Scene scene, IConfigSource source) 53 public void Initialise(IConfigSource source)
48 { 54 {
49 if (null != source.Configs["IRCd"] && 55 if (null != source.Configs["IRCd"] &&
50 source.Configs["IRCd"].GetBoolean("Enabled",false)) 56 source.Configs["IRCd"].GetBoolean("Enabled", false))
51 { 57 {
52 int portNo = source.Configs["IRCd"].GetInt("Port",6666); 58 m_Enabled = true;
53// m_scene = scene; 59 m_Port = source.Configs["IRCd"].GetInt("Port", 6666);
54 m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene);
55 m_server.OnNewIRCClient += m_server_OnNewIRCClient;
56 } 60 }
57 } 61 }
58 62
59 void m_server_OnNewIRCClient(IRCClientView user) 63 public void AddRegion(Scene scene)
60 { 64 {
61 user.OnIRCReady += user_OnIRCReady; 65 if (!m_Enabled)
66 return;
67
68 m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), m_Port, scene);
69 m_server.OnNewIRCClient += m_server_OnNewIRCClient;
62 } 70 }
63 71
64 void user_OnIRCReady(IRCClientView cv) 72 public void RegionLoaded(Scene scene)
65 { 73 {
66 m_log.Info("[IRCd] Adding user...");
67 cv.Start();
68 m_log.Info("[IRCd] Added user to Scene");
69 } 74 }
70 75
71 public void PostInitialise() 76 public void RemoveRegion(Scene scene)
72 { 77 {
73
74 } 78 }
75 79
76 public void Close() 80 public void Close()
77 { 81 {
78
79 } 82 }
80 83
81 public string Name 84 public string Name
@@ -83,11 +86,24 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
83 get { return "IRCClientStackModule"; } 86 get { return "IRCClientStackModule"; }
84 } 87 }
85 88
86 public bool IsSharedModule 89 public Type ReplaceableInterface
87 { 90 {
88 get { return false; } 91 get { return null; }
89 } 92 }
90 93
91 #endregion 94 #endregion
95
96 void m_server_OnNewIRCClient(IRCClientView user)
97 {
98 user.OnIRCReady += user_OnIRCReady;
99 }
100
101 void user_OnIRCReady(IRCClientView cv)
102 {
103 m_log.Info("[IRCd] Adding user...");
104 cv.Start();
105 m_log.Info("[IRCd] Added user to Scene");
106 }
107
92 } 108 }
93} 109}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index 03481d2..6fb28e2 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -43,13 +43,17 @@ using OpenMetaverse;
43using OpenSim.Framework; 43using OpenSim.Framework;
44using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
46using Mono.Addins;
46 47
47namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 48namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
48{ 49{
49 public class MRMModule : IRegionModule, IMRMModule 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MRMModule")]
51 public class MRMModule : INonSharedRegionModule, IMRMModule
50 { 52 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private Scene m_scene; 54 private Scene m_scene;
55 private bool m_Enabled;
56 private bool m_Hidden;
53 57
54 private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>(); 58 private readonly Dictionary<UUID,MRMBase> m_scripts = new Dictionary<UUID, MRMBase>();
55 59
@@ -67,7 +71,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
67 m_extensions[typeof (T)] = instance; 71 m_extensions[typeof (T)] = instance;
68 } 72 }
69 73
70 public void Initialise(Scene scene, IConfigSource source) 74 #region INonSharedRegionModule
75
76 public void Initialise(IConfigSource source)
71 { 77 {
72 if (source.Configs["MRM"] != null) 78 if (source.Configs["MRM"] != null)
73 { 79 {
@@ -76,23 +82,60 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
76 if (source.Configs["MRM"].GetBoolean("Enabled", false)) 82 if (source.Configs["MRM"].GetBoolean("Enabled", false))
77 { 83 {
78 m_log.Info("[MRM]: Enabling MRM Module"); 84 m_log.Info("[MRM]: Enabling MRM Module");
79 m_scene = scene; 85 m_Enabled = true;
86 m_Hidden = source.Configs["MRM"].GetBoolean("Hidden", false);
87 }
88 }
89 }
80 90
81 // when hidden, we don't listen for client initiated script events 91 public void AddRegion(Scene scene)
82 // only making the MRM engine available for region modules 92 {
83 if (!source.Configs["MRM"].GetBoolean("Hidden", false)) 93 if (!m_Enabled)
84 { 94 return;
85 scene.EventManager.OnRezScript += EventManager_OnRezScript;
86 scene.EventManager.OnStopScript += EventManager_OnStopScript;
87 }
88 95
89 scene.EventManager.OnFrame += EventManager_OnFrame; 96 m_scene = scene;
90 97
91 scene.RegisterModuleInterface<IMRMModule>(this); 98 // when hidden, we don't listen for client initiated script events
92 } 99 // only making the MRM engine available for region modules
100 if (!m_Hidden)
101 {
102 scene.EventManager.OnRezScript += EventManager_OnRezScript;
103 scene.EventManager.OnStopScript += EventManager_OnStopScript;
93 } 104 }
105
106 scene.EventManager.OnFrame += EventManager_OnFrame;
107
108 scene.RegisterModuleInterface<IMRMModule>(this);
109 }
110
111 public void RegionLoaded(Scene scene)
112 {
94 } 113 }
95 114
115 public void RemoveRegion(Scene scene)
116 {
117 }
118
119 public void Close()
120 {
121 foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts)
122 {
123 pair.Value.Stop();
124 }
125 }
126
127 public string Name
128 {
129 get { return "MiniRegionModule"; }
130 }
131
132 public Type ReplaceableInterface
133 {
134 get { return null; }
135 }
136
137 #endregion
138
96 void EventManager_OnStopScript(uint localID, UUID itemID) 139 void EventManager_OnStopScript(uint localID, UUID itemID)
97 { 140 {
98 if (m_scripts.ContainsKey(itemID)) 141 if (m_scripts.ContainsKey(itemID))
@@ -293,28 +336,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
293 mmb.InitMiniModule(world, host, itemID); 336 mmb.InitMiniModule(world, host, itemID);
294 } 337 }
295 338
296 public void PostInitialise()
297 {
298 }
299
300 public void Close()
301 {
302 foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts)
303 {
304 pair.Value.Stop();
305 }
306 }
307
308 public string Name
309 {
310 get { return "MiniRegionModule"; }
311 }
312
313 public bool IsSharedModule
314 {
315 get { return false; }
316 }
317
318 /// <summary> 339 /// <summary>
319 /// Stolen from ScriptEngine Common 340 /// Stolen from ScriptEngine Common
320 /// </summary> 341 /// </summary>
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
index 2187449..6120a81 100644
--- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
@@ -32,6 +32,7 @@ using System.Reflection;
32using log4net; 32using log4net;
33using Nini.Config; 33using Nini.Config;
34using OpenMetaverse; 34using OpenMetaverse;
35using Mono.Addins;
35 36
36using OpenSim.Framework; 37using OpenSim.Framework;
37using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
@@ -49,7 +50,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
49 public string uri; 50 public string uri;
50 } 51 }
51 52
52 public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter 53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcGridRouter")]
54 public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter
53 { 55 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 57
@@ -59,9 +61,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
59 private bool m_Enabled = false; 61 private bool m_Enabled = false;
60 private string m_ServerURI = String.Empty; 62 private string m_ServerURI = String.Empty;
61 63
62 public void Initialise(Scene scene, IConfigSource config) 64 #region INonSharedRegionModule
65
66 public void Initialise(IConfigSource config)
63 { 67 {
64 IConfig startupConfig = config.Configs["Startup"]; 68 IConfig startupConfig = config.Configs["XMLRPC"];
65 if (startupConfig == null) 69 if (startupConfig == null)
66 return; 70 return;
67 71
@@ -74,16 +78,30 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
74 m_log.Error("[XMLRPC GRID ROUTER] Module configured but no URI given. Disabling"); 78 m_log.Error("[XMLRPC GRID ROUTER] Module configured but no URI given. Disabling");
75 return; 79 return;
76 } 80 }
77
78 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
79 m_Enabled = true; 81 m_Enabled = true;
80 } 82 }
81 } 83 }
82 84
83 public void PostInitialise() 85 public void AddRegion(Scene scene)
86 {
87 if (!m_Enabled)
88 return;
89
90 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
91 }
92
93 public void RegionLoaded(Scene scene)
84 { 94 {
85 } 95 }
86 96
97 public void RemoveRegion(Scene scene)
98 {
99 if (!m_Enabled)
100 return;
101
102 scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
103 }
104
87 public void Close() 105 public void Close()
88 { 106 {
89 } 107 }
@@ -93,11 +111,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
93 get { return "XmlRpcGridRouterModule"; } 111 get { return "XmlRpcGridRouterModule"; }
94 } 112 }
95 113
96 public bool IsSharedModule 114 public Type ReplaceableInterface
97 { 115 {
98 get { return false; } 116 get { return null; }
99 } 117 }
100 118
119 #endregion
120
101 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) 121 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
102 { 122 {
103 if (!m_Channels.ContainsKey(itemID)) 123 if (!m_Channels.ContainsKey(itemID))
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
index 11c87f8..4bde52a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using Mono.Addins;
34 35
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
@@ -39,32 +40,46 @@ using OpenSim.Region.Framework.Scenes;
39 40
40namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule 41namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
41{ 42{
42 public class XmlRpcRouter : IRegionModule, IXmlRpcRouter 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XmlRpcRouter")]
44 public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter
43 { 45 {
44 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 private bool m_enabled = false; 47
46 public void Initialise(Scene scene, IConfigSource config) 48 private bool m_Enabled;
49
50 #region INonSharedRegionModule
51
52 public void Initialise(IConfigSource config)
47 { 53 {
48 IConfig startupConfig = config.Configs["XMLRPC"]; 54 IConfig startupConfig = config.Configs["XMLRPC"];
49 if (startupConfig == null) 55 if (startupConfig == null)
50 return; 56 return;
51 57
52 if (startupConfig.GetString("XmlRpcRouterModule", 58 if (startupConfig.GetString("XmlRpcRouterModule",
53 "") == "XmlRpcRouterModule") 59 "XmlRpcRouterModule") == "XmlRpcRouterModule")
54 { 60 m_Enabled = true;
55 scene.RegisterModuleInterface<IXmlRpcRouter>(this); 61 }
56 m_enabled = true; 62
57 } 63 public void AddRegion(Scene scene)
58 else 64 {
59 { 65 if (!m_Enabled)
60 m_enabled = false; 66 return;
61 } 67
68 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
62 } 69 }
63 70
64 public void PostInitialise() 71 public void RegionLoaded(Scene scene)
65 { 72 {
66 } 73 }
67 74
75 public void RemoveRegion(Scene scene)
76 {
77 if (!m_Enabled)
78 return;
79
80 scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
81 }
82
68 public void Close() 83 public void Close()
69 { 84 {
70 } 85 }
@@ -74,14 +89,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
74 get { return "XmlRpcRouterModule"; } 89 get { return "XmlRpcRouterModule"; }
75 } 90 }
76 91
77 public bool IsSharedModule 92 public Type ReplaceableInterface
78 { 93 {
79 get { return false; } 94 get { return null; }
80 } 95 }
81 96
97 #endregion
98
82 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) 99 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
83 { 100 {
84 if (m_enabled) 101 if (m_Enabled)
85 { 102 {
86 scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] { uri }); 103 scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] { uri });
87 } 104 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index f16927c..b07ae5b 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -29,37 +29,57 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Threading; 31using System.Threading;
32using Timer = System.Timers.Timer;
33
32using log4net; 34using log4net;
33using Nini.Config; 35using Nini.Config;
36using Mono.Addins;
34using OpenMetaverse; 37using OpenMetaverse;
38
35using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
37using OpenSim.Framework; 41using OpenSim.Framework;
38using Timer=System.Timers.Timer;
39using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
40 43
41namespace OpenSim.Region.OptionalModules.World.NPC 44namespace OpenSim.Region.OptionalModules.World.NPC
42{ 45{
43 public class NPCModule : IRegionModule, INPCModule 46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
47 public class NPCModule : INPCModule, ISharedRegionModule
44 { 48 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType);
51
52 private Dictionary<UUID, NPCAvatar> m_avatars =
53 new Dictionary<UUID, NPCAvatar>();
46 54
47 private Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); 55 public bool Enabled { get; private set; }
48 56
49 public void Initialise(Scene scene, IConfigSource source) 57 public void Initialise(IConfigSource source)
50 { 58 {
51 IConfig config = source.Configs["NPC"]; 59 IConfig config = source.Configs["NPC"];
52 60
53 if (config != null && config.GetBoolean("Enabled", false)) 61 Enabled = (config != null && config.GetBoolean("Enabled", false));
54 { 62 }
63
64 public void AddRegion(Scene scene)
65 {
66 if (Enabled)
55 scene.RegisterModuleInterface<INPCModule>(this); 67 scene.RegisterModuleInterface<INPCModule>(this);
56 } 68 }
69
70 public void RegionLoaded(Scene scene)
71 {
57 } 72 }
58 73
59 public void PostInitialise() 74 public void PostInitialise()
60 { 75 {
61 } 76 }
62 77
78 public void RemoveRegion(Scene scene)
79 {
80 scene.UnregisterModuleInterface<INPCModule>(this);
81 }
82
63 public void Close() 83 public void Close()
64 { 84 {
65 } 85 }
@@ -69,15 +89,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
69 get { return "NPCModule"; } 89 get { return "NPCModule"; }
70 } 90 }
71 91
72 public bool IsSharedModule 92 public Type ReplaceableInterface { get { return null; } }
73 {
74 get { return true; }
75 }
76 93
77 public bool IsNPC(UUID agentId, Scene scene) 94 public bool IsNPC(UUID agentId, Scene scene)
78 { 95 {
79 // FIXME: This implementation could not just use the ScenePresence.PresenceType (and callers could inspect 96 // FIXME: This implementation could not just use the
80 // that directly). 97 // ScenePresence.PresenceType (and callers could inspect that
98 // directly).
81 ScenePresence sp = scene.GetScenePresence(agentId); 99 ScenePresence sp = scene.GetScenePresence(agentId);
82 if (sp == null || sp.IsChildAgent) 100 if (sp == null || sp.IsChildAgent)
83 return false; 101 return false;
@@ -86,7 +104,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
86 return m_avatars.ContainsKey(agentId); 104 return m_avatars.ContainsKey(agentId);
87 } 105 }
88 106
89 public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) 107 public bool SetNPCAppearance(UUID agentId,
108 AvatarAppearance appearance, Scene scene)
90 { 109 {
91 ScenePresence npc = scene.GetScenePresence(agentId); 110 ScenePresence npc = scene.GetScenePresence(agentId);
92 if (npc == null || npc.IsChildAgent) 111 if (npc == null || npc.IsChildAgent)
@@ -99,30 +118,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC
99 // Delete existing npc attachments 118 // Delete existing npc attachments
100 scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); 119 scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
101 120
102 // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments 121 // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet
103 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); 122 // since it doesn't transfer attachments
123 AvatarAppearance npcAppearance = new AvatarAppearance(appearance,
124 true);
104 npc.Appearance = npcAppearance; 125 npc.Appearance = npcAppearance;
105 126
106 // Rez needed npc attachments 127 // Rez needed npc attachments
107 scene.AttachmentsModule.RezAttachments(npc); 128 scene.AttachmentsModule.RezAttachments(npc);
108 129
109 IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>(); 130 IAvatarFactoryModule module =
131 scene.RequestModuleInterface<IAvatarFactoryModule>();
110 module.SendAppearance(npc.UUID); 132 module.SendAppearance(npc.UUID);
111 133
112 return true; 134 return true;
113 } 135 }
114 136
115 public UUID CreateNPC( 137 public UUID CreateNPC(string firstname, string lastname,
116 string firstname, 138 Vector3 position, UUID owner, bool senseAsAgent, Scene scene,
117 string lastname, 139 AvatarAppearance appearance)
118 Vector3 position,
119 UUID owner,
120 bool senseAsAgent,
121 Scene scene,
122 AvatarAppearance appearance)
123 { 140 {
124 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, owner, senseAsAgent, scene); 141 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position,
125 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue); 142 owner, senseAsAgent, scene);
143 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0,
144 int.MaxValue);
126 145
127// m_log.DebugFormat( 146// m_log.DebugFormat(
128// "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", 147// "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
@@ -134,15 +153,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC
134 acd.lastname = lastname; 153 acd.lastname = lastname;
135 acd.ServiceURLs = new Dictionary<string, object>(); 154 acd.ServiceURLs = new Dictionary<string, object>();
136 155
137 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); 156 AvatarAppearance npcAppearance = new AvatarAppearance(appearance,
157 true);
138 acd.Appearance = npcAppearance; 158 acd.Appearance = npcAppearance;
139 159
140// for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++) 160 /*
141// { 161 for (int i = 0;
142// m_log.DebugFormat( 162 i < acd.Appearance.Texture.FaceTextures.Length; i++)
143// "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}", 163 {
144// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); 164 m_log.DebugFormat(
145// } 165 "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}",
166 acd.AgentID, i,
167 acd.Appearance.Texture.FaceTextures[i]);
168 }
169 */
146 170
147 ManualResetEvent ev = new ManualResetEvent(false); 171 ManualResetEvent ev = new ManualResetEvent(false);
148 172
@@ -170,7 +194,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
170 return npcAvatar.AgentId; 194 return npcAvatar.AgentId;
171 } 195 }
172 196
173 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running) 197 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos,
198 bool noFly, bool landAtTarget, bool running)
174 { 199 {
175 lock (m_avatars) 200 lock (m_avatars)
176 { 201 {
@@ -185,7 +210,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
185 210
186 sp.MoveToTarget(pos, noFly, landAtTarget); 211 sp.MoveToTarget(pos, noFly, landAtTarget);
187 sp.SetAlwaysRun = running; 212 sp.SetAlwaysRun = running;
188 213
189 return true; 214 return true;
190 } 215 }
191 } 216 }
@@ -258,9 +283,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
258 ScenePresence sp; 283 ScenePresence sp;
259 if (scene.TryGetScenePresence(agentID, out sp)) 284 if (scene.TryGetScenePresence(agentID, out sp))
260 { 285 {
261 sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero); 286 sp.HandleAgentRequestSit(m_avatars[agentID], agentID,
262 // sp.HandleAgentSit(m_avatars[agentID], agentID); 287 partID, Vector3.Zero);
263 288 //sp.HandleAgentSit(m_avatars[agentID], agentID);
289
264 return true; 290 return true;
265 } 291 }
266 } 292 }
@@ -269,7 +295,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
269 return false; 295 return false;
270 } 296 }
271 297
272 public bool Whisper(UUID agentID, Scene scene, string text, int channel) 298 public bool Whisper(UUID agentID, Scene scene, string text,
299 int channel)
273 { 300 {
274 lock (m_avatars) 301 lock (m_avatars)
275 { 302 {
@@ -344,7 +371,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
344 NPCAvatar av; 371 NPCAvatar av;
345 if (m_avatars.TryGetValue(agentID, out av)) 372 if (m_avatars.TryGetValue(agentID, out av))
346 { 373 {
347// m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name); 374 /*
375 m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove",
376 agentID, av.Name);
377 */
348 scene.RemoveClient(agentID, false); 378 scene.RemoveClient(agentID, false);
349 m_avatars.Remove(agentID); 379 m_avatars.Remove(agentID);
350 380
@@ -352,8 +382,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
352 return true; 382 return true;
353 } 383 }
354 } 384 }
355 385 /*
356// m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID); 386 m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove",
387 agentID);
388 */
357 return false; 389 return false;
358 } 390 }
359 391
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 625eba4..b08233c 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -43,15 +43,20 @@ using OpenSim.Framework.Servers.HttpServer;
43using OpenSim.Region.Framework.Interfaces; 43using OpenSim.Region.Framework.Interfaces;
44using OpenSim.Region.Framework.Scenes; 44using OpenSim.Region.Framework.Scenes;
45using Mono.Data.SqliteClient; 45using Mono.Data.SqliteClient;
46using Mono.Addins;
46 47
47using Caps = OpenSim.Framework.Capabilities.Caps; 48using Caps = OpenSim.Framework.Capabilities.Caps;
48 49
49using OSD = OpenMetaverse.StructuredData.OSD; 50using OSD = OpenMetaverse.StructuredData.OSD;
50using OSDMap = OpenMetaverse.StructuredData.OSDMap; 51using OSDMap = OpenMetaverse.StructuredData.OSDMap;
51 52
53[assembly: Addin("WebStats", "1.0")]
54[assembly: AddinDependency("OpenSim", "0.5")]
55
52namespace OpenSim.Region.UserStatistics 56namespace OpenSim.Region.UserStatistics
53{ 57{
54 public class WebStatsModule : IRegionModule 58 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebStatsModule")]
59 public class WebStatsModule : ISharedRegionModule
55 { 60 {
56 private static readonly ILog m_log = 61 private static readonly ILog m_log =
57 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 62 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -74,59 +79,69 @@ namespace OpenSim.Region.UserStatistics
74 private string m_loglines = String.Empty; 79 private string m_loglines = String.Empty;
75 private volatile int lastHit = 12000; 80 private volatile int lastHit = 12000;
76 81
77 public virtual void Initialise(Scene scene, IConfigSource config) 82 #region ISharedRegionModule
83
84 public virtual void Initialise(IConfigSource config)
78 { 85 {
79 IConfig cnfg = config.Configs["WebStats"]; 86 IConfig cnfg = config.Configs["WebStats"];
80 87
81 if (cnfg != null) 88 if (cnfg != null)
82 enabled = cnfg.GetBoolean("enabled", false); 89 enabled = cnfg.GetBoolean("enabled", false);
83 90 }
91
92 public virtual void PostInitialise()
93 {
94 if (!enabled)
95 return;
96
97 AddEventHandlers();
98
99 if (Util.IsWindows())
100 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
101
102 //IConfig startupConfig = config.Configs["Startup"];
103
104 dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3");
105 dbConn.Open();
106 CreateTables(dbConn);
107
108 Prototype_distributor protodep = new Prototype_distributor();
109 Updater_distributor updatedep = new Updater_distributor();
110 ActiveConnectionsAJAX ajConnections = new ActiveConnectionsAJAX();
111 SimStatsAJAX ajSimStats = new SimStatsAJAX();
112 LogLinesAJAX ajLogLines = new LogLinesAJAX();
113 Default_Report defaultReport = new Default_Report();
114 Clients_report clientReport = new Clients_report();
115 Sessions_Report sessionsReport = new Sessions_Report();
116
117 reports.Add("prototype.js", protodep);
118 reports.Add("updater.js", updatedep);
119 reports.Add("activeconnectionsajax.html", ajConnections);
120 reports.Add("simstatsajax.html", ajSimStats);
121 reports.Add("activelogajax.html", ajLogLines);
122 reports.Add("default.report", defaultReport);
123 reports.Add("clients.report", clientReport);
124 reports.Add("sessions.report", sessionsReport);
125
126 ////
127 // Add Your own Reports here (Do Not Modify Lines here Devs!)
128 ////
129
130 ////
131 // End Own reports section
132 ////
133
134 MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest);
135 MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest);
136 }
137
138 public virtual void AddRegion(Scene scene)
139 {
84 if (!enabled) 140 if (!enabled)
85 return; 141 return;
86 142
87 lock (m_scenes) 143 lock (m_scenes)
88 { 144 {
89 if (m_scenes.Count == 0)
90 {
91 if (Util.IsWindows())
92 Util.LoadArchSpecificWindowsDll("sqlite3.dll");
93
94 //IConfig startupConfig = config.Configs["Startup"];
95
96 dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3");
97 dbConn.Open();
98 CreateTables(dbConn);
99
100 Prototype_distributor protodep = new Prototype_distributor();
101 Updater_distributor updatedep = new Updater_distributor();
102 ActiveConnectionsAJAX ajConnections = new ActiveConnectionsAJAX();
103 SimStatsAJAX ajSimStats = new SimStatsAJAX();
104 LogLinesAJAX ajLogLines = new LogLinesAJAX();
105 Default_Report defaultReport = new Default_Report();
106 Clients_report clientReport = new Clients_report();
107 Sessions_Report sessionsReport = new Sessions_Report();
108
109 reports.Add("prototype.js", protodep);
110 reports.Add("updater.js", updatedep);
111 reports.Add("activeconnectionsajax.html", ajConnections);
112 reports.Add("simstatsajax.html", ajSimStats);
113 reports.Add("activelogajax.html", ajLogLines);
114 reports.Add("default.report", defaultReport);
115 reports.Add("clients.report", clientReport);
116 reports.Add("sessions.report", sessionsReport);
117
118 ////
119 // Add Your own Reports here (Do Not Modify Lines here Devs!)
120 ////
121
122 ////
123 // End Own reports section
124 ////
125
126 MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest);
127 MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest);
128 }
129
130 m_scenes.Add(scene); 145 m_scenes.Add(scene);
131 if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID)) 146 if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID))
132 m_simstatsCounters.Remove(scene.RegionInfo.RegionID); 147 m_simstatsCounters.Remove(scene.RegionInfo.RegionID);
@@ -136,6 +151,39 @@ namespace OpenSim.Region.UserStatistics
136 } 151 }
137 } 152 }
138 153
154 public void RegionLoaded(Scene scene)
155 {
156 }
157
158 public void RemoveRegion(Scene scene)
159 {
160 }
161
162 public virtual void Close()
163 {
164 if (!enabled)
165 return;
166
167 dbConn.Close();
168 dbConn.Dispose();
169 m_sessions.Clear();
170 m_scenes.Clear();
171 reports.Clear();
172 m_simstatsCounters.Clear();
173 }
174
175 public virtual string Name
176 {
177 get { return "ViewerStatsModule"; }
178 }
179
180 public Type ReplaceableInterface
181 {
182 get { return null; }
183 }
184
185 #endregion
186
139 private void ReceiveClassicSimStatsPacket(SimStats stats) 187 private void ReceiveClassicSimStatsPacket(SimStats stats)
140 { 188 {
141 if (!enabled) 189 if (!enabled)
@@ -251,37 +299,6 @@ namespace OpenSim.Region.UserStatistics
251 } 299 }
252 } 300 }
253 301
254 public virtual void PostInitialise()
255 {
256 if (!enabled)
257 return;
258
259 AddHandlers();
260 }
261
262 public virtual void Close()
263 {
264 if (!enabled)
265 return;
266
267 dbConn.Close();
268 dbConn.Dispose();
269 m_sessions.Clear();
270 m_scenes.Clear();
271 reports.Clear();
272 m_simstatsCounters.Clear();
273 }
274
275 public virtual string Name
276 {
277 get { return "ViewerStatsModule"; }
278 }
279
280 public bool IsSharedModule
281 {
282 get { return true; }
283 }
284
285 private void OnRegisterCaps(UUID agentID, Caps caps) 302 private void OnRegisterCaps(UUID agentID, Caps caps)
286 { 303 {
287// m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 304// m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
@@ -302,7 +319,7 @@ namespace OpenSim.Region.UserStatistics
302 { 319 {
303 } 320 }
304 321
305 protected virtual void AddHandlers() 322 protected virtual void AddEventHandlers()
306 { 323 {
307 lock (m_scenes) 324 lock (m_scenes)
308 { 325 {
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index f9c1ac2..db0a7fc 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -385,6 +385,11 @@ namespace OpenSim.Tests.Common
385 385
386 foreach (IRegionModuleBase module in newModules) 386 foreach (IRegionModuleBase module in newModules)
387 { 387 {
388 if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise();
389 }
390
391 foreach (IRegionModuleBase module in newModules)
392 {
388 foreach (Scene scene in scenes) 393 foreach (Scene scene in scenes)
389 { 394 {
390 module.AddRegion(scene); 395 module.AddRegion(scene);
@@ -392,11 +397,6 @@ namespace OpenSim.Tests.Common
392 } 397 }
393 } 398 }
394 399
395 foreach (IRegionModuleBase module in newModules)
396 {
397 if (module is ISharedRegionModule) ((ISharedRegionModule)module).PostInitialise();
398 }
399
400 // RegionLoaded is fired after all modules have been appropriately added to all scenes 400 // RegionLoaded is fired after all modules have been appropriately added to all scenes
401 foreach (IRegionModuleBase module in newModules) 401 foreach (IRegionModuleBase module in newModules)
402 foreach (Scene scene in scenes) 402 foreach (Scene scene in scenes)