diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
133 files changed, 3017 insertions, 3112 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index 73d1f72..e973652 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs | |||
@@ -54,7 +54,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
54 | private Dictionary<UUID, AgentAssetTransactions> AgentTransactions = | 54 | private Dictionary<UUID, AgentAssetTransactions> AgentTransactions = |
55 | new Dictionary<UUID, AgentAssetTransactions>(); | 55 | new Dictionary<UUID, AgentAssetTransactions>(); |
56 | 56 | ||
57 | #region IRegionModule Members | 57 | #region Region Module interface |
58 | 58 | ||
59 | public void Initialise(IConfigSource source) | 59 | public void Initialise(IConfigSource source) |
60 | { | 60 | { |
diff --git a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs index bfe2a71..4b457b1 100644 --- a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs +++ b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Text; | 31 | using System.Text; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
@@ -36,13 +37,18 @@ using OpenSim.Region.Framework.Scenes; | |||
36 | 37 | ||
37 | namespace OpenSim.Region.CoreModules.Agent.IPBan | 38 | namespace OpenSim.Region.CoreModules.Agent.IPBan |
38 | { | 39 | { |
39 | public class IPBanModule : IRegionModule | 40 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "IPBanModule")] |
41 | public class IPBanModule : ISharedRegionModule | ||
40 | { | 42 | { |
41 | #region Implementation of IRegionModule | 43 | #region Implementation of ISharedRegionModule |
42 | 44 | ||
43 | private List<string> m_bans = new List<string>(); | 45 | private List<string> m_bans = new List<string>(); |
44 | 46 | ||
45 | public void Initialise(Scene scene, IConfigSource source) | 47 | public void Initialise(IConfigSource source) |
48 | { | ||
49 | } | ||
50 | |||
51 | public void AddRegion(Scene scene) | ||
46 | { | 52 | { |
47 | new SceneBanner(scene, m_bans); | 53 | new SceneBanner(scene, m_bans); |
48 | 54 | ||
@@ -50,7 +56,7 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan | |||
50 | { | 56 | { |
51 | foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans) | 57 | foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans) |
52 | { | 58 | { |
53 | if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) | 59 | if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) |
54 | m_bans.Add(ban.BannedHostIPMask); | 60 | m_bans.Add(ban.BannedHostIPMask); |
55 | if (!String.IsNullOrEmpty(ban.BannedHostNameMask)) | 61 | if (!String.IsNullOrEmpty(ban.BannedHostNameMask)) |
56 | m_bans.Add(ban.BannedHostNameMask); | 62 | m_bans.Add(ban.BannedHostNameMask); |
@@ -58,6 +64,14 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan | |||
58 | } | 64 | } |
59 | } | 65 | } |
60 | 66 | ||
67 | public void RemoveRegion(Scene scene) | ||
68 | { | ||
69 | } | ||
70 | |||
71 | public void RegionLoaded(Scene scene) | ||
72 | { | ||
73 | } | ||
74 | |||
61 | public void PostInitialise() | 75 | public void PostInitialise() |
62 | { | 76 | { |
63 | if (File.Exists("bans.txt")) | 77 | if (File.Exists("bans.txt")) |
@@ -80,9 +94,9 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan | |||
80 | get { return "IPBanModule"; } | 94 | get { return "IPBanModule"; } |
81 | } | 95 | } |
82 | 96 | ||
83 | public bool IsSharedModule | 97 | public Type ReplaceableInterface |
84 | { | 98 | { |
85 | get { return true; } | 99 | get { return null; } |
86 | } | 100 | } |
87 | 101 | ||
88 | #endregion | 102 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index a1a2501..3764685 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -32,6 +32,7 @@ using System.Reflection; | |||
32 | using System.Text; | 32 | using System.Text; |
33 | using System.Threading; | 33 | using System.Threading; |
34 | using log4net; | 34 | using log4net; |
35 | using Mono.Addins; | ||
35 | using Nini.Config; | 36 | using Nini.Config; |
36 | using OpenMetaverse; | 37 | using OpenMetaverse; |
37 | using OpenMetaverse.Imaging; | 38 | using OpenMetaverse.Imaging; |
@@ -45,7 +46,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
45 | { | 46 | { |
46 | public delegate void J2KDecodeDelegate(UUID assetID); | 47 | public delegate void J2KDecodeDelegate(UUID assetID); |
47 | 48 | ||
48 | public class J2KDecoderModule : IRegionModule, IJ2KDecoder | 49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "J2KDecoderModule")] |
50 | public class J2KDecoderModule : ISharedRegionModule, IJ2KDecoder | ||
49 | { | 51 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 53 | ||
@@ -55,27 +57,32 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
55 | private readonly Dictionary<UUID, List<DecodedCallback>> m_notifyList = new Dictionary<UUID, List<DecodedCallback>>(); | 57 | 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> | 58 | /// <summary>Cache that will store decoded JPEG2000 layer boundary data</summary> |
57 | private IImprovedAssetCache m_cache; | 59 | private IImprovedAssetCache m_cache; |
60 | private IImprovedAssetCache Cache | ||
61 | { | ||
62 | get | ||
63 | { | ||
64 | if (m_cache == null) | ||
65 | m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); | ||
66 | |||
67 | return m_cache; | ||
68 | } | ||
69 | } | ||
58 | /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary> | 70 | /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary> |
71 | private UUID m_CreatorID = UUID.Zero; | ||
59 | private Scene m_scene; | 72 | private Scene m_scene; |
60 | 73 | ||
61 | #region IRegionModule | 74 | #region ISharedRegionModule |
62 | 75 | ||
63 | private bool m_useCSJ2K = true; | 76 | private bool m_useCSJ2K = true; |
64 | 77 | ||
65 | public string Name { get { return "J2KDecoderModule"; } } | 78 | public string Name { get { return "J2KDecoderModule"; } } |
66 | public bool IsSharedModule { get { return true; } } | ||
67 | 79 | ||
68 | public J2KDecoderModule() | 80 | public J2KDecoderModule() |
69 | { | 81 | { |
70 | } | 82 | } |
71 | 83 | ||
72 | public void Initialise(Scene scene, IConfigSource source) | 84 | public void Initialise(IConfigSource source) |
73 | { | 85 | { |
74 | if (m_scene == null) | ||
75 | m_scene = scene; | ||
76 | |||
77 | scene.RegisterModuleInterface<IJ2KDecoder>(this); | ||
78 | |||
79 | IConfig startupConfig = source.Configs["Startup"]; | 86 | IConfig startupConfig = source.Configs["Startup"]; |
80 | if (startupConfig != null) | 87 | if (startupConfig != null) |
81 | { | 88 | { |
@@ -83,16 +90,42 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
83 | } | 90 | } |
84 | } | 91 | } |
85 | 92 | ||
93 | public void AddRegion(Scene scene) | ||
94 | { | ||
95 | if (m_scene == null) | ||
96 | { | ||
97 | m_scene = scene; | ||
98 | m_CreatorID = scene.RegionInfo.RegionID; | ||
99 | } | ||
100 | |||
101 | scene.RegisterModuleInterface<IJ2KDecoder>(this); | ||
102 | |||
103 | } | ||
104 | |||
105 | public void RemoveRegion(Scene scene) | ||
106 | { | ||
107 | if (m_scene == scene) | ||
108 | m_scene = null; | ||
109 | } | ||
110 | |||
86 | public void PostInitialise() | 111 | public void PostInitialise() |
87 | { | 112 | { |
88 | m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>(); | ||
89 | } | 113 | } |
90 | 114 | ||
91 | public void Close() | 115 | public void Close() |
92 | { | 116 | { |
93 | } | 117 | } |
94 | 118 | ||
95 | #endregion IRegionModule | 119 | public void RegionLoaded(Scene scene) |
120 | { | ||
121 | } | ||
122 | |||
123 | public Type ReplaceableInterface | ||
124 | { | ||
125 | get { return null; } | ||
126 | } | ||
127 | |||
128 | #endregion Region Module interface | ||
96 | 129 | ||
97 | #region IJ2KDecoder | 130 | #region IJ2KDecoder |
98 | 131 | ||
@@ -275,11 +308,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
275 | { | 308 | { |
276 | m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10)); | 309 | m_decodedCache.AddOrUpdate(AssetId, Layers, TimeSpan.FromMinutes(10)); |
277 | 310 | ||
278 | if (m_cache != null) | 311 | if (Cache != null) |
279 | { | 312 | { |
280 | string assetID = "j2kCache_" + AssetId.ToString(); | 313 | string assetID = "j2kCache_" + AssetId.ToString(); |
281 | 314 | ||
282 | AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_scene.RegionInfo.RegionID.ToString()); | 315 | AssetBase layerDecodeAsset = new AssetBase(assetID, assetID, (sbyte)AssetType.Notecard, m_CreatorID.ToString()); |
283 | layerDecodeAsset.Local = true; | 316 | layerDecodeAsset.Local = true; |
284 | layerDecodeAsset.Temporary = true; | 317 | layerDecodeAsset.Temporary = true; |
285 | 318 | ||
@@ -299,7 +332,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
299 | 332 | ||
300 | #endregion Serialize Layer Data | 333 | #endregion Serialize Layer Data |
301 | 334 | ||
302 | m_cache.Cache(layerDecodeAsset); | 335 | Cache.Cache(layerDecodeAsset); |
303 | } | 336 | } |
304 | } | 337 | } |
305 | 338 | ||
@@ -309,10 +342,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
309 | { | 342 | { |
310 | return true; | 343 | return true; |
311 | } | 344 | } |
312 | else if (m_cache != null) | 345 | else if (Cache != null) |
313 | { | 346 | { |
314 | string assetName = "j2kCache_" + AssetId.ToString(); | 347 | string assetName = "j2kCache_" + AssetId.ToString(); |
315 | AssetBase layerDecodeAsset = m_cache.Get(assetName); | 348 | AssetBase layerDecodeAsset = Cache.Get(assetName); |
316 | 349 | ||
317 | if (layerDecodeAsset != null) | 350 | if (layerDecodeAsset != null) |
318 | { | 351 | { |
@@ -324,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
324 | if (lines.Length == 0) | 357 | if (lines.Length == 0) |
325 | { | 358 | { |
326 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName); | 359 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (empty) " + assetName); |
327 | m_cache.Expire(assetName); | 360 | Cache.Expire(assetName); |
328 | return false; | 361 | return false; |
329 | } | 362 | } |
330 | 363 | ||
@@ -345,7 +378,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
345 | catch (FormatException) | 378 | catch (FormatException) |
346 | { | 379 | { |
347 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName); | 380 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (format) " + assetName); |
348 | m_cache.Expire(assetName); | 381 | Cache.Expire(assetName); |
349 | return false; | 382 | return false; |
350 | } | 383 | } |
351 | 384 | ||
@@ -356,7 +389,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
356 | else | 389 | else |
357 | { | 390 | { |
358 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName); | 391 | m_log.Warn("[J2KDecodeCache]: Expiring corrupted layer data (layout) " + assetName); |
359 | m_cache.Expire(assetName); | 392 | Cache.Expire(assetName); |
360 | return false; | 393 | return false; |
361 | } | 394 | } |
362 | } | 395 | } |
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index b8e2820..4299726 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs | |||
@@ -35,9 +35,12 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | 37 | ||
38 | using Mono.Addins; | ||
39 | |||
38 | namespace OpenSim.Region.CoreModules.Agent.Xfer | 40 | namespace OpenSim.Region.CoreModules.Agent.Xfer |
39 | { | 41 | { |
40 | public class XferModule : IRegionModule, IXfer | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XferModule")] |
43 | public class XferModule : INonSharedRegionModule, IXfer | ||
41 | { | 44 | { |
42 | private Scene m_scene; | 45 | private Scene m_scene; |
43 | private Dictionary<string, FileData> NewFiles = new Dictionary<string, FileData>(); | 46 | private Dictionary<string, FileData> NewFiles = new Dictionary<string, FileData>(); |
@@ -59,9 +62,13 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
59 | public int Count; | 62 | public int Count; |
60 | } | 63 | } |
61 | 64 | ||
62 | #region IRegionModule Members | 65 | #region INonSharedRegionModule Members |
66 | |||
67 | public void Initialise(IConfigSource config) | ||
68 | { | ||
69 | } | ||
63 | 70 | ||
64 | public void Initialise(Scene scene, IConfigSource config) | 71 | public void AddRegion(Scene scene) |
65 | { | 72 | { |
66 | m_scene = scene; | 73 | m_scene = scene; |
67 | m_scene.EventManager.OnNewClient += NewClient; | 74 | m_scene.EventManager.OnNewClient += NewClient; |
@@ -69,22 +76,30 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer | |||
69 | m_scene.RegisterModuleInterface<IXfer>(this); | 76 | m_scene.RegisterModuleInterface<IXfer>(this); |
70 | } | 77 | } |
71 | 78 | ||
72 | public void PostInitialise() | 79 | public void RemoveRegion(Scene scene) |
73 | { | 80 | { |
81 | m_scene.EventManager.OnNewClient -= NewClient; | ||
82 | |||
83 | m_scene.UnregisterModuleInterface<IXfer>(this); | ||
84 | m_scene = null; | ||
74 | } | 85 | } |
75 | 86 | ||
76 | public void Close() | 87 | public void RegionLoaded(Scene scene) |
77 | { | 88 | { |
78 | } | 89 | } |
79 | 90 | ||
80 | public string Name | 91 | public Type ReplaceableInterface |
81 | { | 92 | { |
82 | get { return "XferModule"; } | 93 | get { return null; } |
83 | } | 94 | } |
84 | 95 | ||
85 | public bool IsSharedModule | 96 | public void Close() |
86 | { | 97 | { |
87 | get { return false; } | 98 | } |
99 | |||
100 | public string Name | ||
101 | { | ||
102 | get { return "XferModule"; } | ||
88 | } | 103 | } |
89 | 104 | ||
90 | #endregion | 105 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index b1b7b27..e40caec 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using log4net; | 30 | using log4net; |
31 | using Mono.Addins; | ||
31 | using Nini.Config; | 32 | using Nini.Config; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
@@ -89,6 +90,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
89 | /// ExpirationTime = 60 | 90 | /// ExpirationTime = 60 |
90 | /// </code> | 91 | /// </code> |
91 | /// </example> | 92 | /// </example> |
93 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CenomeMemoryAssetCache")] | ||
92 | public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule | 94 | public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule |
93 | { | 95 | { |
94 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 96 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs index 7da5e7a..9742a5c 100644 --- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | |||
@@ -30,6 +30,7 @@ using System; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using Mono.Addins; | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
@@ -38,6 +39,7 @@ using OpenSim.Services.Interfaces; | |||
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.Asset | 40 | namespace OpenSim.Region.CoreModules.Asset |
40 | { | 41 | { |
42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CoreAssetCache")] | ||
41 | public class CoreAssetCache : ISharedRegionModule, IImprovedAssetCache | 43 | public class CoreAssetCache : ISharedRegionModule, IImprovedAssetCache |
42 | { | 44 | { |
43 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 8aa173a..8e800cb 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -49,12 +49,12 @@ using OpenSim.Region.Framework.Scenes; | |||
49 | using OpenSim.Services.Interfaces; | 49 | using OpenSim.Services.Interfaces; |
50 | 50 | ||
51 | 51 | ||
52 | [assembly: Addin("FlotsamAssetCache", "1.1")] | 52 | //[assembly: Addin("FlotsamAssetCache", "1.1")] |
53 | [assembly: AddinDependency("OpenSim", "0.5")] | 53 | //[assembly: AddinDependency("OpenSim", "0.5")] |
54 | 54 | ||
55 | namespace OpenSim.Region.CoreModules.Asset | 55 | namespace OpenSim.Region.CoreModules.Asset |
56 | { | 56 | { |
57 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 57 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FlotsamAssetCache")] |
58 | public class FlotsamAssetCache : ISharedRegionModule, IImprovedAssetCache, IAssetService | 58 | public class FlotsamAssetCache : ISharedRegionModule, IImprovedAssetCache, IAssetService |
59 | { | 59 | { |
60 | private static readonly ILog m_log = | 60 | private static readonly ILog m_log = |
@@ -222,10 +222,6 @@ namespace OpenSim.Region.CoreModules.Asset | |||
222 | scene.RegisterModuleInterface<IImprovedAssetCache>(this); | 222 | scene.RegisterModuleInterface<IImprovedAssetCache>(this); |
223 | m_Scenes.Add(scene); | 223 | m_Scenes.Add(scene); |
224 | 224 | ||
225 | if (m_AssetService == null) | ||
226 | { | ||
227 | m_AssetService = scene.RequestModuleInterface<IAssetService>(); | ||
228 | } | ||
229 | } | 225 | } |
230 | } | 226 | } |
231 | 227 | ||
@@ -240,6 +236,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
240 | 236 | ||
241 | public void RegionLoaded(Scene scene) | 237 | public void RegionLoaded(Scene scene) |
242 | { | 238 | { |
239 | if (m_Enabled && m_AssetService == null) | ||
240 | m_AssetService = scene.RequestModuleInterface<IAssetService>(); | ||
243 | } | 241 | } |
244 | 242 | ||
245 | //////////////////////////////////////////////////////////// | 243 | //////////////////////////////////////////////////////////// |
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs index 1365e69..9592ca0 100644 --- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs | |||
@@ -31,6 +31,7 @@ using System.IO; | |||
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using GlynnTucker.Cache; | 33 | using GlynnTucker.Cache; |
34 | using Mono.Addins; | ||
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
@@ -39,6 +40,7 @@ using OpenSim.Services.Interfaces; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.Asset | 41 | namespace OpenSim.Region.CoreModules.Asset |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GlynnTuckerAssetCache")] | ||
42 | public class GlynnTuckerAssetCache : ISharedRegionModule, IImprovedAssetCache | 44 | public class GlynnTuckerAssetCache : ISharedRegionModule, IImprovedAssetCache |
43 | { | 45 | { |
44 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index 1c2bfd0..0872cc8 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.Asset.Tests | |||
47 | /// At the moment we're only test the in-memory part of the FlotsamAssetCache. This is a considerable weakness. | 47 | /// At the moment we're only test the in-memory part of the FlotsamAssetCache. This is a considerable weakness. |
48 | /// </summary> | 48 | /// </summary> |
49 | [TestFixture] | 49 | [TestFixture] |
50 | public class FlotsamAssetCacheTests | 50 | public class FlotsamAssetCacheTests : OpenSimTestCase |
51 | { | 51 | { |
52 | protected TestScene m_scene; | 52 | protected TestScene m_scene; |
53 | protected FlotsamAssetCache m_cache; | 53 | protected FlotsamAssetCache m_cache; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 2a513e9..24170fc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -571,9 +571,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
571 | 571 | ||
572 | if (grp.HasGroupChanged) | 572 | if (grp.HasGroupChanged) |
573 | { | 573 | { |
574 | // m_log.DebugFormat( | 574 | m_log.DebugFormat( |
575 | // "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", | 575 | "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}", |
576 | // grp.UUID, grp.AttachmentPoint); | 576 | grp.UUID, grp.AttachmentPoint); |
577 | 577 | ||
578 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState); | 578 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState); |
579 | 579 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index b5b0082..0a69979 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -39,9 +39,12 @@ using OpenSim.Region.Framework.Interfaces; | |||
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | 41 | ||
42 | using Mono.Addins; | ||
43 | |||
42 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | 44 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory |
43 | { | 45 | { |
44 | public class AvatarFactoryModule : IAvatarFactoryModule, IRegionModule | 46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AvatarFactoryModule")] |
47 | public class AvatarFactoryModule : IAvatarFactoryModule, INonSharedRegionModule | ||
45 | { | 48 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 50 | ||
@@ -59,12 +62,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
59 | 62 | ||
60 | private object m_setAppearanceLock = new object(); | 63 | private object m_setAppearanceLock = new object(); |
61 | 64 | ||
62 | #region IRegionModule | 65 | #region Region Module interface |
63 | 66 | ||
64 | public void Initialise(Scene scene, IConfigSource config) | 67 | public void Initialise(IConfigSource config) |
65 | { | 68 | { |
66 | scene.RegisterModuleInterface<IAvatarFactoryModule>(this); | ||
67 | scene.EventManager.OnNewClient += SubscribeToClientEvents; | ||
68 | 69 | ||
69 | IConfig appearanceConfig = config.Configs["Appearance"]; | 70 | IConfig appearanceConfig = config.Configs["Appearance"]; |
70 | if (appearanceConfig != null) | 71 | if (appearanceConfig != null) |
@@ -74,11 +75,29 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
74 | // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); | 75 | // m_log.InfoFormat("[AVFACTORY] configured for {0} save and {1} send",m_savetime,m_sendtime); |
75 | } | 76 | } |
76 | 77 | ||
78 | } | ||
79 | |||
80 | public void AddRegion(Scene scene) | ||
81 | { | ||
77 | if (m_scene == null) | 82 | if (m_scene == null) |
78 | m_scene = scene; | 83 | m_scene = scene; |
84 | |||
85 | scene.RegisterModuleInterface<IAvatarFactoryModule>(this); | ||
86 | scene.EventManager.OnNewClient += SubscribeToClientEvents; | ||
79 | } | 87 | } |
80 | 88 | ||
81 | public void PostInitialise() | 89 | public void RemoveRegion(Scene scene) |
90 | { | ||
91 | if (scene == m_scene) | ||
92 | { | ||
93 | scene.UnregisterModuleInterface<IAvatarFactoryModule>(this); | ||
94 | scene.EventManager.OnNewClient -= SubscribeToClientEvents; | ||
95 | } | ||
96 | |||
97 | m_scene = null; | ||
98 | } | ||
99 | |||
100 | public void RegionLoaded(Scene scene) | ||
82 | { | 101 | { |
83 | m_updateTimer.Enabled = false; | 102 | m_updateTimer.Enabled = false; |
84 | m_updateTimer.AutoReset = true; | 103 | m_updateTimer.AutoReset = true; |
@@ -100,6 +119,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
100 | get { return false; } | 119 | get { return false; } |
101 | } | 120 | } |
102 | 121 | ||
122 | public Type ReplaceableInterface | ||
123 | { | ||
124 | get { return null; } | ||
125 | } | ||
126 | |||
127 | |||
103 | private void SubscribeToClientEvents(IClientAPI client) | 128 | private void SubscribeToClientEvents(IClientAPI client) |
104 | { | 129 | { |
105 | client.OnRequestWearables += Client_OnRequestWearables; | 130 | client.OnRequestWearables += Client_OnRequestWearables; |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 848b3bf..1830d41 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs | |||
@@ -39,7 +39,7 @@ using OpenSim.Tests.Common.Mock; | |||
39 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | 39 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory |
40 | { | 40 | { |
41 | [TestFixture] | 41 | [TestFixture] |
42 | public class AvatarFactoryModuleTests | 42 | public class AvatarFactoryModuleTests : OpenSimTestCase |
43 | { | 43 | { |
44 | /// <summary> | 44 | /// <summary> |
45 | /// Only partial right now since we don't yet test that it's ended up in the avatar appearance service. | 45 | /// Only partial right now since we don't yet test that it's ended up in the avatar appearance service. |
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index e4452fb..6d62ff0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using Mono.Addins; | ||
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
@@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; | |||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.Chat | 39 | namespace OpenSim.Region.CoreModules.Avatar.Chat |
39 | { | 40 | { |
41 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ChatModule")] | ||
40 | public class ChatModule : ISharedRegionModule | 42 | public class ChatModule : ISharedRegionModule |
41 | { | 43 | { |
42 | private static readonly ILog m_log = | 44 | private static readonly ILog m_log = |
@@ -186,6 +188,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
186 | { | 188 | { |
187 | string fromName = c.From; | 189 | string fromName = c.From; |
188 | UUID fromID = UUID.Zero; | 190 | UUID fromID = UUID.Zero; |
191 | UUID ownerID = UUID.Zero; | ||
189 | UUID targetID = c.TargetUUID; | 192 | UUID targetID = c.TargetUUID; |
190 | string message = c.Message; | 193 | string message = c.Message; |
191 | IScene scene = c.Scene; | 194 | IScene scene = c.Scene; |
@@ -208,12 +211,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
208 | fromPos = avatar.AbsolutePosition; | 211 | fromPos = avatar.AbsolutePosition; |
209 | fromName = avatar.Name; | 212 | fromName = avatar.Name; |
210 | fromID = c.Sender.AgentId; | 213 | fromID = c.Sender.AgentId; |
214 | ownerID = c.Sender.AgentId; | ||
211 | 215 | ||
212 | break; | 216 | break; |
213 | 217 | ||
214 | case ChatSourceType.Object: | 218 | case ChatSourceType.Object: |
215 | fromID = c.SenderUUID; | 219 | fromID = c.SenderUUID; |
216 | 220 | ||
221 | if (c.SenderObject != null && c.SenderObject is SceneObjectPart) | ||
222 | ownerID = ((SceneObjectPart)c.SenderObject).OwnerID; | ||
223 | |||
217 | break; | 224 | break; |
218 | } | 225 | } |
219 | 226 | ||
@@ -236,7 +243,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
236 | s.ForEachRootScenePresence( | 243 | s.ForEachRootScenePresence( |
237 | delegate(ScenePresence presence) | 244 | delegate(ScenePresence presence) |
238 | { | 245 | { |
239 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false)) | 246 | if (TrySendChatMessage( |
247 | presence, fromPos, regionPos, fromID, ownerID, fromName, c.Type, message, sourceType, false)) | ||
240 | receiverIDs.Add(presence.UUID); | 248 | receiverIDs.Add(presence.UUID); |
241 | } | 249 | } |
242 | ); | 250 | ); |
@@ -248,8 +256,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
248 | ScenePresence presence = s.GetScenePresence(targetID); | 256 | ScenePresence presence = s.GetScenePresence(targetID); |
249 | if (presence != null && !presence.IsChildAgent) | 257 | if (presence != null && !presence.IsChildAgent) |
250 | { | 258 | { |
251 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, ChatTypeEnum.Say, message, sourceType, true)) | 259 | if (TrySendChatMessage( |
252 | receiverIDs.Add(presence.UUID); | 260 | presence, fromPos, regionPos, fromID, ownerID, fromName, ChatTypeEnum.Say, message, sourceType, true)) |
261 | receiverIDs.Add(presence.UUID); | ||
253 | } | 262 | } |
254 | } | 263 | } |
255 | } | 264 | } |
@@ -305,9 +314,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
305 | (null != c.SenderObject) && | 314 | (null != c.SenderObject) && |
306 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 315 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) |
307 | return; | 316 | return; |
308 | 317 | ||
309 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 318 | client.SendChatMessage( |
310 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 319 | c.Message, (byte)cType, CenterOfRegion, fromName, fromID, fromID, |
320 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | ||
321 | |||
311 | receiverIDs.Add(client.AgentId); | 322 | receiverIDs.Add(client.AgentId); |
312 | }); | 323 | }); |
313 | 324 | ||
@@ -322,15 +333,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
322 | /// <param name="fromPos"></param> | 333 | /// <param name="fromPos"></param> |
323 | /// <param name="regionPos">/param> | 334 | /// <param name="regionPos">/param> |
324 | /// <param name="fromAgentID"></param> | 335 | /// <param name="fromAgentID"></param> |
336 | /// <param name='ownerID'> | ||
337 | /// Owner of the message. For at least some messages from objects, this has to be correctly filled with the owner's UUID. | ||
338 | /// This is the case for script error messages in viewer 3 since LLViewer change EXT-7762 | ||
339 | /// </param> | ||
325 | /// <param name="fromName"></param> | 340 | /// <param name="fromName"></param> |
326 | /// <param name="type"></param> | 341 | /// <param name="type"></param> |
327 | /// <param name="message"></param> | 342 | /// <param name="message"></param> |
328 | /// <param name="src"></param> | 343 | /// <param name="src"></param> |
329 | /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a | 344 | /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a |
330 | /// precondition</returns> | 345 | /// precondition</returns> |
331 | protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, | 346 | protected virtual bool TrySendChatMessage( |
332 | UUID fromAgentID, string fromName, ChatTypeEnum type, | 347 | ScenePresence presence, Vector3 fromPos, Vector3 regionPos, |
333 | string message, ChatSourceType src, bool ignoreDistance) | 348 | UUID fromAgentID, UUID ownerID, string fromName, ChatTypeEnum type, |
349 | string message, ChatSourceType src, bool ignoreDistance) | ||
334 | { | 350 | { |
335 | // don't send stuff to child agents | 351 | // don't send stuff to child agents |
336 | if (presence.IsChildAgent) return false; | 352 | if (presence.IsChildAgent) return false; |
@@ -353,10 +369,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
353 | } | 369 | } |
354 | 370 | ||
355 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView | 371 | // TODO: should change so the message is sent through the avatar rather than direct to the ClientView |
356 | presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, | 372 | presence.ControllingClient.SendChatMessage( |
357 | fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully); | 373 | message, (byte) type, fromPos, fromName, |
374 | fromAgentID, ownerID, (byte)src, (byte)ChatAudibleLevel.Fully); | ||
358 | 375 | ||
359 | return true; | 376 | return true; |
360 | } | 377 | } |
361 | } | 378 | } |
362 | } | 379 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index 3a91465..343cdb5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | |||
@@ -33,9 +33,12 @@ using OpenSim.Region.Framework.Interfaces; | |||
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | 35 | ||
36 | using Mono.Addins; | ||
37 | |||
36 | namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | 38 | namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule |
37 | { | 39 | { |
38 | public class CombatModule : IRegionModule | 40 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CombatModule")] |
41 | public class CombatModule : ISharedRegionModule | ||
39 | { | 42 | { |
40 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
41 | 44 | ||
@@ -54,7 +57,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
54 | /// </summary> | 57 | /// </summary> |
55 | /// <param name="scene"></param> | 58 | /// <param name="scene"></param> |
56 | /// <param name="config"></param> | 59 | /// <param name="config"></param> |
57 | public void Initialise(Scene scene, IConfigSource config) | 60 | public void Initialise(IConfigSource config) |
61 | { | ||
62 | } | ||
63 | |||
64 | public void AddRegion(Scene scene) | ||
58 | { | 65 | { |
59 | lock (m_scenel) | 66 | lock (m_scenel) |
60 | { | 67 | { |
@@ -72,6 +79,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
72 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | 79 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; |
73 | } | 80 | } |
74 | 81 | ||
82 | public void RemoveRegion(Scene scene) | ||
83 | { | ||
84 | if (m_scenel.ContainsKey(scene.RegionInfo.RegionHandle)) | ||
85 | m_scenel.Remove(scene.RegionInfo.RegionHandle); | ||
86 | |||
87 | scene.EventManager.OnAvatarKilled -= KillAvatar; | ||
88 | scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; | ||
89 | } | ||
90 | |||
91 | public void RegionLoaded(Scene scene) | ||
92 | { | ||
93 | } | ||
94 | |||
75 | public void PostInitialise() | 95 | public void PostInitialise() |
76 | { | 96 | { |
77 | } | 97 | } |
@@ -85,11 +105,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule | |||
85 | get { return "CombatModule"; } | 105 | get { return "CombatModule"; } |
86 | } | 106 | } |
87 | 107 | ||
88 | public bool IsSharedModule | 108 | public Type ReplaceableInterface |
89 | { | 109 | { |
90 | get { return true; } | 110 | get { return null; } |
91 | } | 111 | } |
92 | 112 | ||
113 | |||
93 | private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar) | 114 | private void KillAvatar(uint killerObjectLocalID, ScenePresence deadAvatar) |
94 | { | 115 | { |
95 | string deadAvatarMessage; | 116 | string deadAvatarMessage; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 325067c..d26907b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -32,6 +32,7 @@ using log4net; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using Mono.Addins; | ||
35 | 36 | ||
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
@@ -39,16 +40,27 @@ using OpenSim.Services.Interfaces; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.Avatar.Dialog | 41 | namespace OpenSim.Region.CoreModules.Avatar.Dialog |
41 | { | 42 | { |
42 | public class DialogModule : IRegionModule, IDialogModule | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DialogModule")] |
43 | { | 44 | public class DialogModule : IDialogModule, INonSharedRegionModule |
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 | 47 | ||
46 | protected Scene m_scene; | 48 | protected Scene m_scene; |
47 | 49 | ||
48 | public void Initialise(Scene scene, IConfigSource source) | 50 | public void Initialise(IConfigSource source) { } |
51 | |||
52 | public Type ReplaceableInterface { get { return null; } } | ||
53 | |||
54 | public void AddRegion(Scene scene) | ||
49 | { | 55 | { |
50 | m_scene = scene; | 56 | m_scene = scene; |
51 | m_scene.RegisterModuleInterface<IDialogModule>(this); | 57 | m_scene.RegisterModuleInterface<IDialogModule>(this); |
58 | } | ||
59 | |||
60 | public void RegionLoaded(Scene scene) | ||
61 | { | ||
62 | if (scene != m_scene) | ||
63 | return; | ||
52 | 64 | ||
53 | m_scene.AddCommand( | 65 | m_scene.AddCommand( |
54 | "Users", this, "alert", "alert <message>", | 66 | "Users", this, "alert", "alert <message>", |
@@ -56,46 +68,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
56 | HandleAlertConsoleCommand); | 68 | HandleAlertConsoleCommand); |
57 | 69 | ||
58 | m_scene.AddCommand( | 70 | m_scene.AddCommand( |
59 | "Users", this, "alert-user", "alert-user <first> <last> <message>", | 71 | "Users", this, "alert-user", |
72 | "alert-user <first> <last> <message>", | ||
60 | "Send an alert to a user", | 73 | "Send an alert to a user", |
61 | HandleAlertConsoleCommand); | 74 | HandleAlertConsoleCommand); |
62 | } | 75 | } |
63 | 76 | ||
64 | public void PostInitialise() {} | 77 | public void RemoveRegion(Scene scene) |
65 | public void Close() {} | 78 | { |
79 | if (scene != m_scene) | ||
80 | return; | ||
81 | |||
82 | m_scene.UnregisterModuleInterface<IDialogModule>(this); | ||
83 | } | ||
84 | |||
85 | public void Close() { } | ||
66 | public string Name { get { return "Dialog Module"; } } | 86 | public string Name { get { return "Dialog Module"; } } |
67 | public bool IsSharedModule { get { return false; } } | 87 | |
68 | |||
69 | public void SendAlertToUser(IClientAPI client, string message) | 88 | public void SendAlertToUser(IClientAPI client, string message) |
70 | { | 89 | { |
71 | SendAlertToUser(client, message, false); | 90 | SendAlertToUser(client, message, false); |
72 | } | 91 | } |
73 | 92 | ||
74 | public void SendAlertToUser(IClientAPI client, string message, bool modal) | 93 | public void SendAlertToUser(IClientAPI client, string message, |
94 | bool modal) | ||
75 | { | 95 | { |
76 | client.SendAgentAlertMessage(message, modal); | 96 | client.SendAgentAlertMessage(message, modal); |
77 | } | 97 | } |
78 | 98 | ||
79 | public void SendAlertToUser(UUID agentID, string message) | 99 | public void SendAlertToUser(UUID agentID, string message) |
80 | { | 100 | { |
81 | SendAlertToUser(agentID, message, false); | 101 | SendAlertToUser(agentID, message, false); |
82 | } | 102 | } |
83 | 103 | ||
84 | public void SendAlertToUser(UUID agentID, string message, bool modal) | 104 | public void SendAlertToUser(UUID agentID, string message, bool modal) |
85 | { | 105 | { |
86 | ScenePresence sp = m_scene.GetScenePresence(agentID); | 106 | ScenePresence sp = m_scene.GetScenePresence(agentID); |
87 | 107 | ||
88 | if (sp != null) | 108 | if (sp != null) |
89 | sp.ControllingClient.SendAgentAlertMessage(message, modal); | 109 | sp.ControllingClient.SendAgentAlertMessage(message, modal); |
90 | } | 110 | } |
91 | 111 | ||
92 | public void SendAlertToUser(string firstName, string lastName, string message, bool modal) | 112 | public void SendAlertToUser(string firstName, string lastName, |
113 | string message, bool modal) | ||
93 | { | 114 | { |
94 | ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); | 115 | ScenePresence presence = m_scene.GetScenePresence(firstName, |
116 | lastName); | ||
95 | if (presence != null) | 117 | if (presence != null) |
96 | presence.ControllingClient.SendAgentAlertMessage(message, modal); | 118 | { |
119 | presence.ControllingClient.SendAgentAlertMessage(message, | ||
120 | modal); | ||
121 | } | ||
97 | } | 122 | } |
98 | 123 | ||
99 | public void SendGeneralAlert(string message) | 124 | public void SendGeneralAlert(string message) |
100 | { | 125 | { |
101 | m_scene.ForEachRootClient(delegate(IClientAPI client) | 126 | m_scene.ForEachRootClient(delegate(IClientAPI client) |
@@ -104,11 +129,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
104 | }); | 129 | }); |
105 | } | 130 | } |
106 | 131 | ||
107 | public void SendDialogToUser( | 132 | public void SendDialogToUser(UUID avatarID, string objectName, |
108 | UUID avatarID, string objectName, UUID objectID, UUID ownerID, | 133 | UUID objectID, UUID ownerID, string message, UUID textureID, |
109 | string message, UUID textureID, int ch, string[] buttonlabels) | 134 | int ch, string[] buttonlabels) |
110 | { | 135 | { |
111 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerID); | 136 | UserAccount account = m_scene.UserAccountService.GetUserAccount( |
137 | m_scene.RegionInfo.ScopeID, ownerID); | ||
112 | string ownerFirstName, ownerLastName; | 138 | string ownerFirstName, ownerLastName; |
113 | if (account != null) | 139 | if (account != null) |
114 | { | 140 | { |
@@ -123,29 +149,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
123 | 149 | ||
124 | ScenePresence sp = m_scene.GetScenePresence(avatarID); | 150 | ScenePresence sp = m_scene.GetScenePresence(avatarID); |
125 | if (sp != null) | 151 | if (sp != null) |
126 | sp.ControllingClient.SendDialog( | 152 | { |
127 | objectName, objectID, ownerID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); | 153 | sp.ControllingClient.SendDialog(objectName, objectID, ownerID, |
154 | ownerFirstName, ownerLastName, message, textureID, ch, | ||
155 | buttonlabels); | ||
156 | } | ||
128 | } | 157 | } |
129 | 158 | ||
130 | public void SendUrlToUser( | 159 | public void SendUrlToUser(UUID avatarID, string objectName, |
131 | UUID avatarID, string objectName, UUID objectID, UUID ownerID, bool groupOwned, string message, string url) | 160 | UUID objectID, UUID ownerID, bool groupOwned, string message, |
161 | string url) | ||
132 | { | 162 | { |
133 | ScenePresence sp = m_scene.GetScenePresence(avatarID); | 163 | ScenePresence sp = m_scene.GetScenePresence(avatarID); |
134 | 164 | ||
135 | if (sp != null) | 165 | if (sp != null) |
136 | sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); | 166 | { |
167 | sp.ControllingClient.SendLoadURL(objectName, objectID, | ||
168 | ownerID, groupOwned, message, url); | ||
169 | } | ||
137 | } | 170 | } |
138 | 171 | ||
139 | public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) | 172 | public void SendTextBoxToUser(UUID avatarid, string message, |
173 | int chatChannel, string name, UUID objectid, UUID ownerid) | ||
140 | { | 174 | { |
141 | UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); | 175 | UserAccount account = m_scene.UserAccountService.GetUserAccount( |
176 | m_scene.RegionInfo.ScopeID, ownerid); | ||
142 | string ownerFirstName, ownerLastName; | 177 | string ownerFirstName, ownerLastName; |
143 | UUID ownerID = UUID.Zero; | 178 | UUID ownerID = UUID.Zero; |
144 | if (account != null) | 179 | if (account != null) |
145 | { | 180 | { |
146 | ownerFirstName = account.FirstName; | 181 | ownerFirstName = account.FirstName; |
147 | ownerLastName = account.LastName; | 182 | ownerLastName = account.LastName; |
148 | ownerID = account.PrincipalID; | 183 | ownerID = account.PrincipalID; |
149 | } | 184 | } |
150 | else | 185 | else |
151 | { | 186 | { |
@@ -154,29 +189,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
154 | } | 189 | } |
155 | 190 | ||
156 | ScenePresence sp = m_scene.GetScenePresence(avatarid); | 191 | ScenePresence sp = m_scene.GetScenePresence(avatarid); |
157 | 192 | ||
158 | if (sp != null) | 193 | if (sp != null) |
159 | sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerID, ownerFirstName, ownerLastName, objectid); | 194 | { |
195 | sp.ControllingClient.SendTextBoxRequest(message, chatChannel, | ||
196 | name, ownerID, ownerFirstName, ownerLastName, | ||
197 | objectid); | ||
198 | } | ||
160 | } | 199 | } |
161 | 200 | ||
162 | public void SendNotificationToUsersInRegion( | 201 | public void SendNotificationToUsersInRegion(UUID fromAvatarID, |
163 | UUID fromAvatarID, string fromAvatarName, string message) | 202 | string fromAvatarName, string message) |
164 | { | 203 | { |
165 | m_scene.ForEachRootClient(delegate(IClientAPI client) | 204 | m_scene.ForEachRootClient(delegate(IClientAPI client) |
166 | { | 205 | { |
167 | client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); | 206 | client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, |
207 | message); | ||
168 | }); | 208 | }); |
169 | } | 209 | } |
170 | 210 | ||
171 | /// <summary> | 211 | /// <summary> |
172 | /// Handle an alert command from the console. | 212 | /// Handle an alert command from the console. |
173 | /// </summary> | 213 | /// </summary> |
174 | /// <param name="module"></param> | 214 | /// <param name="module"></param> |
175 | /// <param name="cmdparams"></param> | 215 | /// <param name="cmdparams"></param> |
176 | public void HandleAlertConsoleCommand(string module, string[] cmdparams) | 216 | public void HandleAlertConsoleCommand(string module, |
217 | string[] cmdparams) | ||
177 | { | 218 | { |
178 | if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) | 219 | if (m_scene.ConsoleScene() != null && |
220 | m_scene.ConsoleScene() != m_scene) | ||
221 | { | ||
179 | return; | 222 | return; |
223 | } | ||
180 | 224 | ||
181 | string message = string.Empty; | 225 | string message = string.Empty; |
182 | 226 | ||
@@ -184,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
184 | { | 228 | { |
185 | message = CombineParams(cmdparams, 1); | 229 | message = CombineParams(cmdparams, 1); |
186 | m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", | 230 | m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", |
187 | m_scene.RegionInfo.RegionName, message); | 231 | m_scene.RegionInfo.RegionName, message); |
188 | SendGeneralAlert(message); | 232 | SendGeneralAlert(message); |
189 | } | 233 | } |
190 | else if (cmdparams.Length > 3) | 234 | else if (cmdparams.Length > 3) |
@@ -192,9 +236,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
192 | string firstName = cmdparams[1]; | 236 | string firstName = cmdparams[1]; |
193 | string lastName = cmdparams[2]; | 237 | string lastName = cmdparams[2]; |
194 | message = CombineParams(cmdparams, 3); | 238 | message = CombineParams(cmdparams, 3); |
195 | m_log.InfoFormat( | 239 | m_log.InfoFormat("[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", |
196 | "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", | 240 | m_scene.RegionInfo.RegionName, firstName, lastName, |
197 | m_scene.RegionInfo.RegionName, firstName, lastName, message); | 241 | message); |
198 | SendAlertToUser(firstName, lastName, message, false); | 242 | SendAlertToUser(firstName, lastName, message, false); |
199 | } | 243 | } |
200 | else | 244 | else |
@@ -212,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
212 | { | 256 | { |
213 | result += commandParams[i] + " "; | 257 | result += commandParams[i] + " "; |
214 | } | 258 | } |
215 | 259 | ||
216 | return result; | 260 | return result; |
217 | } | 261 | } |
218 | } | 262 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index f1903c3..8056030 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -35,6 +35,7 @@ using log4net; | |||
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using Mono.Addins; | ||
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Servers.HttpServer; | 40 | using OpenSim.Framework.Servers.HttpServer; |
40 | using OpenSim.Framework.Communications; | 41 | using OpenSim.Framework.Communications; |
@@ -50,6 +51,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
50 | 51 | ||
51 | namespace OpenSim.Region.CoreModules.Avatar.Friends | 52 | namespace OpenSim.Region.CoreModules.Avatar.Friends |
52 | { | 53 | { |
54 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FriendsModule")] | ||
53 | public class FriendsModule : ISharedRegionModule, IFriendsModule | 55 | public class FriendsModule : ISharedRegionModule, IFriendsModule |
54 | { | 56 | { |
55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 57 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 06f27e2..bf5c0bb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | |||
@@ -46,6 +46,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
46 | 46 | ||
47 | namespace OpenSim.Region.CoreModules.Avatar.Friends | 47 | namespace OpenSim.Region.CoreModules.Avatar.Friends |
48 | { | 48 | { |
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGFriendsModule")] | ||
49 | public class HGFriendsModule : FriendsModule, ISharedRegionModule, IFriendsModule, IFriendsSimConnector | 50 | public class HGFriendsModule : FriendsModule, ISharedRegionModule, IFriendsModule, IFriendsSimConnector |
50 | { | 51 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs index 7a197f7..961117e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs | |||
@@ -40,7 +40,7 @@ using OpenSim.Tests.Common.Mock; | |||
40 | namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests | 40 | namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests |
41 | { | 41 | { |
42 | [TestFixture] | 42 | [TestFixture] |
43 | public class FriendsModuleTests | 43 | public class FriendsModuleTests : OpenSimTestCase |
44 | { | 44 | { |
45 | private FriendsModule m_fm; | 45 | private FriendsModule m_fm; |
46 | private TestScene m_scene; | 46 | private TestScene m_scene; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs index 7df2beb..095c57b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.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 | ||
28 | using System; | ||
28 | using System.Reflection; | 29 | using System.Reflection; |
29 | using log4net; | 30 | using log4net; |
30 | using Nini.Config; | 31 | using Nini.Config; |
@@ -35,26 +36,46 @@ using OpenSim.Region.Framework.Interfaces; | |||
35 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
37 | 38 | ||
39 | using Mono.Addins; | ||
40 | |||
38 | namespace OpenSim.Region.CoreModules.Avatar.Gestures | 41 | namespace OpenSim.Region.CoreModules.Avatar.Gestures |
39 | { | 42 | { |
40 | public class GesturesModule : IRegionModule | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GesturesModule")] |
44 | public class GesturesModule : INonSharedRegionModule | ||
41 | { | 45 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
43 | 47 | ||
44 | protected Scene m_scene; | 48 | protected Scene m_scene; |
45 | 49 | ||
46 | public void Initialise(Scene scene, IConfigSource source) | 50 | public void Initialise(IConfigSource source) |
51 | { | ||
52 | } | ||
53 | |||
54 | public void AddRegion(Scene scene) | ||
47 | { | 55 | { |
48 | m_scene = scene; | 56 | m_scene = scene; |
49 | 57 | ||
50 | m_scene.EventManager.OnNewClient += OnNewClient; | 58 | m_scene.EventManager.OnNewClient += OnNewClient; |
51 | } | 59 | } |
60 | |||
61 | public void RegionLoaded(Scene scene) | ||
62 | { | ||
63 | } | ||
64 | |||
65 | public void RemoveRegion(Scene scene) | ||
66 | { | ||
67 | m_scene.EventManager.OnNewClient -= OnNewClient; | ||
68 | m_scene = null; | ||
69 | } | ||
52 | 70 | ||
53 | public void PostInitialise() {} | ||
54 | public void Close() {} | 71 | public void Close() {} |
55 | public string Name { get { return "Gestures Module"; } } | 72 | public string Name { get { return "Gestures Module"; } } |
56 | public bool IsSharedModule { get { return false; } } | 73 | |
57 | 74 | public Type ReplaceableInterface | |
75 | { | ||
76 | get { return null; } | ||
77 | } | ||
78 | |||
58 | private void OnNewClient(IClientAPI client) | 79 | private void OnNewClient(IClientAPI client) |
59 | { | 80 | { |
60 | client.OnActivateGesture += ActivateGesture; | 81 | client.OnActivateGesture += ActivateGesture; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 2e3312f..5a7446f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.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 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
@@ -32,29 +33,59 @@ using OpenSim.Framework; | |||
32 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | 35 | ||
36 | using Mono.Addins; | ||
37 | |||
35 | namespace OpenSim.Region.CoreModules.Avatar.Gods | 38 | namespace OpenSim.Region.CoreModules.Avatar.Gods |
36 | { | 39 | { |
37 | public class GodsModule : IRegionModule, IGodsModule | 40 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GodsModule")] |
41 | public class GodsModule : INonSharedRegionModule, IGodsModule | ||
38 | { | 42 | { |
39 | /// <summary>Special UUID for actions that apply to all agents</summary> | 43 | /// <summary>Special UUID for actions that apply to all agents</summary> |
40 | private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); | 44 | private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); |
41 | 45 | ||
42 | protected Scene m_scene; | 46 | protected Scene m_scene; |
43 | protected IDialogModule m_dialogModule; | 47 | protected IDialogModule m_dialogModule; |
44 | 48 | protected IDialogModule DialogModule | |
45 | public void Initialise(Scene scene, IConfigSource source) | 49 | { |
50 | get | ||
51 | { | ||
52 | if (m_dialogModule == null) | ||
53 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | ||
54 | |||
55 | return m_dialogModule; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | public void Initialise(IConfigSource source) | ||
60 | { | ||
61 | } | ||
62 | |||
63 | public void AddRegion(Scene scene) | ||
46 | { | 64 | { |
47 | m_scene = scene; | 65 | m_scene = scene; |
48 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | ||
49 | m_scene.RegisterModuleInterface<IGodsModule>(this); | 66 | m_scene.RegisterModuleInterface<IGodsModule>(this); |
50 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 67 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
51 | } | 68 | } |
52 | 69 | ||
53 | public void PostInitialise() {} | 70 | public void RemoveRegion(Scene scene) |
71 | { | ||
72 | m_scene.UnregisterModuleInterface<IGodsModule>(this); | ||
73 | m_scene.EventManager.OnNewClient -= SubscribeToClientEvents; | ||
74 | m_scene = null; | ||
75 | } | ||
76 | |||
77 | public void RegionLoaded(Scene scene) | ||
78 | { | ||
79 | } | ||
80 | |||
54 | public void Close() {} | 81 | public void Close() {} |
55 | public string Name { get { return "Gods Module"; } } | 82 | public string Name { get { return "Gods Module"; } } |
56 | public bool IsSharedModule { get { return false; } } | 83 | |
57 | 84 | public Type ReplaceableInterface | |
85 | { | ||
86 | get { return null; } | ||
87 | } | ||
88 | |||
58 | public void SubscribeToClientEvents(IClientAPI client) | 89 | public void SubscribeToClientEvents(IClientAPI client) |
59 | { | 90 | { |
60 | client.OnGodKickUser += KickUser; | 91 | client.OnGodKickUser += KickUser; |
@@ -96,8 +127,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
96 | } | 127 | } |
97 | else | 128 | else |
98 | { | 129 | { |
99 | if (m_dialogModule != null) | 130 | if (DialogModule != null) |
100 | m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); | 131 | DialogModule.SendAlertToUser(agentID, "Request for god powers denied"); |
101 | } | 132 | } |
102 | } | 133 | } |
103 | } | 134 | } |
@@ -162,20 +193,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
162 | if (kickflags == 1) | 193 | if (kickflags == 1) |
163 | { | 194 | { |
164 | sp.AllowMovement = false; | 195 | sp.AllowMovement = false; |
165 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | 196 | if (DialogModule != null) |
166 | m_dialogModule.SendAlertToUser(godID, "User Frozen"); | 197 | { |
198 | DialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
199 | DialogModule.SendAlertToUser(godID, "User Frozen"); | ||
200 | } | ||
167 | } | 201 | } |
168 | 202 | ||
169 | if (kickflags == 2) | 203 | if (kickflags == 2) |
170 | { | 204 | { |
171 | sp.AllowMovement = true; | 205 | sp.AllowMovement = true; |
172 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | 206 | if (DialogModule != null) |
173 | m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); | 207 | { |
208 | DialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
209 | DialogModule.SendAlertToUser(godID, "User Unfrozen"); | ||
210 | } | ||
174 | } | 211 | } |
175 | } | 212 | } |
176 | else | 213 | else |
177 | { | 214 | { |
178 | m_dialogModule.SendAlertToUser(godID, "Kick request denied"); | 215 | if (DialogModule != null) |
216 | DialogModule.SendAlertToUser(godID, "Kick request denied"); | ||
179 | } | 217 | } |
180 | } | 218 | } |
181 | } | 219 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs index b258e13..af54c1a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.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 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using log4net; | 31 | using log4net; |
@@ -34,9 +35,12 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
36 | 37 | ||
38 | using Mono.Addins; | ||
39 | |||
37 | namespace OpenSim.Region.CoreModules.Avatar.Groups | 40 | namespace OpenSim.Region.CoreModules.Avatar.Groups |
38 | { | 41 | { |
39 | public class GroupsModule : IRegionModule | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GroupsModule")] |
43 | public class GroupsModule : ISharedRegionModule | ||
40 | { | 44 | { |
41 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
42 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -55,9 +59,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
55 | private static GroupMembershipData osGroup = | 59 | private static GroupMembershipData osGroup = |
56 | new GroupMembershipData(); | 60 | new GroupMembershipData(); |
57 | 61 | ||
58 | #region IRegionModule Members | 62 | private bool m_Enabled = false; |
63 | |||
64 | #region ISharedRegionModule Members | ||
59 | 65 | ||
60 | public void Initialise(Scene scene, IConfigSource config) | 66 | public void Initialise(IConfigSource config) |
61 | { | 67 | { |
62 | IConfig groupsConfig = config.Configs["Groups"]; | 68 | IConfig groupsConfig = config.Configs["Groups"]; |
63 | 69 | ||
@@ -67,7 +73,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
67 | } | 73 | } |
68 | else | 74 | else |
69 | { | 75 | { |
70 | if (!groupsConfig.GetBoolean("Enabled", false)) | 76 | m_Enabled = groupsConfig.GetBoolean("Enabled", false); |
77 | if (!m_Enabled) | ||
71 | { | 78 | { |
72 | m_log.Info("[GROUPS]: Groups disabled in configuration"); | 79 | m_log.Info("[GROUPS]: Groups disabled in configuration"); |
73 | return; | 80 | return; |
@@ -77,6 +84,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
77 | return; | 84 | return; |
78 | } | 85 | } |
79 | 86 | ||
87 | } | ||
88 | |||
89 | public void AddRegion(Scene scene) | ||
90 | { | ||
91 | if (!m_Enabled) | ||
92 | return; | ||
93 | |||
80 | lock (m_SceneList) | 94 | lock (m_SceneList) |
81 | { | 95 | { |
82 | if (!m_SceneList.Contains(scene)) | 96 | if (!m_SceneList.Contains(scene)) |
@@ -96,7 +110,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
96 | 110 | ||
97 | scene.EventManager.OnNewClient += OnNewClient; | 111 | scene.EventManager.OnNewClient += OnNewClient; |
98 | scene.EventManager.OnClientClosed += OnClientClosed; | 112 | scene.EventManager.OnClientClosed += OnClientClosed; |
99 | // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 113 | // scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
114 | } | ||
115 | |||
116 | public void RemoveRegion(Scene scene) | ||
117 | { | ||
118 | if (!m_Enabled) | ||
119 | return; | ||
120 | |||
121 | lock (m_SceneList) | ||
122 | { | ||
123 | if (m_SceneList.Contains(scene)) | ||
124 | m_SceneList.Remove(scene); | ||
125 | } | ||
126 | |||
127 | scene.EventManager.OnNewClient -= OnNewClient; | ||
128 | scene.EventManager.OnClientClosed -= OnClientClosed; | ||
129 | } | ||
130 | |||
131 | public void RegionLoaded(Scene scene) | ||
132 | { | ||
100 | } | 133 | } |
101 | 134 | ||
102 | public void PostInitialise() | 135 | public void PostInitialise() |
@@ -105,6 +138,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
105 | 138 | ||
106 | public void Close() | 139 | public void Close() |
107 | { | 140 | { |
141 | if (!m_Enabled) | ||
142 | return; | ||
143 | |||
108 | // m_log.Debug("[GROUPS]: Shutting down group module."); | 144 | // m_log.Debug("[GROUPS]: Shutting down group module."); |
109 | 145 | ||
110 | lock (m_ClientMap) | 146 | lock (m_ClientMap) |
@@ -123,9 +159,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups | |||
123 | get { return "GroupsModule"; } | 159 | get { return "GroupsModule"; } |
124 | } | 160 | } |
125 | 161 | ||
126 | public bool IsSharedModule | 162 | public Type ReplaceableInterface |
127 | { | 163 | { |
128 | get { return true; } | 164 | get { return null; } |
129 | } | 165 | } |
130 | 166 | ||
131 | #endregion | 167 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index bf1d787..7bf19c2 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs | |||
@@ -48,7 +48,7 @@ using OpenSim.Server.Handlers.Hypergrid; | |||
48 | 48 | ||
49 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 49 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
50 | { | 50 | { |
51 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 51 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGMessageTransferModule")] |
52 | public class HGMessageTransferModule : ISharedRegionModule, IMessageTransferModule, IInstantMessageSimConnector | 52 | public class HGMessageTransferModule : ISharedRegionModule, IMessageTransferModule, IInstantMessageSimConnector |
53 | { | 53 | { |
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index ca5d485..c33a296 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -28,6 +28,7 @@ using System; | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using log4net; | 30 | using log4net; |
31 | using Mono.Addins; | ||
31 | using Nini.Config; | 32 | using Nini.Config; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; | |||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 39 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
39 | { | 40 | { |
41 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InstantMessageModule")] | ||
40 | public class InstantMessageModule : ISharedRegionModule | 42 | public class InstantMessageModule : ISharedRegionModule |
41 | { | 43 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger( | 44 | private static readonly ILog m_log = LogManager.GetLogger( |
@@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
49 | 51 | ||
50 | private readonly List<Scene> m_scenes = new List<Scene>(); | 52 | private readonly List<Scene> m_scenes = new List<Scene>(); |
51 | 53 | ||
52 | #region IRegionModule Members | 54 | #region Region Module interface |
53 | 55 | ||
54 | private IMessageTransferModule m_TransferModule = null; | 56 | private IMessageTransferModule m_TransferModule = null; |
55 | 57 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 596174b..3983369 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Addins; | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using Nwc.XmlRpc; | 35 | using Nwc.XmlRpc; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
@@ -43,6 +44,7 @@ using OpenSim.Services.Interfaces; | |||
43 | 44 | ||
44 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 45 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
45 | { | 46 | { |
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MessageTransferModule")] | ||
46 | public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule | 48 | public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule |
47 | { | 49 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs index 24cbaeb..7ce2813 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs | |||
@@ -29,6 +29,7 @@ using System.Collections.Generic; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using log4net; | 30 | using log4net; |
31 | using Nini.Config; | 31 | using Nini.Config; |
32 | using Mono.Addins; | ||
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
@@ -39,6 +40,7 @@ using OpenSim.Region.Framework.Scenes; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 41 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MuteListModule")] | ||
42 | public class MuteListModule : ISharedRegionModule | 44 | public class MuteListModule : ISharedRegionModule |
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); |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index de25048..4aaf1fe 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -28,6 +28,7 @@ using System; | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using log4net; | 30 | using log4net; |
31 | using Mono.Addins; | ||
31 | using Nini.Config; | 32 | using Nini.Config; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -39,6 +40,7 @@ using OpenSim.Region.Framework.Scenes; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 41 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "OfflineMessageModule")] | ||
42 | public class OfflineMessageModule : ISharedRegionModule | 44 | public class OfflineMessageModule : ISharedRegionModule |
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); |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs index dd17f3c..4c678c2 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs | |||
@@ -33,6 +33,7 @@ using log4net; | |||
33 | using Nini.Config; | 33 | using Nini.Config; |
34 | using Nwc.XmlRpc; | 34 | using Nwc.XmlRpc; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using Mono.Addins; | ||
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
@@ -42,6 +43,7 @@ using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | |||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | 44 | namespace OpenSim.Region.CoreModules.Avatar.InstantMessage |
44 | { | 45 | { |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PresenceModule")] | ||
45 | public class PresenceModule : ISharedRegionModule, IPresenceModule | 47 | public class PresenceModule : ISharedRegionModule, IPresenceModule |
46 | { | 48 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger( | 49 | private static readonly ILog m_log = LogManager.GetLogger( |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index ee10d04..5069803 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -411,18 +411,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
411 | { | 411 | { |
412 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); | 412 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); |
413 | 413 | ||
414 | item.CreatorIdAsUuid = ospResolvedId; | 414 | // item.CreatorIdAsUuid = ospResolvedId; |
415 | 415 | ||
416 | // Don't preserve the OSPA in the creator id (which actually gets persisted to the | 416 | // Don't preserve the OSPA in the creator id (which actually gets persisted to the |
417 | // database). Instead, replace with the UUID that we found. | 417 | // database). Instead, replace with the UUID that we found. |
418 | item.CreatorId = ospResolvedId.ToString(); | 418 | item.CreatorId = ospResolvedId.ToString(); |
419 | |||
420 | item.CreatorData = string.Empty; | 419 | item.CreatorData = string.Empty; |
421 | } | 420 | } |
422 | else if (item.CreatorData == null || item.CreatorData == String.Empty) | 421 | else if (item.CreatorData == null || item.CreatorData == String.Empty) |
423 | { | 422 | { |
424 | item.CreatorId = m_userInfo.PrincipalID.ToString(); | 423 | item.CreatorId = m_userInfo.PrincipalID.ToString(); |
425 | item.CreatorIdAsUuid = new UUID(item.CreatorId); | 424 | // item.CreatorIdAsUuid = new UUID(item.CreatorId); |
426 | } | 425 | } |
427 | 426 | ||
428 | item.Owner = m_userInfo.PrincipalID; | 427 | item.Owner = m_userInfo.PrincipalID; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 6587ead..d0e88f6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
166 | 166 | ||
167 | if (options.ContainsKey("verbose")) | 167 | if (options.ContainsKey("verbose")) |
168 | m_log.InfoFormat( | 168 | m_log.InfoFormat( |
169 | "[INVENTORY ARCHIVER]: Saving item {0} {1} with asset {2}", | 169 | "[INVENTORY ARCHIVER]: Saving item {0} {1} (asset UUID {2})", |
170 | inventoryItem.ID, inventoryItem.Name, inventoryItem.AssetID); | 170 | inventoryItem.ID, inventoryItem.Name, inventoryItem.AssetID); |
171 | 171 | ||
172 | string filename = path + CreateArchiveItemName(inventoryItem); | 172 | string filename = path + CreateArchiveItemName(inventoryItem); |
@@ -337,11 +337,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
337 | { | 337 | { |
338 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetUuids.Count); | 338 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetUuids.Count); |
339 | 339 | ||
340 | new AssetsRequest( | 340 | AssetsRequest ar |
341 | new AssetsArchiver(m_archiveWriter), | 341 | = new AssetsRequest( |
342 | m_assetUuids, m_scene.AssetService, | 342 | new AssetsArchiver(m_archiveWriter), |
343 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, | 343 | m_assetUuids, m_scene.AssetService, |
344 | options, ReceivedAllAssets).Execute(); | 344 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, |
345 | options, ReceivedAllAssets); | ||
346 | |||
347 | Util.FireAndForget(o => ar.Execute()); | ||
345 | } | 348 | } |
346 | else | 349 | else |
347 | { | 350 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index cf87010..849449b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -35,23 +35,22 @@ using Nini.Config; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
38 | using OpenSim.Framework.Console; | ||
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
42 | using Mono.Addins; | ||
41 | 43 | ||
42 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | 44 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver |
43 | { | 45 | { |
44 | /// <summary> | 46 | /// <summary> |
45 | /// This module loads and saves OpenSimulator inventory archives | 47 | /// This module loads and saves OpenSimulator inventory archives |
46 | /// </summary> | 48 | /// </summary> |
47 | public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule | 49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InventoryArchiverModule")] |
50 | public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule | ||
48 | { | 51 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 53 | ||
51 | public string Name { get { return "Inventory Archiver Module"; } } | ||
52 | |||
53 | public bool IsSharedModule { get { return true; } } | ||
54 | |||
55 | /// <value> | 54 | /// <value> |
56 | /// Enable or disable checking whether the iar user is actually logged in | 55 | /// Enable or disable checking whether the iar user is actually logged in |
57 | /// </value> | 56 | /// </value> |
@@ -98,9 +97,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
98 | // public InventoryArchiverModule(bool disablePresenceChecks) | 97 | // public InventoryArchiverModule(bool disablePresenceChecks) |
99 | // { | 98 | // { |
100 | // DisablePresenceChecks = disablePresenceChecks; | 99 | // DisablePresenceChecks = disablePresenceChecks; |
101 | // } | 100 | // } |
101 | |||
102 | #region ISharedRegionModule | ||
103 | |||
104 | public void Initialise(IConfigSource source) | ||
105 | { | ||
106 | } | ||
102 | 107 | ||
103 | public void Initialise(Scene scene, IConfigSource source) | 108 | public void AddRegion(Scene scene) |
104 | { | 109 | { |
105 | if (m_scenes.Count == 0) | 110 | if (m_scenes.Count == 0) |
106 | { | 111 | { |
@@ -143,10 +148,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
143 | m_scenes[scene.RegionInfo.RegionID] = scene; | 148 | m_scenes[scene.RegionInfo.RegionID] = scene; |
144 | } | 149 | } |
145 | 150 | ||
146 | public void PostInitialise() {} | 151 | public void RemoveRegion(Scene scene) |
152 | { | ||
153 | } | ||
147 | 154 | ||
148 | public void Close() {} | 155 | public void Close() {} |
149 | 156 | ||
157 | public void RegionLoaded(Scene scene) | ||
158 | { | ||
159 | } | ||
160 | |||
161 | public void PostInitialise() | ||
162 | { | ||
163 | } | ||
164 | |||
165 | public Type ReplaceableInterface | ||
166 | { | ||
167 | get { return null; } | ||
168 | } | ||
169 | |||
170 | public string Name { get { return "Inventory Archiver Module"; } } | ||
171 | |||
172 | #endregion | ||
173 | |||
150 | /// <summary> | 174 | /// <summary> |
151 | /// Trigger the inventory archive saved event. | 175 | /// Trigger the inventory archive saved event. |
152 | /// </summary> | 176 | /// </summary> |
@@ -209,6 +233,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
209 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, | 233 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, |
210 | Dictionary<string, object> options) | 234 | Dictionary<string, object> options) |
211 | { | 235 | { |
236 | // if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath)) | ||
237 | // return false; | ||
238 | |||
212 | if (m_scenes.Count > 0) | 239 | if (m_scenes.Count > 0) |
213 | { | 240 | { |
214 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 241 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index 1056865..db78da9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -82,7 +82,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
82 | 82 | ||
83 | protected string m_item1Name = "Ray Gun Item"; | 83 | protected string m_item1Name = "Ray Gun Item"; |
84 | protected string m_coaItemName = "Coalesced Item"; | 84 | protected string m_coaItemName = "Coalesced Item"; |
85 | 85 | ||
86 | [TestFixtureSetUp] | ||
87 | public void FixtureSetup() | ||
88 | { | ||
89 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
90 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
91 | |||
92 | ConstructDefaultIarBytesForTestLoad(); | ||
93 | } | ||
94 | |||
95 | [TestFixtureTearDown] | ||
96 | public void TearDown() | ||
97 | { | ||
98 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
99 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
100 | // tests really shouldn't). | ||
101 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
102 | } | ||
103 | |||
86 | [SetUp] | 104 | [SetUp] |
87 | public override void SetUp() | 105 | public override void SetUp() |
88 | { | 106 | { |
@@ -90,12 +108,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
90 | m_iarStream = new MemoryStream(m_iarStreamBytes); | 108 | m_iarStream = new MemoryStream(m_iarStreamBytes); |
91 | } | 109 | } |
92 | 110 | ||
93 | [TestFixtureSetUp] | ||
94 | public void FixtureSetup() | ||
95 | { | ||
96 | ConstructDefaultIarBytesForTestLoad(); | ||
97 | } | ||
98 | |||
99 | protected void ConstructDefaultIarBytesForTestLoad() | 111 | protected void ConstructDefaultIarBytesForTestLoad() |
100 | { | 112 | { |
101 | // log4net.Config.XmlConfigurator.Configure(); | 113 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -122,7 +134,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
122 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 134 | item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
123 | item1.AssetID = asset1.FullID; | 135 | item1.AssetID = asset1.FullID; |
124 | item1.GroupID = UUID.Random(); | 136 | item1.GroupID = UUID.Random(); |
125 | item1.CreatorIdAsUuid = m_uaLL1.PrincipalID; | 137 | item1.CreatorId = m_uaLL1.PrincipalID.ToString(); |
126 | item1.Owner = m_uaLL1.PrincipalID; | 138 | item1.Owner = m_uaLL1.PrincipalID; |
127 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | 139 | item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; |
128 | scene.AddInventoryItem(item1); | 140 | scene.AddInventoryItem(item1); |
@@ -145,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
145 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); | 157 | coaItem.ID = UUID.Parse("00000000-0000-0000-0000-000000000180"); |
146 | coaItem.AssetID = coaAsset.FullID; | 158 | coaItem.AssetID = coaAsset.FullID; |
147 | coaItem.GroupID = UUID.Random(); | 159 | coaItem.GroupID = UUID.Random(); |
148 | coaItem.CreatorIdAsUuid = m_uaLL1.PrincipalID; | 160 | coaItem.CreatorId = m_uaLL1.PrincipalID.ToString(); |
149 | coaItem.Owner = m_uaLL1.PrincipalID; | 161 | coaItem.Owner = m_uaLL1.PrincipalID; |
150 | coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; | 162 | coaItem.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID; |
151 | scene.AddInventoryItem(coaItem); | 163 | scene.AddInventoryItem(coaItem); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 12a05b3..06f6e49 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
49 | { | 49 | { |
50 | [TestFixture] | 50 | [TestFixture] |
51 | public class InventoryArchiverTests : InventoryArchiveTestCase | 51 | public class InventoryArchiverTests : InventoryArchiveTestCase |
52 | { | 52 | { |
53 | protected TestScene m_scene; | 53 | protected TestScene m_scene; |
54 | protected InventoryArchiverModule m_archiverModule; | 54 | protected InventoryArchiverModule m_archiverModule; |
55 | 55 | ||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
69 | public void TestLoadCoalesecedItem() | 69 | public void TestLoadCoalesecedItem() |
70 | { | 70 | { |
71 | TestHelpers.InMethod(); | 71 | TestHelpers.InMethod(); |
72 | // log4net.Config.XmlConfigurator.Configure(); | 72 | // TestHelpers.EnableLogging(); |
73 | 73 | ||
74 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | 74 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); |
75 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | 75 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 33b4839..582aac4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -38,20 +39,21 @@ using OpenSim.Services.Interfaces; | |||
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | 40 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer |
40 | { | 41 | { |
41 | public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InventoryTransferModule")] |
43 | public class InventoryTransferModule : ISharedRegionModule | ||
42 | { | 44 | { |
43 | private static readonly ILog m_log | 45 | private static readonly ILog m_log |
44 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 47 | ||
46 | /// <summary> | 48 | /// <summary> |
47 | private List<Scene> m_Scenelist = new List<Scene>(); | 49 | private List<Scene> m_Scenelist = new List<Scene>(); |
48 | private Dictionary<UUID, Scene> m_AgentRegions = | 50 | // private Dictionary<UUID, Scene> m_AgentRegions = |
49 | new Dictionary<UUID, Scene>(); | 51 | // new Dictionary<UUID, Scene>(); |
50 | 52 | ||
51 | private IMessageTransferModule m_TransferModule = null; | 53 | private IMessageTransferModule m_TransferModule = null; |
52 | private bool m_Enabled = true; | 54 | private bool m_Enabled = true; |
53 | 55 | ||
54 | #region IRegionModule Members | 56 | #region Region Module interface |
55 | 57 | ||
56 | public void Initialise(IConfigSource config) | 58 | public void Initialise(IConfigSource config) |
57 | { | 59 | { |
@@ -76,12 +78,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
76 | 78 | ||
77 | m_Scenelist.Add(scene); | 79 | m_Scenelist.Add(scene); |
78 | 80 | ||
79 | scene.RegisterModuleInterface<IInventoryTransferModule>(this); | 81 | // scene.RegisterModuleInterface<IInventoryTransferModule>(this); |
80 | 82 | ||
81 | scene.EventManager.OnNewClient += OnNewClient; | 83 | scene.EventManager.OnNewClient += OnNewClient; |
82 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 84 | // scene.EventManager.OnClientClosed += ClientLoggedOut; |
83 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 85 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
84 | scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; | 86 | // scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; |
85 | } | 87 | } |
86 | 88 | ||
87 | public void RegionLoaded(Scene scene) | 89 | public void RegionLoaded(Scene scene) |
@@ -96,9 +98,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
96 | 98 | ||
97 | m_Scenelist.Clear(); | 99 | m_Scenelist.Clear(); |
98 | scene.EventManager.OnNewClient -= OnNewClient; | 100 | scene.EventManager.OnNewClient -= OnNewClient; |
99 | scene.EventManager.OnClientClosed -= ClientLoggedOut; | 101 | // scene.EventManager.OnClientClosed -= ClientLoggedOut; |
100 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | 102 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; |
101 | scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; | 103 | // scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; |
102 | } | 104 | } |
103 | } | 105 | } |
104 | } | 106 | } |
@@ -106,9 +108,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
106 | public void RemoveRegion(Scene scene) | 108 | public void RemoveRegion(Scene scene) |
107 | { | 109 | { |
108 | scene.EventManager.OnNewClient -= OnNewClient; | 110 | scene.EventManager.OnNewClient -= OnNewClient; |
109 | scene.EventManager.OnClientClosed -= ClientLoggedOut; | 111 | // scene.EventManager.OnClientClosed -= ClientLoggedOut; |
110 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | 112 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; |
111 | scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; | 113 | // scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; |
112 | m_Scenelist.Remove(scene); | 114 | m_Scenelist.Remove(scene); |
113 | } | 115 | } |
114 | 116 | ||
@@ -138,10 +140,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
138 | client.OnInstantMessage += OnInstantMessage; | 140 | client.OnInstantMessage += OnInstantMessage; |
139 | } | 141 | } |
140 | 142 | ||
141 | protected void OnSetRootAgentScene(UUID id, Scene scene) | 143 | // protected void OnSetRootAgentScene(UUID id, Scene scene) |
142 | { | 144 | // { |
143 | m_AgentRegions[id] = scene; | 145 | // m_AgentRegions[id] = scene; |
144 | } | 146 | // } |
145 | 147 | ||
146 | private Scene FindClientScene(UUID agentId) | 148 | private Scene FindClientScene(UUID agentId) |
147 | { | 149 | { |
@@ -298,73 +300,76 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
298 | } | 300 | } |
299 | } | 301 | } |
300 | 302 | ||
301 | // XXX: This code was placed here to try and accomdate RLV which moves given folders named #RLV/~<name> | 303 | // Disabled for now as it looks like http://opensimulator.org/mantis/view.php?id=6311 was fixed by fixes |
302 | // to a folder called name in #RLV. However, this approach may not be ultimately correct - from analysis | 304 | // to inventory folder versioning allowing the viewer to move the received folder itself as happens on the |
303 | // of Firestorm 4.2.2 on sending an InventoryOffered instead of TaskInventoryOffered (as was previously | 305 | // LL grid. Doing it again server-side then wrongly does a second create and move |
304 | // done), the viewer itself would appear to move and rename the folder, rather than the simulator doing it here. | 306 | // // XXX: This code was placed here to try and accomdate RLV which moves given folders named #RLV/~<name> |
305 | else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | 307 | // // to a folder called name in #RLV. However, this approach may not be ultimately correct - from analysis |
306 | { | 308 | // // of Firestorm 4.2.2 on sending an InventoryOffered instead of TaskInventoryOffered (as was previously |
307 | UUID destinationFolderID = UUID.Zero; | 309 | // // done), the viewer itself would appear to move and rename the folder, rather than the simulator doing it here. |
308 | 310 | // else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) | |
309 | if (im.binaryBucket != null && im.binaryBucket.Length >= 16) | 311 | // { |
310 | { | 312 | // UUID destinationFolderID = UUID.Zero; |
311 | destinationFolderID = new UUID(im.binaryBucket, 0); | 313 | // |
312 | } | 314 | // if (im.binaryBucket != null && im.binaryBucket.Length >= 16) |
313 | 315 | // { | |
314 | if (destinationFolderID != UUID.Zero) | 316 | // destinationFolderID = new UUID(im.binaryBucket, 0); |
315 | { | 317 | // } |
316 | InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId); | 318 | // |
317 | if (destinationFolder == null) | 319 | // if (destinationFolderID != UUID.Zero) |
318 | { | 320 | // { |
319 | m_log.WarnFormat( | 321 | // InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId); |
320 | "[INVENTORY TRANSFER]: TaskInventoryAccepted message from {0} in {1} specified folder {2} which does not exist", | 322 | // if (destinationFolder == null) |
321 | client.Name, scene.Name, destinationFolderID); | 323 | // { |
322 | 324 | // m_log.WarnFormat( | |
323 | return; | 325 | // "[INVENTORY TRANSFER]: TaskInventoryAccepted message from {0} in {1} specified folder {2} which does not exist", |
324 | } | 326 | // client.Name, scene.Name, destinationFolderID); |
325 | 327 | // | |
326 | IInventoryService invService = scene.InventoryService; | 328 | // return; |
327 | 329 | // } | |
328 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | 330 | // |
329 | 331 | // IInventoryService invService = scene.InventoryService; | |
330 | InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); | 332 | // |
331 | item = invService.GetItem(item); | 333 | // UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip |
332 | InventoryFolderBase folder = null; | 334 | // |
333 | UUID? previousParentFolderID = null; | 335 | // InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); |
334 | 336 | // item = invService.GetItem(item); | |
335 | if (item != null) // It's an item | 337 | // InventoryFolderBase folder = null; |
336 | { | 338 | // UUID? previousParentFolderID = null; |
337 | previousParentFolderID = item.Folder; | 339 | // |
338 | item.Folder = destinationFolderID; | 340 | // if (item != null) // It's an item |
339 | 341 | // { | |
340 | invService.DeleteItems(item.Owner, new List<UUID>() { item.ID }); | 342 | // previousParentFolderID = item.Folder; |
341 | scene.AddInventoryItem(client, item); | 343 | // item.Folder = destinationFolderID; |
342 | } | 344 | // |
343 | else | 345 | // invService.DeleteItems(item.Owner, new List<UUID>() { item.ID }); |
344 | { | 346 | // scene.AddInventoryItem(client, item); |
345 | folder = new InventoryFolderBase(inventoryID, client.AgentId); | 347 | // } |
346 | folder = invService.GetFolder(folder); | 348 | // else |
347 | 349 | // { | |
348 | if (folder != null) // It's a folder | 350 | // folder = new InventoryFolderBase(inventoryID, client.AgentId); |
349 | { | 351 | // folder = invService.GetFolder(folder); |
350 | previousParentFolderID = folder.ParentID; | 352 | // |
351 | folder.ParentID = destinationFolderID; | 353 | // if (folder != null) // It's a folder |
352 | invService.MoveFolder(folder); | 354 | // { |
353 | } | 355 | // previousParentFolderID = folder.ParentID; |
354 | } | 356 | // folder.ParentID = destinationFolderID; |
355 | 357 | // invService.MoveFolder(folder); | |
356 | // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). | 358 | // } |
357 | if (previousParentFolderID != null) | 359 | // } |
358 | { | 360 | // |
359 | InventoryFolderBase previousParentFolder | 361 | // // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). |
360 | = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); | 362 | // if (previousParentFolderID != null) |
361 | previousParentFolder = invService.GetFolder(previousParentFolder); | 363 | // { |
362 | scene.SendInventoryUpdate(client, previousParentFolder, true, true); | 364 | // InventoryFolderBase previousParentFolder |
363 | 365 | // = new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId); | |
364 | scene.SendInventoryUpdate(client, destinationFolder, true, true); | 366 | // previousParentFolder = invService.GetFolder(previousParentFolder); |
365 | } | 367 | // scene.SendInventoryUpdate(client, previousParentFolder, true, true); |
366 | } | 368 | // |
367 | } | 369 | // scene.SendInventoryUpdate(client, destinationFolder, true, true); |
370 | // } | ||
371 | // } | ||
372 | // } | ||
368 | else if ( | 373 | else if ( |
369 | im.dialog == (byte)InstantMessageDialog.InventoryDeclined | 374 | im.dialog == (byte)InstantMessageDialog.InventoryDeclined |
370 | || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) | 375 | || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) |
@@ -434,83 +439,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
434 | scene.SendInventoryUpdate(client, trashFolder, true, true); | 439 | scene.SendInventoryUpdate(client, trashFolder, true, true); |
435 | } | 440 | } |
436 | 441 | ||
437 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); | 442 | if (im.dialog == (byte)InstantMessageDialog.InventoryDeclined) |
438 | |||
439 | if (user != null) // Local | ||
440 | { | ||
441 | user.ControllingClient.SendInstantMessage(im); | ||
442 | } | ||
443 | else | ||
444 | { | ||
445 | if (m_TransferModule != null) | ||
446 | m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); | ||
447 | } | ||
448 | } | ||
449 | } | ||
450 | |||
451 | public bool NeedSceneCacheClear(UUID agentID, Scene scene) | ||
452 | { | ||
453 | if (!m_AgentRegions.ContainsKey(agentID)) | ||
454 | { | ||
455 | // Since we can get here two ways, we need to scan | ||
456 | // the scenes here. This is somewhat more expensive | ||
457 | // but helps avoid a nasty bug | ||
458 | // | ||
459 | |||
460 | foreach (Scene s in m_Scenelist) | ||
461 | { | 443 | { |
462 | ScenePresence presence; | 444 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
463 | 445 | ||
464 | if (s.TryGetScenePresence(agentID, out presence)) | 446 | if (user != null) // Local |
465 | { | 447 | { |
466 | // If the agent is in this scene, then we | 448 | user.ControllingClient.SendInstantMessage(im); |
467 | // are being called twice in a single | 449 | } |
468 | // teleport. This is wasteful of cycles | 450 | else |
469 | // but harmless due to this 2nd level check | 451 | { |
470 | // | 452 | if (m_TransferModule != null) |
471 | // If the agent is found in another scene | 453 | m_TransferModule.SendInstantMessage(im, delegate(bool success) { }); |
472 | // then the list wasn't current | ||
473 | // | ||
474 | // If the agent is totally unknown, then what | ||
475 | // are we even doing here?? | ||
476 | // | ||
477 | if (s == scene) | ||
478 | { | ||
479 | //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName); | ||
480 | return true; | ||
481 | } | ||
482 | else | ||
483 | { | ||
484 | //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName); | ||
485 | return false; | ||
486 | } | ||
487 | } | 454 | } |
488 | } | 455 | } |
489 | //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName); | ||
490 | return true; | ||
491 | } | ||
492 | |||
493 | // The agent is left in current Scene, so we must be | ||
494 | // going to another instance | ||
495 | // | ||
496 | if (m_AgentRegions[agentID] == scene) | ||
497 | { | ||
498 | //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName); | ||
499 | m_AgentRegions.Remove(agentID); | ||
500 | return true; | ||
501 | } | 456 | } |
502 | |||
503 | // Another region has claimed the agent | ||
504 | // | ||
505 | //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName); | ||
506 | return false; | ||
507 | } | 457 | } |
508 | 458 | ||
509 | public void ClientLoggedOut(UUID agentID, Scene scene) | 459 | // public bool NeedSceneCacheClear(UUID agentID, Scene scene) |
510 | { | 460 | // { |
511 | if (m_AgentRegions.ContainsKey(agentID)) | 461 | // if (!m_AgentRegions.ContainsKey(agentID)) |
512 | m_AgentRegions.Remove(agentID); | 462 | // { |
513 | } | 463 | // // Since we can get here two ways, we need to scan |
464 | // // the scenes here. This is somewhat more expensive | ||
465 | // // but helps avoid a nasty bug | ||
466 | // // | ||
467 | // | ||
468 | // foreach (Scene s in m_Scenelist) | ||
469 | // { | ||
470 | // ScenePresence presence; | ||
471 | // | ||
472 | // if (s.TryGetScenePresence(agentID, out presence)) | ||
473 | // { | ||
474 | // // If the agent is in this scene, then we | ||
475 | // // are being called twice in a single | ||
476 | // // teleport. This is wasteful of cycles | ||
477 | // // but harmless due to this 2nd level check | ||
478 | // // | ||
479 | // // If the agent is found in another scene | ||
480 | // // then the list wasn't current | ||
481 | // // | ||
482 | // // If the agent is totally unknown, then what | ||
483 | // // are we even doing here?? | ||
484 | // // | ||
485 | // if (s == scene) | ||
486 | // { | ||
487 | // //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName); | ||
488 | // return true; | ||
489 | // } | ||
490 | // else | ||
491 | // { | ||
492 | // //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName); | ||
493 | // return false; | ||
494 | // } | ||
495 | // } | ||
496 | // } | ||
497 | // //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName); | ||
498 | // return true; | ||
499 | // } | ||
500 | // | ||
501 | // // The agent is left in current Scene, so we must be | ||
502 | // // going to another instance | ||
503 | // // | ||
504 | // if (m_AgentRegions[agentID] == scene) | ||
505 | // { | ||
506 | // //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName); | ||
507 | // m_AgentRegions.Remove(agentID); | ||
508 | // return true; | ||
509 | // } | ||
510 | // | ||
511 | // // Another region has claimed the agent | ||
512 | // // | ||
513 | // //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName); | ||
514 | // return false; | ||
515 | // } | ||
516 | // | ||
517 | // public void ClientLoggedOut(UUID agentID, Scene scene) | ||
518 | // { | ||
519 | // if (m_AgentRegions.ContainsKey(agentID)) | ||
520 | // m_AgentRegions.Remove(agentID); | ||
521 | // } | ||
514 | 522 | ||
515 | /// <summary> | 523 | /// <summary> |
516 | /// | 524 | /// |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs index 9c369f6..232a4fe 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | |||
@@ -42,7 +42,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
42 | 42 | ||
43 | namespace OpenSim.Region.CoreModules.Avatar.Lure | 43 | namespace OpenSim.Region.CoreModules.Avatar.Lure |
44 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGLureModule")] |
46 | public class HGLureModule : ISharedRegionModule | 46 | public class HGLureModule : ISharedRegionModule |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger( | 48 | private static readonly ILog m_log = LogManager.GetLogger( |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index 6ce9556..e4b0cfa 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; | |||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.Lure | 39 | namespace OpenSim.Region.CoreModules.Avatar.Lure |
39 | { | 40 | { |
41 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LureModule")] | ||
40 | public class LureModule : ISharedRegionModule | 42 | public class LureModule : ISharedRegionModule |
41 | { | 43 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger( | 44 | private static readonly ILog m_log = LogManager.GetLogger( |
diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index 87ca327..bf24030 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | |||
@@ -42,7 +42,7 @@ using OpenSim.Services.Interfaces; | |||
42 | 42 | ||
43 | namespace OpenSim.Region.CoreModules.Avatar.Profile | 43 | namespace OpenSim.Region.CoreModules.Avatar.Profile |
44 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicProfileModule")] |
46 | public class BasicProfileModule : IProfileModule, ISharedRegionModule | 46 | public class BasicProfileModule : IProfileModule, ISharedRegionModule |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 4ea85a8..8329af0 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -43,7 +43,7 @@ using Caps=OpenSim.Framework.Capabilities.Caps; | |||
43 | 43 | ||
44 | namespace OpenSim.Region.CoreModules.Framework | 44 | namespace OpenSim.Region.CoreModules.Framework |
45 | { | 45 | { |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CapabilitiesModule")] |
47 | public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule | 47 | public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 90fe430..3cb1901 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -43,9 +43,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
43 | using OpenMetaverse; | 43 | using OpenMetaverse; |
44 | using log4net; | 44 | using log4net; |
45 | using Nini.Config; | 45 | using Nini.Config; |
46 | using Mono.Addins; | ||
46 | 47 | ||
47 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | 48 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer |
48 | { | 49 | { |
50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EntityTransferModule")] | ||
49 | public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule | 51 | public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule |
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); |
@@ -672,13 +674,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
672 | sp.Reset(); | 674 | sp.Reset(); |
673 | } | 675 | } |
674 | 676 | ||
675 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | 677 | // Commented pending deletion since this method no longer appears to do anything at all |
676 | if (sp.Scene.NeedSceneCacheClear(sp.UUID)) | 678 | // // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! |
677 | { | 679 | // if (sp.Scene.NeedSceneCacheClear(sp.UUID)) |
678 | m_log.DebugFormat( | 680 | // { |
679 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", | 681 | // m_log.DebugFormat( |
680 | sp.UUID); | 682 | // "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", |
681 | } | 683 | // sp.UUID); |
684 | // } | ||
682 | 685 | ||
683 | m_entityTransferStateMachine.ResetFromTransit(sp.UUID); | 686 | m_entityTransferStateMachine.ResetFromTransit(sp.UUID); |
684 | } | 687 | } |
@@ -1237,14 +1240,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1237 | 1240 | ||
1238 | AgentHasMovedAway(agent, false); | 1241 | AgentHasMovedAway(agent, false); |
1239 | 1242 | ||
1240 | // the user may change their profile information in other region, | 1243 | // // the user may change their profile information in other region, |
1241 | // so the userinfo in UserProfileCache is not reliable any more, delete it | 1244 | // // so the userinfo in UserProfileCache is not reliable any more, delete it |
1242 | // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! | 1245 | // // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! |
1243 | if (agent.Scene.NeedSceneCacheClear(agent.UUID)) | 1246 | // if (agent.Scene.NeedSceneCacheClear(agent.UUID)) |
1244 | { | 1247 | // { |
1245 | m_log.DebugFormat( | 1248 | // m_log.DebugFormat( |
1246 | "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); | 1249 | // "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); |
1247 | } | 1250 | // } |
1248 | 1251 | ||
1249 | //m_log.Debug("AFTER CROSS"); | 1252 | //m_log.Debug("AFTER CROSS"); |
1250 | //Scene.DumpChildrenSeeds(UUID); | 1253 | //Scene.DumpChildrenSeeds(UUID); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 679be18..41ca13b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -42,9 +42,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
42 | using OpenMetaverse; | 42 | using OpenMetaverse; |
43 | using log4net; | 43 | using log4net; |
44 | using Nini.Config; | 44 | using Nini.Config; |
45 | using Mono.Addins; | ||
45 | 46 | ||
46 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | 47 | namespace OpenSim.Region.CoreModules.Framework.EntityTransfer |
47 | { | 48 | { |
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGEntityTransferModule")] | ||
48 | public class HGEntityTransferModule | 50 | public class HGEntityTransferModule |
49 | : EntityTransferModule, INonSharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule | 51 | : EntityTransferModule, INonSharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule |
50 | { | 52 | { |
@@ -259,8 +261,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
259 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) | 261 | if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) |
260 | { | 262 | { |
261 | // this user is going to another grid | 263 | // this user is going to another grid |
262 | // check if HyperGrid teleport is allowed, based on user level | 264 | // for local users, check if HyperGrid teleport is allowed, based on user level |
263 | if (sp.UserLevel < m_levelHGTeleport) | 265 | if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID) && sp.UserLevel < m_levelHGTeleport) |
264 | { | 266 | { |
265 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel."); | 267 | m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel."); |
266 | reason = "Hypergrid teleport not allowed"; | 268 | reason = "Hypergrid teleport not allowed"; |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 80257bd..964efda 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -42,9 +42,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
42 | using OpenMetaverse; | 42 | using OpenMetaverse; |
43 | using log4net; | 43 | using log4net; |
44 | using Nini.Config; | 44 | using Nini.Config; |
45 | using Mono.Addins; | ||
45 | 46 | ||
46 | namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | 47 | namespace OpenSim.Region.CoreModules.Framework.InventoryAccess |
47 | { | 48 | { |
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGInventoryAccessModule")] | ||
48 | public class HGInventoryAccessModule : BasicInventoryAccessModule, INonSharedRegionModule, IInventoryAccessModule | 50 | public class HGInventoryAccessModule : BasicInventoryAccessModule, INonSharedRegionModule, IInventoryAccessModule |
49 | { | 51 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -92,7 +94,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
92 | m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI); | 94 | m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI); |
93 | m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); | 95 | m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); |
94 | m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty); | 96 | m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty); |
95 | m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", false); | 97 | m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true); |
96 | } | 98 | } |
97 | else | 99 | else |
98 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); | 100 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); |
@@ -351,6 +353,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
351 | 353 | ||
352 | private void ProcessInventoryForArriving(IClientAPI client) | 354 | private void ProcessInventoryForArriving(IClientAPI client) |
353 | { | 355 | { |
356 | // No-op for now, but we may need to do something for freign users inventory | ||
354 | } | 357 | } |
355 | 358 | ||
356 | // | 359 | // |
@@ -397,6 +400,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
397 | 400 | ||
398 | private void ProcessInventoryForLeaving(IClientAPI client) | 401 | private void ProcessInventoryForLeaving(IClientAPI client) |
399 | { | 402 | { |
403 | // No-op for now | ||
400 | } | 404 | } |
401 | 405 | ||
402 | #endregion | 406 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 8b34c28..8b7c16e 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -46,9 +46,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
46 | using OpenMetaverse; | 46 | using OpenMetaverse; |
47 | using log4net; | 47 | using log4net; |
48 | using Nini.Config; | 48 | using Nini.Config; |
49 | using Mono.Addins; | ||
49 | 50 | ||
50 | namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | 51 | namespace OpenSim.Region.CoreModules.Framework.InventoryAccess |
51 | { | 52 | { |
53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicInventoryAccessModule")] | ||
52 | public class BasicInventoryAccessModule : INonSharedRegionModule, IInventoryAccessModule | 54 | public class BasicInventoryAccessModule : INonSharedRegionModule, IInventoryAccessModule |
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); |
@@ -180,12 +182,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
180 | if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) | 182 | if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) |
181 | return; | 183 | return; |
182 | 184 | ||
183 | InventoryFolderBase f = new InventoryFolderBase(folderID, remoteClient.AgentId); | ||
184 | InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(f); | ||
185 | |||
186 | if (folder == null || folder.Owner != remoteClient.AgentId) | ||
187 | return; | ||
188 | |||
189 | if (transactionID == UUID.Zero) | 185 | if (transactionID == UUID.Zero) |
190 | { | 186 | { |
191 | ScenePresence presence; | 187 | ScenePresence presence; |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index 21d8bd7..b768257 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs | |||
@@ -49,7 +49,7 @@ using OpenSim.Tests.Common.Mock; | |||
49 | namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | 49 | namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests |
50 | { | 50 | { |
51 | [TestFixture] | 51 | [TestFixture] |
52 | public class InventoryAccessModuleTests | 52 | public class InventoryAccessModuleTests : OpenSimTestCase |
53 | { | 53 | { |
54 | protected TestScene m_scene; | 54 | protected TestScene m_scene; |
55 | protected BasicInventoryAccessModule m_iam; | 55 | protected BasicInventoryAccessModule m_iam; |
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index 3155ce7..ec22146 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs | |||
@@ -41,10 +41,12 @@ using OpenSim.Server.Base; | |||
41 | 41 | ||
42 | using OpenMetaverse; | 42 | using OpenMetaverse; |
43 | using log4net; | 43 | using log4net; |
44 | using Mono.Addins; | ||
44 | using Nini.Config; | 45 | using Nini.Config; |
45 | 46 | ||
46 | namespace OpenSim.Region.CoreModules.Framework.Library | 47 | namespace OpenSim.Region.CoreModules.Framework.Library |
47 | { | 48 | { |
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LibraryModule")] | ||
48 | public class LibraryModule : ISharedRegionModule | 50 | public class LibraryModule : ISharedRegionModule |
49 | { | 51 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index e411585..d84460a 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs | |||
@@ -38,10 +38,12 @@ using OpenSim.Region.CoreModules.Framework.Monitoring.Alerts; | |||
38 | using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; | 38 | using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; |
39 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using Mono.Addins; | ||
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.Framework.Monitoring | 43 | namespace OpenSim.Region.CoreModules.Framework.Monitoring |
43 | { | 44 | { |
44 | public class MonitorModule : IRegionModule | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MonitorModule")] |
46 | public class MonitorModule : INonSharedRegionModule | ||
45 | { | 47 | { |
46 | /// <summary> | 48 | /// <summary> |
47 | /// Is this module enabled? | 49 | /// Is this module enabled? |
@@ -62,14 +64,14 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
62 | private readonly List<IAlert> m_alerts = new List<IAlert>(); | 64 | private readonly List<IAlert> m_alerts = new List<IAlert>(); |
63 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 65 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
64 | 66 | ||
65 | #region Implementation of IRegionModule | ||
66 | |||
67 | public MonitorModule() | 67 | public MonitorModule() |
68 | { | 68 | { |
69 | Enabled = true; | 69 | Enabled = true; |
70 | } | 70 | } |
71 | 71 | ||
72 | public void Initialise(Scene scene, IConfigSource source) | 72 | #region Implementation of INonSharedRegionModule |
73 | |||
74 | public void Initialise(IConfigSource source) | ||
73 | { | 75 | { |
74 | IConfig cnfg = source.Configs["Monitoring"]; | 76 | IConfig cnfg = source.Configs["Monitoring"]; |
75 | 77 | ||
@@ -79,6 +81,13 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
79 | if (!Enabled) | 81 | if (!Enabled) |
80 | return; | 82 | return; |
81 | 83 | ||
84 | } | ||
85 | |||
86 | public void AddRegion(Scene scene) | ||
87 | { | ||
88 | if (!Enabled) | ||
89 | return; | ||
90 | |||
82 | m_scene = scene; | 91 | m_scene = scene; |
83 | 92 | ||
84 | m_scene.AddCommand("General", this, "monitor report", | 93 | m_scene.AddCommand("General", this, "monitor report", |
@@ -89,101 +98,42 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
89 | MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage); | 98 | MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage); |
90 | MainServer.Instance.AddHTTPHandler( | 99 | MainServer.Instance.AddHTTPHandler( |
91 | "/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName), StatsPage); | 100 | "/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName), StatsPage); |
101 | |||
102 | AddMonitors(); | ||
92 | } | 103 | } |
93 | 104 | ||
94 | public void DebugMonitors(string module, string[] args) | 105 | public void RemoveRegion(Scene scene) |
95 | { | 106 | { |
96 | foreach (IMonitor monitor in m_staticMonitors) | 107 | if (!Enabled) |
97 | { | 108 | return; |
98 | MainConsole.Instance.OutputFormat( | ||
99 | "[MONITOR MODULE]: {0} reports {1} = {2}", | ||
100 | m_scene.RegionInfo.RegionName, monitor.GetFriendlyName(), monitor.GetFriendlyValue()); | ||
101 | } | ||
102 | 109 | ||
103 | foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats()) | 110 | MainServer.Instance.RemoveHTTPHandler("GET", "/monitorstats/" + m_scene.RegionInfo.RegionID); |
104 | { | 111 | MainServer.Instance.RemoveHTTPHandler("GET", "/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName)); |
105 | MainConsole.Instance.OutputFormat( | 112 | m_scene = null; |
106 | "[MONITOR MODULE]: {0} reports {1} = {2}", | ||
107 | m_scene.RegionInfo.RegionName, tuple.Key, tuple.Value); | ||
108 | } | ||
109 | } | 113 | } |
110 | 114 | ||
111 | public void TestAlerts() | 115 | public void Close() |
112 | { | 116 | { |
113 | foreach (IAlert alert in m_alerts) | ||
114 | { | ||
115 | alert.Test(); | ||
116 | } | ||
117 | } | 117 | } |
118 | 118 | ||
119 | public Hashtable StatsPage(Hashtable request) | 119 | public string Name |
120 | { | 120 | { |
121 | // If request was for a specific monitor | 121 | get { return "Region Health Monitoring Module"; } |
122 | // eg url/?monitor=Monitor.Name | 122 | } |
123 | if (request.ContainsKey("monitor")) | ||
124 | { | ||
125 | string monID = (string) request["monitor"]; | ||
126 | |||
127 | foreach (IMonitor monitor in m_staticMonitors) | ||
128 | { | ||
129 | string elemName = monitor.ToString(); | ||
130 | if (elemName.StartsWith(monitor.GetType().Namespace)) | ||
131 | elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1); | ||
132 | |||
133 | if (elemName == monID || monitor.ToString() == monID) | ||
134 | { | ||
135 | Hashtable ereply3 = new Hashtable(); | ||
136 | |||
137 | ereply3["int_response_code"] = 404; // 200 OK | ||
138 | ereply3["str_response_string"] = monitor.GetValue().ToString(); | ||
139 | ereply3["content_type"] = "text/plain"; | ||
140 | |||
141 | return ereply3; | ||
142 | } | ||
143 | } | ||
144 | |||
145 | // FIXME: Arguably this should also be done with dynamic monitors but I'm not sure what the above code | ||
146 | // is even doing. Why are we inspecting the type of the monitor??? | ||
147 | |||
148 | // No monitor with that name | ||
149 | Hashtable ereply2 = new Hashtable(); | ||
150 | |||
151 | ereply2["int_response_code"] = 404; // 200 OK | ||
152 | ereply2["str_response_string"] = "No such monitor"; | ||
153 | ereply2["content_type"] = "text/plain"; | ||
154 | |||
155 | return ereply2; | ||
156 | } | ||
157 | |||
158 | string xml = "<data>"; | ||
159 | foreach (IMonitor monitor in m_staticMonitors) | ||
160 | { | ||
161 | string elemName = monitor.GetName(); | ||
162 | xml += "<" + elemName + ">" + monitor.GetValue().ToString() + "</" + elemName + ">"; | ||
163 | // m_log.DebugFormat("[MONITOR MODULE]: {0} = {1}", elemName, monitor.GetValue()); | ||
164 | } | ||
165 | |||
166 | foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats()) | ||
167 | { | ||
168 | xml += "<" + tuple.Key + ">" + tuple.Value + "</" + tuple.Key + ">"; | ||
169 | } | ||
170 | |||
171 | xml += "</data>"; | ||
172 | |||
173 | Hashtable ereply = new Hashtable(); | ||
174 | |||
175 | ereply["int_response_code"] = 200; // 200 OK | ||
176 | ereply["str_response_string"] = xml; | ||
177 | ereply["content_type"] = "text/xml"; | ||
178 | 123 | ||
179 | return ereply; | 124 | public void RegionLoaded(Scene scene) |
125 | { | ||
180 | } | 126 | } |
181 | 127 | ||
182 | public void PostInitialise() | 128 | public Type ReplaceableInterface |
183 | { | 129 | { |
184 | if (!Enabled) | 130 | get { return null; } |
185 | return; | 131 | } |
132 | |||
133 | #endregion | ||
186 | 134 | ||
135 | public void AddMonitors() | ||
136 | { | ||
187 | m_staticMonitors.Add(new AgentCountMonitor(m_scene)); | 137 | m_staticMonitors.Add(new AgentCountMonitor(m_scene)); |
188 | m_staticMonitors.Add(new ChildAgentCountMonitor(m_scene)); | 138 | m_staticMonitors.Add(new ChildAgentCountMonitor(m_scene)); |
189 | m_staticMonitors.Add(new GCMemoryMonitor()); | 139 | m_staticMonitors.Add(new GCMemoryMonitor()); |
@@ -196,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
196 | m_staticMonitors.Add(new EventFrameMonitor(m_scene)); | 146 | m_staticMonitors.Add(new EventFrameMonitor(m_scene)); |
197 | m_staticMonitors.Add(new LandFrameMonitor(m_scene)); | 147 | m_staticMonitors.Add(new LandFrameMonitor(m_scene)); |
198 | m_staticMonitors.Add(new LastFrameTimeMonitor(m_scene)); | 148 | m_staticMonitors.Add(new LastFrameTimeMonitor(m_scene)); |
199 | 149 | ||
200 | m_staticMonitors.Add( | 150 | m_staticMonitors.Add( |
201 | new GenericMonitor( | 151 | new GenericMonitor( |
202 | m_scene, | 152 | m_scene, |
@@ -357,25 +307,98 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring | |||
357 | } | 307 | } |
358 | } | 308 | } |
359 | 309 | ||
360 | void OnTriggerAlert(System.Type reporter, string reason, bool fatal) | 310 | public void DebugMonitors(string module, string[] args) |
361 | { | 311 | { |
362 | m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); | 312 | foreach (IMonitor monitor in m_staticMonitors) |
313 | { | ||
314 | MainConsole.Instance.OutputFormat( | ||
315 | "[MONITOR MODULE]: {0} reports {1} = {2}", | ||
316 | m_scene.RegionInfo.RegionName, monitor.GetFriendlyName(), monitor.GetFriendlyValue()); | ||
317 | } | ||
318 | |||
319 | foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats()) | ||
320 | { | ||
321 | MainConsole.Instance.OutputFormat( | ||
322 | "[MONITOR MODULE]: {0} reports {1} = {2}", | ||
323 | m_scene.RegionInfo.RegionName, tuple.Key, tuple.Value); | ||
324 | } | ||
363 | } | 325 | } |
364 | 326 | ||
365 | public void Close() | 327 | public void TestAlerts() |
366 | { | 328 | { |
329 | foreach (IAlert alert in m_alerts) | ||
330 | { | ||
331 | alert.Test(); | ||
332 | } | ||
367 | } | 333 | } |
368 | 334 | ||
369 | public string Name | 335 | public Hashtable StatsPage(Hashtable request) |
370 | { | 336 | { |
371 | get { return "Region Health Monitoring Module"; } | 337 | // If request was for a specific monitor |
338 | // eg url/?monitor=Monitor.Name | ||
339 | if (request.ContainsKey("monitor")) | ||
340 | { | ||
341 | string monID = (string) request["monitor"]; | ||
342 | |||
343 | foreach (IMonitor monitor in m_staticMonitors) | ||
344 | { | ||
345 | string elemName = monitor.ToString(); | ||
346 | if (elemName.StartsWith(monitor.GetType().Namespace)) | ||
347 | elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1); | ||
348 | |||
349 | if (elemName == monID || monitor.ToString() == monID) | ||
350 | { | ||
351 | Hashtable ereply3 = new Hashtable(); | ||
352 | |||
353 | ereply3["int_response_code"] = 404; // 200 OK | ||
354 | ereply3["str_response_string"] = monitor.GetValue().ToString(); | ||
355 | ereply3["content_type"] = "text/plain"; | ||
356 | |||
357 | return ereply3; | ||
358 | } | ||
359 | } | ||
360 | |||
361 | // FIXME: Arguably this should also be done with dynamic monitors but I'm not sure what the above code | ||
362 | // is even doing. Why are we inspecting the type of the monitor??? | ||
363 | |||
364 | // No monitor with that name | ||
365 | Hashtable ereply2 = new Hashtable(); | ||
366 | |||
367 | ereply2["int_response_code"] = 404; // 200 OK | ||
368 | ereply2["str_response_string"] = "No such monitor"; | ||
369 | ereply2["content_type"] = "text/plain"; | ||
370 | |||
371 | return ereply2; | ||
372 | } | ||
373 | |||
374 | string xml = "<data>"; | ||
375 | foreach (IMonitor monitor in m_staticMonitors) | ||
376 | { | ||
377 | string elemName = monitor.GetName(); | ||
378 | xml += "<" + elemName + ">" + monitor.GetValue().ToString() + "</" + elemName + ">"; | ||
379 | // m_log.DebugFormat("[MONITOR MODULE]: {0} = {1}", elemName, monitor.GetValue()); | ||
380 | } | ||
381 | |||
382 | foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats()) | ||
383 | { | ||
384 | xml += "<" + tuple.Key + ">" + tuple.Value + "</" + tuple.Key + ">"; | ||
385 | } | ||
386 | |||
387 | xml += "</data>"; | ||
388 | |||
389 | Hashtable ereply = new Hashtable(); | ||
390 | |||
391 | ereply["int_response_code"] = 200; // 200 OK | ||
392 | ereply["str_response_string"] = xml; | ||
393 | ereply["content_type"] = "text/xml"; | ||
394 | |||
395 | return ereply; | ||
372 | } | 396 | } |
373 | 397 | ||
374 | public bool IsSharedModule | 398 | void OnTriggerAlert(System.Type reporter, string reason, bool fatal) |
375 | { | 399 | { |
376 | get { return false; } | 400 | m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); |
377 | } | 401 | } |
378 | 402 | ||
379 | #endregion | ||
380 | } | 403 | } |
381 | } | 404 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs index acefc97..4ef57fe 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs | |||
@@ -41,9 +41,11 @@ using OpenMetaverse; | |||
41 | using OpenMetaverse.Packets; | 41 | using OpenMetaverse.Packets; |
42 | using log4net; | 42 | using log4net; |
43 | using Nini.Config; | 43 | using Nini.Config; |
44 | using Mono.Addins; | ||
44 | 45 | ||
45 | namespace OpenSim.Region.CoreModules.Framework.UserManagement | 46 | namespace OpenSim.Region.CoreModules.Framework.UserManagement |
46 | { | 47 | { |
48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGUserManagementModule")] | ||
47 | public class HGUserManagementModule : UserManagementModule, ISharedRegionModule, IUserManagement | 49 | public class HGUserManagementModule : UserManagementModule, ISharedRegionModule, IUserManagement |
48 | { | 50 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index b4811da..86e7004 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -42,6 +42,7 @@ using OpenMetaverse; | |||
42 | using OpenMetaverse.Packets; | 42 | using OpenMetaverse.Packets; |
43 | using log4net; | 43 | using log4net; |
44 | using Nini.Config; | 44 | using Nini.Config; |
45 | using Mono.Addins; | ||
45 | 46 | ||
46 | namespace OpenSim.Region.CoreModules.Framework.UserManagement | 47 | namespace OpenSim.Region.CoreModules.Framework.UserManagement |
47 | { | 48 | { |
@@ -54,6 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
54 | public Dictionary<string, object> ServerURLs { get; set; } | 55 | public Dictionary<string, object> ServerURLs { get; set; } |
55 | } | 56 | } |
56 | 57 | ||
58 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserManagementModule")] | ||
57 | public class UserManagementModule : ISharedRegionModule, IUserManagement | 59 | public class UserManagementModule : ISharedRegionModule, IUserManagement |
58 | { | 60 | { |
59 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 61 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index 0c60391..e0921ad 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs | |||
@@ -31,6 +31,7 @@ using System.Reflection; | |||
31 | using log4net; | 31 | using log4net; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using Mono.Addins; | ||
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
35 | using OpenSim.Region.CoreModules.World.WorldMap; | 36 | using OpenSim.Region.CoreModules.World.WorldMap; |
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
@@ -39,6 +40,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.Hypergrid | 41 | namespace OpenSim.Region.CoreModules.Hypergrid |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGWorldMapModule")] | ||
42 | public class HGWorldMapModule : WorldMapModule | 44 | public class HGWorldMapModule : WorldMapModule |
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); |
diff --git a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs deleted file mode 100644 index 2cc0a07..0000000 --- a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs +++ /dev/null | |||
@@ -1,150 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Text; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using Nwc.XmlRpc; | ||
37 | using OpenMetaverse; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Communications; | ||
40 | using OpenSim.Framework.Servers; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | |||
44 | namespace OpenSim.Region.CoreModules.InterGrid | ||
45 | { | ||
46 | public class OGSRadmin : IRegionModule | ||
47 | { | ||
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | private readonly List<Scene> m_scenes = new List<Scene>(); | ||
50 | private IConfigSource m_settings; | ||
51 | |||
52 | #region Implementation of IRegionModuleBase | ||
53 | |||
54 | public string Name | ||
55 | { | ||
56 | get { return "OGS Supporting RAdmin"; } | ||
57 | } | ||
58 | |||
59 | |||
60 | public void Initialise(IConfigSource source) | ||
61 | { | ||
62 | m_settings = source; | ||
63 | } | ||
64 | |||
65 | public void Close() | ||
66 | { | ||
67 | |||
68 | } | ||
69 | |||
70 | public void AddRegion(Scene scene) | ||
71 | { | ||
72 | lock (m_scenes) | ||
73 | m_scenes.Add(scene); | ||
74 | } | ||
75 | |||
76 | public void RemoveRegion(Scene scene) | ||
77 | { | ||
78 | lock (m_scenes) | ||
79 | m_scenes.Remove(scene); | ||
80 | } | ||
81 | |||
82 | public void RegionLoaded(Scene scene) | ||
83 | { | ||
84 | |||
85 | } | ||
86 | |||
87 | public void PostInitialise() | ||
88 | { | ||
89 | if (m_settings.Configs["Startup"].GetBoolean("gridmode", false)) | ||
90 | { | ||
91 | MainServer.Instance.AddXmlRPCHandler("grid_message", GridWideMessage); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | #endregion | ||
96 | |||
97 | #region IRegionModule | ||
98 | |||
99 | public void Initialise(Scene scene, IConfigSource source) | ||
100 | { | ||
101 | m_settings = source; | ||
102 | |||
103 | lock (m_scenes) | ||
104 | m_scenes.Add(scene); | ||
105 | } | ||
106 | |||
107 | public bool IsSharedModule | ||
108 | { | ||
109 | get { return true; } | ||
110 | } | ||
111 | |||
112 | #endregion | ||
113 | |||
114 | public XmlRpcResponse GridWideMessage(XmlRpcRequest req, IPEndPoint remoteClient) | ||
115 | { | ||
116 | XmlRpcResponse response = new XmlRpcResponse(); | ||
117 | Hashtable responseData = new Hashtable(); | ||
118 | |||
119 | Hashtable requestData = (Hashtable)req.Params[0]; | ||
120 | |||
121 | // REFACTORING PROBLEM. This authorization needs to be replaced with some other | ||
122 | //if ((!requestData.Contains("password") || (string)requestData["password"] != m_com.NetworkServersInfo.GridRecvKey)) | ||
123 | //{ | ||
124 | // responseData["accepted"] = false; | ||
125 | // responseData["success"] = false; | ||
126 | // responseData["error"] = "Invalid Key"; | ||
127 | // response.Value = responseData; | ||
128 | // return response; | ||
129 | //} | ||
130 | |||
131 | string message = (string)requestData["message"]; | ||
132 | string user = (string)requestData["user"]; | ||
133 | m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); | ||
134 | |||
135 | lock (m_scenes) | ||
136 | foreach (Scene scene in m_scenes) | ||
137 | { | ||
138 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
139 | if (dialogModule != null) | ||
140 | dialogModule.SendNotificationToUsersInRegion(UUID.Random(), user, message); | ||
141 | } | ||
142 | |||
143 | responseData["accepted"] = true; | ||
144 | responseData["success"] = true; | ||
145 | response.Value = responseData; | ||
146 | |||
147 | return response; | ||
148 | } | ||
149 | } | ||
150 | } | ||
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs deleted file mode 100644 index 4a76b00..0000000 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ /dev/null | |||
@@ -1,1297 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Net; | ||
32 | using System.Net.Security; | ||
33 | using System.Reflection; | ||
34 | using System.Security.Cryptography.X509Certificates; | ||
35 | using System.Threading; | ||
36 | using System.Web; | ||
37 | using log4net; | ||
38 | using Nini.Config; | ||
39 | using OpenMetaverse; | ||
40 | using OpenMetaverse.StructuredData; | ||
41 | using OpenSim.Framework; | ||
42 | using OpenSim.Framework.Capabilities; | ||
43 | using OpenSim.Framework.Monitoring; | ||
44 | using OpenSim.Framework.Servers; | ||
45 | using OpenSim.Region.Framework.Interfaces; | ||
46 | using OpenSim.Region.Framework.Scenes; | ||
47 | using Caps=OpenSim.Framework.Capabilities.Caps; | ||
48 | using OSDArray=OpenMetaverse.StructuredData.OSDArray; | ||
49 | using OSDMap=OpenMetaverse.StructuredData.OSDMap; | ||
50 | |||
51 | namespace OpenSim.Region.CoreModules.InterGrid | ||
52 | { | ||
53 | public struct OGPState | ||
54 | { | ||
55 | public string first_name; | ||
56 | public string last_name; | ||
57 | public UUID agent_id; | ||
58 | public UUID local_agent_id; | ||
59 | public UUID region_id; | ||
60 | public uint circuit_code; | ||
61 | public UUID secure_session_id; | ||
62 | public UUID session_id; | ||
63 | public bool agent_access; | ||
64 | public string sim_access; | ||
65 | public uint god_level; | ||
66 | public bool god_overide; | ||
67 | public bool identified; | ||
68 | public bool transacted; | ||
69 | public bool age_verified; | ||
70 | public bool allow_redirect; | ||
71 | public int limited_to_estate; | ||
72 | public string inventory_host; | ||
73 | public bool src_can_see_mainland; | ||
74 | public int src_estate_id; | ||
75 | public int src_version; | ||
76 | public int src_parent_estate_id; | ||
77 | public bool visible_to_parent; | ||
78 | public string teleported_into_region; | ||
79 | } | ||
80 | |||
81 | public class OpenGridProtocolModule : IRegionModule | ||
82 | { | ||
83 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
84 | private List<Scene> m_scene = new List<Scene>(); | ||
85 | |||
86 | private Dictionary<string, AgentCircuitData> CapsLoginID = new Dictionary<string, AgentCircuitData>(); | ||
87 | private Dictionary<UUID, OGPState> m_OGPState = new Dictionary<UUID, OGPState>(); | ||
88 | private Dictionary<string, string> m_loginToRegionState = new Dictionary<string, string>(); | ||
89 | |||
90 | |||
91 | private string LastNameSuffix = "_EXTERNAL"; | ||
92 | private string FirstNamePrefix = ""; | ||
93 | private string httpsCN = ""; | ||
94 | private bool httpSSL = false; | ||
95 | private uint httpsslport = 0; | ||
96 | // private bool GridMode = false; | ||
97 | |||
98 | #region IRegionModule Members | ||
99 | |||
100 | public void Initialise(Scene scene, IConfigSource config) | ||
101 | { | ||
102 | bool enabled = false; | ||
103 | IConfig cfg = null; | ||
104 | IConfig httpcfg = null; | ||
105 | // IConfig startupcfg = null; | ||
106 | try | ||
107 | { | ||
108 | cfg = config.Configs["OpenGridProtocol"]; | ||
109 | } catch (NullReferenceException) | ||
110 | { | ||
111 | enabled = false; | ||
112 | } | ||
113 | |||
114 | try | ||
115 | { | ||
116 | httpcfg = config.Configs["Network"]; | ||
117 | } | ||
118 | catch (NullReferenceException) | ||
119 | { | ||
120 | |||
121 | } | ||
122 | // try | ||
123 | // { | ||
124 | // startupcfg = config.Configs["Startup"]; | ||
125 | // } | ||
126 | // catch (NullReferenceException) | ||
127 | // { | ||
128 | // | ||
129 | // } | ||
130 | |||
131 | // if (startupcfg != null) | ||
132 | // { | ||
133 | // GridMode = enabled = startupcfg.GetBoolean("gridmode", false); | ||
134 | // } | ||
135 | |||
136 | if (cfg != null) | ||
137 | { | ||
138 | enabled = cfg.GetBoolean("ogp_enabled", false); | ||
139 | LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); | ||
140 | FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); | ||
141 | if (enabled) | ||
142 | { | ||
143 | m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); | ||
144 | lock (m_scene) | ||
145 | { | ||
146 | if (m_scene.Count == 0) | ||
147 | { | ||
148 | MainServer.Instance.AddLLSDHandler("/agent/", ProcessAgentDomainMessage); | ||
149 | MainServer.Instance.AddLLSDHandler("/", ProcessRegionDomainSeed); | ||
150 | try | ||
151 | { | ||
152 | ServicePointManager.ServerCertificateValidationCallback += customXertificateValidation; | ||
153 | } | ||
154 | catch (NotImplementedException) | ||
155 | { | ||
156 | try | ||
157 | { | ||
158 | #pragma warning disable 0612, 0618 | ||
159 | // Mono does not implement the ServicePointManager.ServerCertificateValidationCallback yet! Don't remove this! | ||
160 | ServicePointManager.CertificatePolicy = new MonoCert(); | ||
161 | #pragma warning restore 0612, 0618 | ||
162 | } | ||
163 | catch (Exception) | ||
164 | { | ||
165 | m_log.Error("[OGP]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions."); | ||
166 | } | ||
167 | } | ||
168 | |||
169 | } | ||
170 | // can't pick the region 'agent' because it would conflict with our agent domain handler | ||
171 | // a zero length region name would conflict with are base region seed cap | ||
172 | if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) | ||
173 | { | ||
174 | MainServer.Instance.AddLLSDHandler( | ||
175 | "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), | ||
176 | ProcessRegionDomainSeed); | ||
177 | } | ||
178 | |||
179 | if (!m_scene.Contains(scene)) | ||
180 | m_scene.Add(scene); | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | lock (m_scene) | ||
185 | { | ||
186 | if (m_scene.Count == 1) | ||
187 | { | ||
188 | if (httpcfg != null) | ||
189 | { | ||
190 | httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); | ||
191 | httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); | ||
192 | if (httpsCN.Length == 0) | ||
193 | httpsCN = scene.RegionInfo.ExternalHostName; | ||
194 | httpsslport = (uint)httpcfg.GetInt("http_listener_sslport",((int)scene.RegionInfo.HttpPort + 1)); | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | } | ||
199 | |||
200 | public void PostInitialise() | ||
201 | { | ||
202 | } | ||
203 | |||
204 | public void Close() | ||
205 | { | ||
206 | //scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; | ||
207 | } | ||
208 | |||
209 | public string Name | ||
210 | { | ||
211 | get { return "OpenGridProtocolModule"; } | ||
212 | } | ||
213 | |||
214 | public bool IsSharedModule | ||
215 | { | ||
216 | get { return true; } | ||
217 | } | ||
218 | |||
219 | #endregion | ||
220 | |||
221 | public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) | ||
222 | { | ||
223 | string[] pathSegments = path.Split('/'); | ||
224 | |||
225 | if (pathSegments.Length <= 1) | ||
226 | { | ||
227 | return GenerateNoHandlerMessage(); | ||
228 | |||
229 | } | ||
230 | |||
231 | return GenerateRezAvatarRequestMessage(pathSegments[1]); | ||
232 | |||
233 | |||
234 | |||
235 | //m_log.InfoFormat("[OGP]: path {0}, segments {1} segment[1] {2} Last segment {3}", | ||
236 | // path, pathSegments.Length, pathSegments[1], pathSegments[pathSegments.Length - 1]); | ||
237 | //return new OSDMap(); | ||
238 | |||
239 | } | ||
240 | |||
241 | public OSD ProcessAgentDomainMessage(string path, OSD request, string endpoint) | ||
242 | { | ||
243 | // /agent/* | ||
244 | |||
245 | string[] pathSegments = path.Split('/'); | ||
246 | if (pathSegments.Length <= 1) | ||
247 | { | ||
248 | return GenerateNoHandlerMessage(); | ||
249 | |||
250 | } | ||
251 | if (pathSegments[0].Length == 0 && pathSegments[1].Length == 0) | ||
252 | { | ||
253 | return GenerateRezAvatarRequestMessage(""); | ||
254 | } | ||
255 | m_log.InfoFormat("[OGP]: path {0}, segments {1} segment[1] {2} Last segment {3}", | ||
256 | path, pathSegments.Length, pathSegments[1], pathSegments[pathSegments.Length - 1]); | ||
257 | |||
258 | switch (pathSegments[pathSegments.Length - 1]) | ||
259 | { | ||
260 | case "rez_avatar": | ||
261 | return RezAvatarMethod(path, request); | ||
262 | //break; | ||
263 | case "derez_avatar": | ||
264 | return DerezAvatarMethod(path, request); | ||
265 | //break; | ||
266 | |||
267 | } | ||
268 | if (path.Length < 2) | ||
269 | { | ||
270 | return GenerateNoHandlerMessage(); | ||
271 | } | ||
272 | |||
273 | switch (pathSegments[pathSegments.Length - 2] + "/" + pathSegments[pathSegments.Length - 1]) | ||
274 | { | ||
275 | case "rez_avatar/rez": | ||
276 | return RezAvatarMethod(path, request); | ||
277 | //break; | ||
278 | case "rez_avatar/request": | ||
279 | return RequestRezAvatarMethod(path, request); | ||
280 | case "rez_avatar/place": | ||
281 | return RequestRezAvatarMethod(path, request); | ||
282 | case "rez_avatar/derez": | ||
283 | return DerezAvatarMethod(path, request); | ||
284 | //break; | ||
285 | default: | ||
286 | return GenerateNoHandlerMessage(); | ||
287 | } | ||
288 | //return null; | ||
289 | } | ||
290 | |||
291 | private OSD GenerateRezAvatarRequestMessage(string regionname) | ||
292 | { | ||
293 | Scene region = null; | ||
294 | bool usedroot = false; | ||
295 | |||
296 | if (regionname.Length == 0) | ||
297 | { | ||
298 | region = GetRootScene(); | ||
299 | usedroot = true; | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | region = GetScene(HttpUtility.UrlDecode(regionname).ToLower()); | ||
304 | } | ||
305 | |||
306 | // this shouldn't happen since we don't listen for a region that is down.. but | ||
307 | // it might if the region was taken down or is in the middle of restarting | ||
308 | |||
309 | if (region == null) | ||
310 | { | ||
311 | region = GetRootScene(); | ||
312 | usedroot = true; | ||
313 | } | ||
314 | |||
315 | UUID statekeeper = UUID.Random(); | ||
316 | |||
317 | |||
318 | |||
319 | |||
320 | RegionInfo reg = region.RegionInfo; | ||
321 | |||
322 | OSDMap responseMap = new OSDMap(); | ||
323 | string rezHttpProtocol = "http://"; | ||
324 | //string regionCapsHttpProtocol = "http://"; | ||
325 | string httpaddr = reg.ExternalHostName; | ||
326 | string urlport = reg.HttpPort.ToString(); | ||
327 | string requestpath = "/agent/" + statekeeper + "/rez_avatar/request"; | ||
328 | |||
329 | if (!usedroot) | ||
330 | { | ||
331 | lock (m_loginToRegionState) | ||
332 | { | ||
333 | if (!m_loginToRegionState.ContainsKey(requestpath)) | ||
334 | { | ||
335 | m_loginToRegionState.Add(requestpath, region.RegionInfo.RegionName.ToLower()); | ||
336 | } | ||
337 | } | ||
338 | } | ||
339 | |||
340 | if (httpSSL) | ||
341 | { | ||
342 | rezHttpProtocol = "https://"; | ||
343 | //regionCapsHttpProtocol = "https://"; | ||
344 | urlport = httpsslport.ToString(); | ||
345 | |||
346 | if (httpsCN.Length > 0) | ||
347 | httpaddr = httpsCN; | ||
348 | } | ||
349 | |||
350 | responseMap["connect"] = OSD.FromBoolean(true); | ||
351 | OSDMap capabilitiesMap = new OSDMap(); | ||
352 | capabilitiesMap["rez_avatar/request"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + requestpath); | ||
353 | responseMap["capabilities"] = capabilitiesMap; | ||
354 | |||
355 | return responseMap; | ||
356 | } | ||
357 | |||
358 | // Using OpenSim.Framework.Capabilities.Caps here one time.. | ||
359 | // so the long name is probably better then a using statement | ||
360 | public void OnRegisterCaps(UUID agentID, Caps caps) | ||
361 | { | ||
362 | /* If we ever want to register our own caps here.... | ||
363 | * | ||
364 | string capsBase = "/CAPS/" + caps.CapsObjectPath; | ||
365 | caps.RegisterHandler("CAPNAME", | ||
366 | new RestStreamHandler("POST", capsBase + CAPSPOSTFIX!, | ||
367 | delegate(string request, string path, string param, | ||
368 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
369 | { | ||
370 | return METHODHANDLER(request, path, param, | ||
371 | agentID, caps); | ||
372 | })); | ||
373 | |||
374 | * | ||
375 | */ | ||
376 | } | ||
377 | |||
378 | public OSD RequestRezAvatarMethod(string path, OSD request) | ||
379 | { | ||
380 | //m_log.Debug("[REQUESTREZAVATAR]: " + request.ToString()); | ||
381 | |||
382 | OSDMap requestMap = (OSDMap)request; | ||
383 | |||
384 | |||
385 | Scene homeScene = null; | ||
386 | |||
387 | lock (m_loginToRegionState) | ||
388 | { | ||
389 | if (m_loginToRegionState.ContainsKey(path)) | ||
390 | { | ||
391 | homeScene = GetScene(m_loginToRegionState[path]); | ||
392 | m_loginToRegionState.Remove(path); | ||
393 | |||
394 | if (homeScene == null) | ||
395 | homeScene = GetRootScene(); | ||
396 | } | ||
397 | else | ||
398 | { | ||
399 | homeScene = GetRootScene(); | ||
400 | } | ||
401 | } | ||
402 | |||
403 | // Homescene is still null, we must have no regions that are up | ||
404 | if (homeScene == null) | ||
405 | return GenerateNoHandlerMessage(); | ||
406 | |||
407 | RegionInfo reg = homeScene.RegionInfo; | ||
408 | ulong regionhandle = GetOSCompatibleRegionHandle(reg); | ||
409 | //string RegionURI = reg.ServerURI; | ||
410 | //int RegionPort = (int)reg.HttpPort; | ||
411 | |||
412 | UUID RemoteAgentID = requestMap["agent_id"].AsUUID(); | ||
413 | |||
414 | // will be used in the future. The client always connects with the aditi agentid currently | ||
415 | UUID LocalAgentID = RemoteAgentID; | ||
416 | |||
417 | string FirstName = requestMap["first_name"].AsString(); | ||
418 | string LastName = requestMap["last_name"].AsString(); | ||
419 | |||
420 | FirstName = FirstNamePrefix + FirstName; | ||
421 | LastName = LastName + LastNameSuffix; | ||
422 | |||
423 | OGPState userState = GetOGPState(LocalAgentID); | ||
424 | |||
425 | userState.first_name = requestMap["first_name"].AsString(); | ||
426 | userState.last_name = requestMap["last_name"].AsString(); | ||
427 | userState.age_verified = requestMap["age_verified"].AsBoolean(); | ||
428 | userState.transacted = requestMap["transacted"].AsBoolean(); | ||
429 | userState.agent_access = requestMap["agent_access"].AsBoolean(); | ||
430 | userState.allow_redirect = requestMap["allow_redirect"].AsBoolean(); | ||
431 | userState.identified = requestMap["identified"].AsBoolean(); | ||
432 | userState.god_level = (uint)requestMap["god_level"].AsInteger(); | ||
433 | userState.sim_access = requestMap["sim_access"].AsString(); | ||
434 | userState.agent_id = RemoteAgentID; | ||
435 | userState.limited_to_estate = requestMap["limited_to_estate"].AsInteger(); | ||
436 | userState.src_can_see_mainland = requestMap["src_can_see_mainland"].AsBoolean(); | ||
437 | userState.src_estate_id = requestMap["src_estate_id"].AsInteger(); | ||
438 | userState.local_agent_id = LocalAgentID; | ||
439 | userState.teleported_into_region = reg.RegionName.ToLower(); | ||
440 | |||
441 | UpdateOGPState(LocalAgentID, userState); | ||
442 | |||
443 | OSDMap responseMap = new OSDMap(); | ||
444 | |||
445 | if (RemoteAgentID == UUID.Zero) | ||
446 | { | ||
447 | responseMap["connect"] = OSD.FromBoolean(false); | ||
448 | responseMap["message"] = OSD.FromString("No agent ID was specified in rez_avatar/request"); | ||
449 | m_log.Error("[OGP]: rez_avatar/request failed because no avatar UUID was provided in the request body"); | ||
450 | return responseMap; | ||
451 | } | ||
452 | |||
453 | responseMap["sim_host"] = OSD.FromString(reg.ExternalHostName); | ||
454 | |||
455 | // DEPRECATED | ||
456 | responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); | ||
457 | |||
458 | responseMap["connect"] = OSD.FromBoolean(true); | ||
459 | responseMap["sim_port"] = OSD.FromInteger(reg.InternalEndPoint.Port); | ||
460 | responseMap["region_x"] = OSD.FromInteger(reg.RegionLocX * (uint)Constants.RegionSize); // LLX | ||
461 | responseMap["region_y"] = OSD.FromInteger(reg.RegionLocY * (uint)Constants.RegionSize); // LLY | ||
462 | responseMap["region_id"] = OSD.FromUUID(reg.originRegionID); | ||
463 | |||
464 | if (reg.RegionSettings.Maturity == 1) | ||
465 | { | ||
466 | responseMap["sim_access"] = OSD.FromString("Mature"); | ||
467 | } | ||
468 | else if (reg.RegionSettings.Maturity == 2) | ||
469 | { | ||
470 | responseMap["sim_access"] = OSD.FromString("Adult"); | ||
471 | } | ||
472 | else | ||
473 | { | ||
474 | responseMap["sim_access"] = OSD.FromString("PG"); | ||
475 | } | ||
476 | |||
477 | // Generate a dummy agent for the user so we can get back a CAPS path | ||
478 | AgentCircuitData agentData = new AgentCircuitData(); | ||
479 | agentData.AgentID = LocalAgentID; | ||
480 | agentData.BaseFolder = UUID.Zero; | ||
481 | agentData.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | ||
482 | agentData.child = false; | ||
483 | agentData.circuitcode = (uint)(Util.RandomClass.Next()); | ||
484 | agentData.firstname = FirstName; | ||
485 | agentData.lastname = LastName; | ||
486 | agentData.SecureSessionID = UUID.Random(); | ||
487 | agentData.SessionID = UUID.Random(); | ||
488 | agentData.startpos = new Vector3(128f, 128f, 100f); | ||
489 | |||
490 | // Pre-Fill our region cache with information on the agent. | ||
491 | UserAgentData useragent = new UserAgentData(); | ||
492 | useragent.AgentIP = "unknown"; | ||
493 | useragent.AgentOnline = true; | ||
494 | useragent.AgentPort = (uint)0; | ||
495 | useragent.Handle = regionhandle; | ||
496 | useragent.InitialRegion = reg.originRegionID; | ||
497 | useragent.LoginTime = Util.UnixTimeSinceEpoch(); | ||
498 | useragent.LogoutTime = 0; | ||
499 | useragent.Position = agentData.startpos; | ||
500 | useragent.Region = reg.originRegionID; | ||
501 | useragent.SecureSessionID = agentData.SecureSessionID; | ||
502 | useragent.SessionID = agentData.SessionID; | ||
503 | |||
504 | UserProfileData userProfile = new UserProfileData(); | ||
505 | userProfile.AboutText = "OGP User"; | ||
506 | userProfile.CanDoMask = (uint)0; | ||
507 | userProfile.Created = Util.UnixTimeSinceEpoch(); | ||
508 | userProfile.CurrentAgent = useragent; | ||
509 | userProfile.CustomType = "OGP"; | ||
510 | userProfile.FirstLifeAboutText = "I'm testing OpenGrid Protocol"; | ||
511 | userProfile.FirstLifeImage = UUID.Zero; | ||
512 | userProfile.FirstName = agentData.firstname; | ||
513 | userProfile.GodLevel = 0; | ||
514 | userProfile.HomeLocation = agentData.startpos; | ||
515 | userProfile.HomeLocationX = agentData.startpos.X; | ||
516 | userProfile.HomeLocationY = agentData.startpos.Y; | ||
517 | userProfile.HomeLocationZ = agentData.startpos.Z; | ||
518 | userProfile.HomeLookAt = Vector3.Zero; | ||
519 | userProfile.HomeLookAtX = userProfile.HomeLookAt.X; | ||
520 | userProfile.HomeLookAtY = userProfile.HomeLookAt.Y; | ||
521 | userProfile.HomeLookAtZ = userProfile.HomeLookAt.Z; | ||
522 | userProfile.HomeRegion = reg.RegionHandle; | ||
523 | userProfile.HomeRegionID = reg.originRegionID; | ||
524 | userProfile.HomeRegionX = reg.RegionLocX; | ||
525 | userProfile.HomeRegionY = reg.RegionLocY; | ||
526 | userProfile.ID = agentData.AgentID; | ||
527 | userProfile.Image = UUID.Zero; | ||
528 | userProfile.LastLogin = Util.UnixTimeSinceEpoch(); | ||
529 | userProfile.Partner = UUID.Zero; | ||
530 | userProfile.PasswordHash = "$1$"; | ||
531 | userProfile.PasswordSalt = ""; | ||
532 | userProfile.SurName = agentData.lastname; | ||
533 | //userProfile.UserAssetURI = homeScene.CommsManager.NetworkServersInfo.AssetURL; | ||
534 | userProfile.UserFlags = 0; | ||
535 | //userProfile.UserInventoryURI = homeScene.CommsManager.NetworkServersInfo.InventoryURL; | ||
536 | userProfile.WantDoMask = 0; | ||
537 | userProfile.WebLoginKey = UUID.Random(); | ||
538 | |||
539 | // !!! REFACTORING PROBLEM. This needs to be changed for 0.7 | ||
540 | // | ||
541 | //// Do caps registration | ||
542 | //// get seed capagentData.firstname = FirstName;agentData.lastname = LastName; | ||
543 | //if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode) | ||
544 | //{ | ||
545 | // homeScene.CommsManager.UserAdminService.AddUser( | ||
546 | // agentData.firstname, agentData.lastname, CreateRandomStr(7), "", | ||
547 | // homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID); | ||
548 | |||
549 | // UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID); | ||
550 | // if (userProfile2 != null) | ||
551 | // { | ||
552 | // userProfile = userProfile2; | ||
553 | // userProfile.AboutText = "OGP USER"; | ||
554 | // userProfile.FirstLifeAboutText = "OGP USER"; | ||
555 | // homeScene.CommsManager.UserService.UpdateUserProfile(userProfile); | ||
556 | // } | ||
557 | //} | ||
558 | |||
559 | //// Stick our data in the cache so the region will know something about us | ||
560 | //homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(userProfile); | ||
561 | |||
562 | // Call 'new user' event handler | ||
563 | string reason; | ||
564 | if (!homeScene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) | ||
565 | { | ||
566 | responseMap["connect"] = OSD.FromBoolean(false); | ||
567 | responseMap["message"] = OSD.FromString(String.Format("Connection refused: {0}", reason)); | ||
568 | m_log.ErrorFormat("[OGP]: rez_avatar/request failed: {0}", reason); | ||
569 | return responseMap; | ||
570 | } | ||
571 | |||
572 | |||
573 | //string raCap = string.Empty; | ||
574 | |||
575 | UUID AvatarRezCapUUID = LocalAgentID; | ||
576 | string rezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar/rez"; | ||
577 | string derezAvatarPath = "/agent/" + AvatarRezCapUUID + "/rez_avatar/derez"; | ||
578 | // Get a reference to the user's cap so we can pull out the Caps Object Path | ||
579 | Caps userCap | ||
580 | = homeScene.CapsModule.GetCapsForUser(agentData.AgentID); | ||
581 | |||
582 | string rezHttpProtocol = "http://"; | ||
583 | string regionCapsHttpProtocol = "http://"; | ||
584 | string httpaddr = reg.ExternalHostName; | ||
585 | string urlport = reg.HttpPort.ToString(); | ||
586 | |||
587 | if (httpSSL) | ||
588 | { | ||
589 | rezHttpProtocol = "https://"; | ||
590 | regionCapsHttpProtocol = "https://"; | ||
591 | urlport = httpsslport.ToString(); | ||
592 | |||
593 | if (httpsCN.Length > 0) | ||
594 | httpaddr = httpsCN; | ||
595 | } | ||
596 | |||
597 | // DEPRECATED | ||
598 | responseMap["seed_capability"] | ||
599 | = OSD.FromString( | ||
600 | regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); | ||
601 | |||
602 | // REPLACEMENT | ||
603 | responseMap["region_seed_capability"] | ||
604 | = OSD.FromString( | ||
605 | regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + "/" + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); | ||
606 | |||
607 | responseMap["rez_avatar"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); | ||
608 | responseMap["rez_avatar/rez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + rezAvatarPath); | ||
609 | responseMap["rez_avatar/derez"] = OSD.FromString(rezHttpProtocol + httpaddr + ":" + urlport + derezAvatarPath); | ||
610 | |||
611 | // Add the user to the list of CAPS that are outstanding. | ||
612 | // well allow the caps hosts in this dictionary | ||
613 | lock (CapsLoginID) | ||
614 | { | ||
615 | if (CapsLoginID.ContainsKey(rezAvatarPath)) | ||
616 | { | ||
617 | CapsLoginID[rezAvatarPath] = agentData; | ||
618 | |||
619 | // This is a joke, if you didn't notice... It's so unlikely to happen, that I'll print this message if it does occur! | ||
620 | m_log.Error("[OGP]: Holy anomoly batman! Caps path already existed! All the UUID Duplication worries were founded!"); | ||
621 | } | ||
622 | else | ||
623 | { | ||
624 | CapsLoginID.Add(rezAvatarPath, agentData); | ||
625 | } | ||
626 | } | ||
627 | |||
628 | //m_log.Debug("Response:" + responseMap.ToString()); | ||
629 | return responseMap; | ||
630 | } | ||
631 | |||
632 | public OSD RezAvatarMethod(string path, OSD request) | ||
633 | { | ||
634 | m_log.WarnFormat("[REZAVATAR]: {0}", request.ToString()); | ||
635 | |||
636 | OSDMap responseMap = new OSDMap(); | ||
637 | |||
638 | AgentCircuitData userData = null; | ||
639 | |||
640 | // Only people we've issued a cap can go further | ||
641 | if (TryGetAgentCircuitData(path,out userData)) | ||
642 | { | ||
643 | OSDMap requestMap = (OSDMap)request; | ||
644 | |||
645 | // take these values to start. There's a few more | ||
646 | UUID SecureSessionID=requestMap["secure_session_id"].AsUUID(); | ||
647 | UUID SessionID = requestMap["session_id"].AsUUID(); | ||
648 | int circuitcode = requestMap["circuit_code"].AsInteger(); | ||
649 | OSDArray Parameter = new OSDArray(); | ||
650 | if (requestMap.ContainsKey("parameter")) | ||
651 | { | ||
652 | Parameter = (OSDArray)requestMap["parameter"]; | ||
653 | } | ||
654 | |||
655 | //int version = 1; | ||
656 | int estateID = 1; | ||
657 | int parentEstateID = 1; | ||
658 | UUID regionID = UUID.Zero; | ||
659 | bool visibleToParent = true; | ||
660 | |||
661 | for (int i = 0; i < Parameter.Count; i++) | ||
662 | { | ||
663 | OSDMap item = (OSDMap)Parameter[i]; | ||
664 | // if (item.ContainsKey("version")) | ||
665 | // { | ||
666 | // version = item["version"].AsInteger(); | ||
667 | // } | ||
668 | if (item.ContainsKey("estate_id")) | ||
669 | { | ||
670 | estateID = item["estate_id"].AsInteger(); | ||
671 | } | ||
672 | if (item.ContainsKey("parent_estate_id")) | ||
673 | { | ||
674 | parentEstateID = item["parent_estate_id"].AsInteger(); | ||
675 | |||
676 | } | ||
677 | if (item.ContainsKey("region_id")) | ||
678 | { | ||
679 | regionID = item["region_id"].AsUUID(); | ||
680 | |||
681 | } | ||
682 | if (item.ContainsKey("visible_to_parent")) | ||
683 | { | ||
684 | visibleToParent = item["visible_to_parent"].AsBoolean(); | ||
685 | } | ||
686 | } | ||
687 | //Update our Circuit data with the real values | ||
688 | userData.SecureSessionID = SecureSessionID; | ||
689 | userData.SessionID = SessionID; | ||
690 | |||
691 | OGPState userState = GetOGPState(userData.AgentID); | ||
692 | |||
693 | // Locate a home scene suitable for the user. | ||
694 | Scene homeScene = null; | ||
695 | |||
696 | homeScene = GetScene(userState.teleported_into_region); | ||
697 | |||
698 | if (homeScene == null) | ||
699 | homeScene = GetRootScene(); | ||
700 | |||
701 | if (homeScene != null) | ||
702 | { | ||
703 | // Get a referenceokay - to their Cap object so we can pull out the capobjectroot | ||
704 | Caps userCap | ||
705 | = homeScene.CapsModule.GetCapsForUser(userData.AgentID); | ||
706 | |||
707 | //Update the circuit data in the region so this user is authorized | ||
708 | homeScene.UpdateCircuitData(userData); | ||
709 | homeScene.ChangeCircuitCode(userData.circuitcode,(uint)circuitcode); | ||
710 | |||
711 | // Load state | ||
712 | |||
713 | |||
714 | // Keep state changes | ||
715 | userState.first_name = requestMap["first_name"].AsString(); | ||
716 | userState.secure_session_id = requestMap["secure_session_id"].AsUUID(); | ||
717 | userState.age_verified = requestMap["age_verified"].AsBoolean(); | ||
718 | userState.region_id = homeScene.RegionInfo.originRegionID; // replace 0000000 with our regionid | ||
719 | userState.transacted = requestMap["transacted"].AsBoolean(); | ||
720 | userState.agent_access = requestMap["agent_access"].AsBoolean(); | ||
721 | userState.inventory_host = requestMap["inventory_host"].AsString(); | ||
722 | userState.identified = requestMap["identified"].AsBoolean(); | ||
723 | userState.session_id = requestMap["session_id"].AsUUID(); | ||
724 | userState.god_level = (uint)requestMap["god_level"].AsInteger(); | ||
725 | userState.last_name = requestMap["last_name"].AsString(); | ||
726 | userState.god_overide = requestMap["god_override"].AsBoolean(); | ||
727 | userState.circuit_code = (uint)requestMap["circuit_code"].AsInteger(); | ||
728 | userState.limited_to_estate = requestMap["limited_to_estate"].AsInteger(); | ||
729 | userState.src_estate_id = estateID; | ||
730 | userState.region_id = regionID; | ||
731 | userState.src_parent_estate_id = parentEstateID; | ||
732 | userState.visible_to_parent = visibleToParent; | ||
733 | |||
734 | // Save state changes | ||
735 | UpdateOGPState(userData.AgentID, userState); | ||
736 | |||
737 | // Get the region information for the home region. | ||
738 | RegionInfo reg = homeScene.RegionInfo; | ||
739 | |||
740 | // Dummy positional and look at info.. we don't have it. | ||
741 | OSDArray PositionArray = new OSDArray(); | ||
742 | PositionArray.Add(OSD.FromInteger(128)); | ||
743 | PositionArray.Add(OSD.FromInteger(128)); | ||
744 | PositionArray.Add(OSD.FromInteger(40)); | ||
745 | |||
746 | OSDArray LookAtArray = new OSDArray(); | ||
747 | LookAtArray.Add(OSD.FromInteger(1)); | ||
748 | LookAtArray.Add(OSD.FromInteger(1)); | ||
749 | LookAtArray.Add(OSD.FromInteger(1)); | ||
750 | |||
751 | // Our region's X and Y position in OpenSimulator space. | ||
752 | uint fooX = reg.RegionLocX; | ||
753 | uint fooY = reg.RegionLocY; | ||
754 | m_log.InfoFormat("[OGP]: region x({0}) region y({1})", fooX, fooY); | ||
755 | m_log.InfoFormat("[OGP]: region http {0} {1}", reg.ServerURI, reg.HttpPort); | ||
756 | m_log.InfoFormat("[OGO]: region UUID {0} ", reg.RegionID); | ||
757 | |||
758 | // Convert the X and Y position to LL space | ||
759 | responseMap["region_x"] = OSD.FromInteger(fooX * (uint)Constants.RegionSize); // convert it to LL X | ||
760 | responseMap["region_y"] = OSD.FromInteger(fooY * (uint)Constants.RegionSize); // convert it to LL Y | ||
761 | |||
762 | // Give em a new seed capability | ||
763 | responseMap["seed_capability"] = OSD.FromString("http://" + reg.ExternalHostName + ":" + reg.HttpPort + "/CAPS/" + userCap.CapsObjectPath + "0000/"); | ||
764 | responseMap["region"] = OSD.FromUUID(reg.originRegionID); | ||
765 | responseMap["look_at"] = LookAtArray; | ||
766 | |||
767 | responseMap["sim_port"] = OSD.FromInteger(reg.InternalEndPoint.Port); | ||
768 | responseMap["sim_host"] = OSD.FromString(reg.ExternalHostName);// + ":" + reg.InternalEndPoint.Port.ToString()); | ||
769 | |||
770 | // DEPRECATED | ||
771 | responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); | ||
772 | |||
773 | responseMap["session_id"] = OSD.FromUUID(SessionID); | ||
774 | responseMap["secure_session_id"] = OSD.FromUUID(SecureSessionID); | ||
775 | responseMap["circuit_code"] = OSD.FromInteger(circuitcode); | ||
776 | |||
777 | responseMap["position"] = PositionArray; | ||
778 | |||
779 | responseMap["region_id"] = OSD.FromUUID(reg.originRegionID); | ||
780 | |||
781 | responseMap["sim_access"] = OSD.FromString("Mature"); | ||
782 | |||
783 | responseMap["connect"] = OSD.FromBoolean(true); | ||
784 | |||
785 | |||
786 | |||
787 | m_log.InfoFormat("[OGP]: host: {0}, IP {1}", responseMap["sim_host"].ToString(), responseMap["sim_ip"].ToString()); | ||
788 | } | ||
789 | } | ||
790 | |||
791 | return responseMap; | ||
792 | } | ||
793 | |||
794 | public OSD DerezAvatarMethod(string path, OSD request) | ||
795 | { | ||
796 | m_log.ErrorFormat("DerezPath: {0}, Request: {1}", path, request.ToString()); | ||
797 | |||
798 | //LLSD llsdResponse = null; | ||
799 | OSDMap responseMap = new OSDMap(); | ||
800 | |||
801 | string[] PathArray = path.Split('/'); | ||
802 | m_log.InfoFormat("[OGP]: prefix {0}, uuid {1}, suffix {2}", PathArray[1], PathArray[2], PathArray[3]); | ||
803 | string uuidString = PathArray[2]; | ||
804 | m_log.InfoFormat("[OGP]: Request to Derez avatar with UUID {0}", uuidString); | ||
805 | UUID userUUID = UUID.Zero; | ||
806 | if (UUID.TryParse(uuidString, out userUUID)) | ||
807 | { | ||
808 | UUID RemoteID = (UUID)uuidString; | ||
809 | UUID LocalID = RemoteID; | ||
810 | // FIXME: TODO: Routine to map RemoteUUIDs to LocalUUIds | ||
811 | // would be done already.. but the client connects with the Aditi UUID | ||
812 | // regardless over the UDP stack | ||
813 | |||
814 | OGPState userState = GetOGPState(LocalID); | ||
815 | if (userState.agent_id != UUID.Zero) | ||
816 | { | ||
817 | //OSDMap outboundRequestMap = new OSDMap(); | ||
818 | OSDMap inboundRequestMap = (OSDMap)request; | ||
819 | string rezAvatarString = inboundRequestMap["rez_avatar"].AsString(); | ||
820 | if (rezAvatarString.Length == 0) | ||
821 | { | ||
822 | rezAvatarString = inboundRequestMap["rez_avatar/rez"].AsString(); | ||
823 | } | ||
824 | OSDArray LookAtArray = new OSDArray(); | ||
825 | LookAtArray.Add(OSD.FromInteger(1)); | ||
826 | LookAtArray.Add(OSD.FromInteger(1)); | ||
827 | LookAtArray.Add(OSD.FromInteger(1)); | ||
828 | |||
829 | OSDArray PositionArray = new OSDArray(); | ||
830 | PositionArray.Add(OSD.FromInteger(128)); | ||
831 | PositionArray.Add(OSD.FromInteger(128)); | ||
832 | PositionArray.Add(OSD.FromInteger(40)); | ||
833 | |||
834 | OSDArray lookArray = new OSDArray(); | ||
835 | lookArray.Add(OSD.FromInteger(128)); | ||
836 | lookArray.Add(OSD.FromInteger(128)); | ||
837 | lookArray.Add(OSD.FromInteger(40)); | ||
838 | |||
839 | responseMap["connect"] = OSD.FromBoolean(true);// it's okay to give this user up | ||
840 | responseMap["look_at"] = LookAtArray; | ||
841 | |||
842 | m_log.WarnFormat("[OGP]: Invoking rez_avatar on host:{0} for avatar: {1} {2}", rezAvatarString, userState.first_name, userState.last_name); | ||
843 | |||
844 | OSDMap rezResponseMap = invokeRezAvatarCap(responseMap, rezAvatarString,userState); | ||
845 | |||
846 | // If invoking it returned an error, parse and end | ||
847 | if (rezResponseMap.ContainsKey("connect")) | ||
848 | { | ||
849 | if (rezResponseMap["connect"].AsBoolean() == false) | ||
850 | { | ||
851 | return responseMap; | ||
852 | } | ||
853 | } | ||
854 | |||
855 | string rezRespSeedCap = ""; | ||
856 | |||
857 | // DEPRECATED | ||
858 | if (rezResponseMap.ContainsKey("seed_capability")) | ||
859 | rezRespSeedCap = rezResponseMap["seed_capability"].AsString(); | ||
860 | |||
861 | // REPLACEMENT | ||
862 | if (rezResponseMap.ContainsKey("region_seed_capability")) | ||
863 | rezRespSeedCap = rezResponseMap["region_seed_capability"].AsString(); | ||
864 | |||
865 | // REPLACEMENT | ||
866 | if (rezResponseMap.ContainsKey("rez_avatar/rez")) | ||
867 | rezRespSeedCap = rezResponseMap["rez_avatar/rez"].AsString(); | ||
868 | |||
869 | // DEPRECATED | ||
870 | string rezRespSim_ip = rezResponseMap["sim_ip"].AsString(); | ||
871 | |||
872 | string rezRespSim_host = rezResponseMap["sim_host"].AsString(); | ||
873 | |||
874 | int rrPort = rezResponseMap["sim_port"].AsInteger(); | ||
875 | int rrX = rezResponseMap["region_x"].AsInteger(); | ||
876 | int rrY = rezResponseMap["region_y"].AsInteger(); | ||
877 | m_log.ErrorFormat("X:{0}, Y:{1}", rrX, rrY); | ||
878 | UUID rrRID = rezResponseMap["region_id"].AsUUID(); | ||
879 | OSDArray RezResponsePositionArray = null; | ||
880 | string rrAccess = rezResponseMap["sim_access"].AsString(); | ||
881 | if (rezResponseMap.ContainsKey("position")) | ||
882 | { | ||
883 | RezResponsePositionArray = (OSDArray)rezResponseMap["position"]; | ||
884 | } | ||
885 | // DEPRECATED | ||
886 | responseMap["seed_capability"] = OSD.FromString(rezRespSeedCap); | ||
887 | |||
888 | // REPLACEMENT r3 | ||
889 | responseMap["region_seed_capability"] = OSD.FromString(rezRespSeedCap); | ||
890 | |||
891 | // DEPRECATED | ||
892 | responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(rezRespSim_ip).ToString()); | ||
893 | |||
894 | responseMap["sim_host"] = OSD.FromString(rezRespSim_host); | ||
895 | responseMap["sim_port"] = OSD.FromInteger(rrPort); | ||
896 | responseMap["region_x"] = OSD.FromInteger(rrX); | ||
897 | responseMap["region_y"] = OSD.FromInteger(rrY); | ||
898 | responseMap["region_id"] = OSD.FromUUID(rrRID); | ||
899 | responseMap["sim_access"] = OSD.FromString(rrAccess); | ||
900 | |||
901 | if (RezResponsePositionArray != null) | ||
902 | { | ||
903 | responseMap["position"] = RezResponsePositionArray; | ||
904 | } | ||
905 | responseMap["look_at"] = lookArray; | ||
906 | responseMap["connect"] = OSD.FromBoolean(true); | ||
907 | |||
908 | ShutdownConnection(LocalID,this); | ||
909 | // PLEASE STOP CHANGING THIS TO an M_LOG, M_LOG DOESN'T WORK ON MULTILINE .TOSTRINGS | ||
910 | Console.WriteLine("RESPONSEDEREZ: " + responseMap.ToString()); | ||
911 | return responseMap; | ||
912 | } | ||
913 | else | ||
914 | { | ||
915 | return GenerateNoStateMessage(LocalID); | ||
916 | } | ||
917 | } | ||
918 | else | ||
919 | { | ||
920 | return GenerateNoHandlerMessage(); | ||
921 | } | ||
922 | |||
923 | //return responseMap; | ||
924 | } | ||
925 | |||
926 | private OSDMap invokeRezAvatarCap(OSDMap responseMap, string CapAddress, OGPState userState) | ||
927 | { | ||
928 | Scene reg = GetRootScene(); | ||
929 | |||
930 | WebRequest DeRezRequest = WebRequest.Create(CapAddress); | ||
931 | DeRezRequest.Method = "POST"; | ||
932 | DeRezRequest.ContentType = "application/xml+llsd"; | ||
933 | |||
934 | OSDMap RAMap = new OSDMap(); | ||
935 | OSDMap AgentParms = new OSDMap(); | ||
936 | OSDMap RegionParms = new OSDMap(); | ||
937 | |||
938 | OSDArray Parameter = new OSDArray(2); | ||
939 | |||
940 | OSDMap version = new OSDMap(); | ||
941 | version["version"] = OSD.FromInteger(userState.src_version); | ||
942 | Parameter.Add(version); | ||
943 | |||
944 | OSDMap SrcData = new OSDMap(); | ||
945 | SrcData["estate_id"] = OSD.FromInteger(reg.RegionInfo.EstateSettings.EstateID); | ||
946 | SrcData["parent_estate_id"] = OSD.FromInteger((reg.RegionInfo.EstateSettings.ParentEstateID == 100 ? 1 : reg.RegionInfo.EstateSettings.ParentEstateID)); | ||
947 | SrcData["region_id"] = OSD.FromUUID(reg.RegionInfo.originRegionID); | ||
948 | SrcData["visible_to_parent"] = OSD.FromBoolean(userState.visible_to_parent); | ||
949 | Parameter.Add(SrcData); | ||
950 | |||
951 | AgentParms["first_name"] = OSD.FromString(userState.first_name); | ||
952 | AgentParms["last_name"] = OSD.FromString(userState.last_name); | ||
953 | AgentParms["agent_id"] = OSD.FromUUID(userState.agent_id); | ||
954 | RegionParms["region_id"] = OSD.FromUUID(userState.region_id); | ||
955 | AgentParms["circuit_code"] = OSD.FromInteger(userState.circuit_code); | ||
956 | AgentParms["secure_session_id"] = OSD.FromUUID(userState.secure_session_id); | ||
957 | AgentParms["session_id"] = OSD.FromUUID(userState.session_id); | ||
958 | AgentParms["agent_access"] = OSD.FromBoolean(userState.agent_access); | ||
959 | AgentParms["god_level"] = OSD.FromInteger(userState.god_level); | ||
960 | AgentParms["god_overide"] = OSD.FromBoolean(userState.god_overide); | ||
961 | AgentParms["identified"] = OSD.FromBoolean(userState.identified); | ||
962 | AgentParms["transacted"] = OSD.FromBoolean(userState.transacted); | ||
963 | AgentParms["age_verified"] = OSD.FromBoolean(userState.age_verified); | ||
964 | AgentParms["limited_to_estate"] = OSD.FromInteger(userState.limited_to_estate); | ||
965 | AgentParms["inventory_host"] = OSD.FromString(userState.inventory_host); | ||
966 | |||
967 | // version 1 | ||
968 | RAMap = AgentParms; | ||
969 | |||
970 | // Planned for version 2 | ||
971 | // RAMap["agent_params"] = AgentParms; | ||
972 | |||
973 | RAMap["region_params"] = RegionParms; | ||
974 | RAMap["parameter"] = Parameter; | ||
975 | |||
976 | string RAMapString = RAMap.ToString(); | ||
977 | m_log.InfoFormat("[OGP] RAMap string {0}", RAMapString); | ||
978 | OSD LLSDofRAMap = RAMap; // RENAME if this works | ||
979 | |||
980 | m_log.InfoFormat("[OGP]: LLSD of map as string was {0}", LLSDofRAMap.ToString()); | ||
981 | //m_log.InfoFormat("[OGP]: LLSD+XML: {0}", LLSDParser.SerializeXmlString(LLSDofRAMap)); | ||
982 | byte[] buffer = OSDParser.SerializeLLSDXmlBytes(LLSDofRAMap); | ||
983 | |||
984 | //string bufferDump = System.Text.Encoding.ASCII.GetString(buffer); | ||
985 | //m_log.InfoFormat("[OGP]: buffer form is {0}",bufferDump); | ||
986 | //m_log.InfoFormat("[OGP]: LLSD of map was {0}",buffer.Length); | ||
987 | |||
988 | Stream os = null; | ||
989 | try | ||
990 | { // send the Post | ||
991 | DeRezRequest.ContentLength = buffer.Length; //Count bytes to send | ||
992 | os = DeRezRequest.GetRequestStream(); | ||
993 | os.Write(buffer, 0, buffer.Length); //Send it | ||
994 | os.Close(); | ||
995 | m_log.InfoFormat("[OGP]: Derez Avatar Posted Rez Avatar request to remote sim {0}", CapAddress); | ||
996 | } | ||
997 | catch (WebException ex) | ||
998 | { | ||
999 | m_log.InfoFormat("[OGP] Bad send on de_rez_avatar {0}", ex.Message); | ||
1000 | responseMap["connect"] = OSD.FromBoolean(false); | ||
1001 | |||
1002 | return responseMap; | ||
1003 | } | ||
1004 | |||
1005 | m_log.Info("[OGP] waiting for a reply after rez avatar send"); | ||
1006 | string rez_avatar_reply = null; | ||
1007 | { // get the response | ||
1008 | try | ||
1009 | { | ||
1010 | WebResponse webResponse = DeRezRequest.GetResponse(); | ||
1011 | if (webResponse == null) | ||
1012 | { | ||
1013 | m_log.Info("[OGP:] Null reply on rez_avatar post"); | ||
1014 | } | ||
1015 | |||
1016 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | ||
1017 | rez_avatar_reply = sr.ReadToEnd().Trim(); | ||
1018 | m_log.InfoFormat("[OGP]: rez_avatar reply was {0} ", rez_avatar_reply); | ||
1019 | |||
1020 | } | ||
1021 | catch (WebException ex) | ||
1022 | { | ||
1023 | m_log.InfoFormat("[OGP]: exception on read after send of rez avatar {0}", ex.Message); | ||
1024 | responseMap["connect"] = OSD.FromBoolean(false); | ||
1025 | |||
1026 | return responseMap; | ||
1027 | } | ||
1028 | OSD rezResponse = null; | ||
1029 | try | ||
1030 | { | ||
1031 | rezResponse = OSDParser.DeserializeLLSDXml(rez_avatar_reply); | ||
1032 | |||
1033 | responseMap = (OSDMap)rezResponse; | ||
1034 | } | ||
1035 | catch (Exception ex) | ||
1036 | { | ||
1037 | m_log.InfoFormat("[OGP]: exception on parse of rez reply {0}", ex.Message); | ||
1038 | responseMap["connect"] = OSD.FromBoolean(false); | ||
1039 | |||
1040 | return responseMap; | ||
1041 | } | ||
1042 | } | ||
1043 | return responseMap; | ||
1044 | } | ||
1045 | |||
1046 | public OSD GenerateNoHandlerMessage() | ||
1047 | { | ||
1048 | OSDMap map = new OSDMap(); | ||
1049 | map["reason"] = OSD.FromString("LLSDRequest"); | ||
1050 | map["message"] = OSD.FromString("No handler registered for LLSD Requests"); | ||
1051 | map["login"] = OSD.FromString("false"); | ||
1052 | map["connect"] = OSD.FromString("false"); | ||
1053 | return map; | ||
1054 | } | ||
1055 | public OSD GenerateNoStateMessage(UUID passedAvatar) | ||
1056 | { | ||
1057 | OSDMap map = new OSDMap(); | ||
1058 | map["reason"] = OSD.FromString("derez failed"); | ||
1059 | map["message"] = OSD.FromString("Unable to locate OGP state for avatar " + passedAvatar.ToString()); | ||
1060 | map["login"] = OSD.FromString("false"); | ||
1061 | map["connect"] = OSD.FromString("false"); | ||
1062 | return map; | ||
1063 | } | ||
1064 | private bool TryGetAgentCircuitData(string path, out AgentCircuitData userdata) | ||
1065 | { | ||
1066 | userdata = null; | ||
1067 | lock (CapsLoginID) | ||
1068 | { | ||
1069 | if (CapsLoginID.ContainsKey(path)) | ||
1070 | { | ||
1071 | userdata = CapsLoginID[path]; | ||
1072 | DiscardUsedCap(path); | ||
1073 | return true; | ||
1074 | } | ||
1075 | } | ||
1076 | return false; | ||
1077 | } | ||
1078 | |||
1079 | private void DiscardUsedCap(string path) | ||
1080 | { | ||
1081 | CapsLoginID.Remove(path); | ||
1082 | } | ||
1083 | |||
1084 | private Scene GetRootScene() | ||
1085 | { | ||
1086 | Scene ReturnScene = null; | ||
1087 | lock (m_scene) | ||
1088 | { | ||
1089 | if (m_scene.Count > 0) | ||
1090 | { | ||
1091 | ReturnScene = m_scene[0]; | ||
1092 | } | ||
1093 | } | ||
1094 | |||
1095 | return ReturnScene; | ||
1096 | } | ||
1097 | |||
1098 | private Scene GetScene(string scenename) | ||
1099 | { | ||
1100 | Scene ReturnScene = null; | ||
1101 | lock (m_scene) | ||
1102 | { | ||
1103 | foreach (Scene s in m_scene) | ||
1104 | { | ||
1105 | if (s.RegionInfo.RegionName.ToLower() == scenename) | ||
1106 | { | ||
1107 | ReturnScene = s; | ||
1108 | break; | ||
1109 | } | ||
1110 | } | ||
1111 | } | ||
1112 | |||
1113 | return ReturnScene; | ||
1114 | } | ||
1115 | |||
1116 | private ulong GetOSCompatibleRegionHandle(RegionInfo reg) | ||
1117 | { | ||
1118 | return Util.UIntsToLong(reg.RegionLocX, reg.RegionLocY); | ||
1119 | } | ||
1120 | |||
1121 | private OGPState InitializeNewState() | ||
1122 | { | ||
1123 | OGPState returnState = new OGPState(); | ||
1124 | returnState.first_name = ""; | ||
1125 | returnState.last_name = ""; | ||
1126 | returnState.agent_id = UUID.Zero; | ||
1127 | returnState.local_agent_id = UUID.Zero; | ||
1128 | returnState.region_id = UUID.Zero; | ||
1129 | returnState.circuit_code = 0; | ||
1130 | returnState.secure_session_id = UUID.Zero; | ||
1131 | returnState.session_id = UUID.Zero; | ||
1132 | returnState.agent_access = true; | ||
1133 | returnState.god_level = 0; | ||
1134 | returnState.god_overide = false; | ||
1135 | returnState.identified = false; | ||
1136 | returnState.transacted = false; | ||
1137 | returnState.age_verified = false; | ||
1138 | returnState.limited_to_estate = 1; | ||
1139 | returnState.inventory_host = "http://inv4.mysql.aditi.lindenlab.com"; | ||
1140 | returnState.allow_redirect = true; | ||
1141 | returnState.sim_access = ""; | ||
1142 | returnState.src_can_see_mainland = true; | ||
1143 | returnState.src_estate_id = 1; | ||
1144 | returnState.src_version = 1; | ||
1145 | returnState.src_parent_estate_id = 1; | ||
1146 | returnState.visible_to_parent = true; | ||
1147 | returnState.teleported_into_region = ""; | ||
1148 | |||
1149 | return returnState; | ||
1150 | } | ||
1151 | |||
1152 | private OGPState GetOGPState(UUID agentId) | ||
1153 | { | ||
1154 | lock (m_OGPState) | ||
1155 | { | ||
1156 | if (m_OGPState.ContainsKey(agentId)) | ||
1157 | { | ||
1158 | return m_OGPState[agentId]; | ||
1159 | } | ||
1160 | else | ||
1161 | { | ||
1162 | return InitializeNewState(); | ||
1163 | } | ||
1164 | } | ||
1165 | } | ||
1166 | |||
1167 | public void DeleteOGPState(UUID agentId) | ||
1168 | { | ||
1169 | lock (m_OGPState) | ||
1170 | { | ||
1171 | if (m_OGPState.ContainsKey(agentId)) | ||
1172 | m_OGPState.Remove(agentId); | ||
1173 | } | ||
1174 | } | ||
1175 | |||
1176 | private void UpdateOGPState(UUID agentId, OGPState state) | ||
1177 | { | ||
1178 | lock (m_OGPState) | ||
1179 | { | ||
1180 | if (m_OGPState.ContainsKey(agentId)) | ||
1181 | { | ||
1182 | m_OGPState[agentId] = state; | ||
1183 | } | ||
1184 | else | ||
1185 | { | ||
1186 | m_OGPState.Add(agentId,state); | ||
1187 | } | ||
1188 | } | ||
1189 | } | ||
1190 | private bool SceneListDuplicateCheck(string str) | ||
1191 | { | ||
1192 | // no lock, called from locked space! | ||
1193 | bool found = false; | ||
1194 | |||
1195 | foreach (Scene s in m_scene) | ||
1196 | { | ||
1197 | if (s.RegionInfo.RegionName == str) | ||
1198 | { | ||
1199 | found = true; | ||
1200 | break; | ||
1201 | } | ||
1202 | } | ||
1203 | |||
1204 | return found; | ||
1205 | } | ||
1206 | |||
1207 | public void ShutdownConnection(UUID avatarId, OpenGridProtocolModule mod) | ||
1208 | { | ||
1209 | Scene homeScene = GetRootScene(); | ||
1210 | ScenePresence avatar = null; | ||
1211 | if (homeScene.TryGetScenePresence(avatarId,out avatar)) | ||
1212 | { | ||
1213 | KillAUser ku = new KillAUser(avatar,mod); | ||
1214 | Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true); | ||
1215 | } | ||
1216 | } | ||
1217 | |||
1218 | // private string CreateRandomStr(int len) | ||
1219 | // { | ||
1220 | // Random rnd = new Random(Environment.TickCount); | ||
1221 | // string returnstring = ""; | ||
1222 | // string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; | ||
1223 | // | ||
1224 | // for (int i = 0; i < len; i++) | ||
1225 | // { | ||
1226 | // returnstring += chars.Substring(rnd.Next(chars.Length), 1); | ||
1227 | // } | ||
1228 | // return returnstring; | ||
1229 | // } | ||
1230 | |||
1231 | // Temporary hack to allow teleporting to and from Vaak | ||
1232 | private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error) | ||
1233 | { | ||
1234 | //if (cert.Subject == "E=root@lindenlab.com, CN=*.vaak.lindenlab.com, O=\"Linden Lab, Inc.\", L=San Francisco, S=California, C=US") | ||
1235 | //{ | ||
1236 | return true; | ||
1237 | //} | ||
1238 | |||
1239 | //return false; | ||
1240 | } | ||
1241 | } | ||
1242 | |||
1243 | public class KillAUser | ||
1244 | { | ||
1245 | private ScenePresence avToBeKilled = null; | ||
1246 | private OpenGridProtocolModule m_mod = null; | ||
1247 | |||
1248 | public KillAUser(ScenePresence avatar, OpenGridProtocolModule mod) | ||
1249 | { | ||
1250 | avToBeKilled = avatar; | ||
1251 | m_mod = mod; | ||
1252 | } | ||
1253 | |||
1254 | public void ShutdownNoLogout() | ||
1255 | { | ||
1256 | UUID avUUID = UUID.Zero; | ||
1257 | |||
1258 | if (avToBeKilled != null) | ||
1259 | { | ||
1260 | avUUID = avToBeKilled.UUID; | ||
1261 | avToBeKilled.MakeChildAgent(); | ||
1262 | |||
1263 | avToBeKilled.ControllingClient.SendLogoutPacketWhenClosing = false; | ||
1264 | |||
1265 | int sleepMS = 30000; | ||
1266 | while (sleepMS > 0) | ||
1267 | { | ||
1268 | Watchdog.UpdateThread(); | ||
1269 | Thread.Sleep(1000); | ||
1270 | sleepMS -= 1000; | ||
1271 | } | ||
1272 | |||
1273 | // test for child agent because they might have come back | ||
1274 | if (avToBeKilled.IsChildAgent) | ||
1275 | { | ||
1276 | m_mod.DeleteOGPState(avUUID); | ||
1277 | avToBeKilled.ControllingClient.Close(); | ||
1278 | } | ||
1279 | } | ||
1280 | |||
1281 | Watchdog.RemoveThread(); | ||
1282 | } | ||
1283 | |||
1284 | } | ||
1285 | |||
1286 | public class MonoCert : ICertificatePolicy | ||
1287 | { | ||
1288 | #region ICertificatePolicy Members | ||
1289 | |||
1290 | public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) | ||
1291 | { | ||
1292 | return true; | ||
1293 | } | ||
1294 | |||
1295 | #endregion | ||
1296 | } | ||
1297 | } | ||
diff --git a/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs b/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5a8c4a2 --- /dev/null +++ b/OpenSim/Region/CoreModules/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,38 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | using Mono.Addins; | ||
5 | |||
6 | // General Information about an assembly is controlled through the following | ||
7 | // set of attributes. Change these attribute values to modify the information | ||
8 | // associated with an assembly. | ||
9 | [assembly: AssemblyTitle("OpenSim.Region.CoreModules")] | ||
10 | [assembly: AssemblyDescription("Core modules for OpenSim")] | ||
11 | [assembly: AssemblyConfiguration("")] | ||
12 | [assembly: AssemblyCompany("")] | ||
13 | [assembly: AssemblyProduct("OpenSim.Region.CoreModules.Properties")] | ||
14 | [assembly: AssemblyCopyright("Copyright © 2012")] | ||
15 | [assembly: AssemblyTrademark("")] | ||
16 | [assembly: AssemblyCulture("")] | ||
17 | |||
18 | // Setting ComVisible to false makes the types in this assembly not visible | ||
19 | // to COM components. If you need to access a type in this assembly from | ||
20 | // COM, set the ComVisible attribute to true on that type. | ||
21 | [assembly: ComVisible(false)] | ||
22 | |||
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
24 | [assembly: Guid("94f62dd1-bcf3-4218-9844-9a3996286e3e")] | ||
25 | |||
26 | // Version information for an assembly consists of the following four values: | ||
27 | // | ||
28 | // Major Version | ||
29 | // Minor Version | ||
30 | // Build Number | ||
31 | // Revision | ||
32 | // | ||
33 | [assembly: AssemblyVersion("0.7.5.*")] | ||
34 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
35 | |||
36 | [assembly: Addin("OpenSim.Region.CoreModules", "0.1")] | ||
37 | [assembly: AddinDependency("OpenSim", "0.5")] | ||
38 | |||
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml deleted file mode 100644 index 424e0ab..0000000 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ /dev/null | |||
@@ -1,90 +0,0 @@ | |||
1 | <Addin id="OpenSim.Region.CoreModules" version="0.3"> | ||
2 | <Runtime> | ||
3 | <Import assembly="OpenSim.Region.CoreModules.dll"/> | ||
4 | </Runtime> | ||
5 | |||
6 | <Dependencies> | ||
7 | <Addin id="OpenSim" version="0.5" /> | ||
8 | </Dependencies> | ||
9 | |||
10 | <Extension path = "/OpenSim/RegionModules"> | ||
11 | <RegionModule id="UserManagementModule" type="OpenSim.Region.CoreModules.Framework.UserManagement.UserManagementModule" /> | ||
12 | <RegionModule id="HGUserManagementModule" type="OpenSim.Region.CoreModules.Framework.UserManagement.HGUserManagementModule" /> | ||
13 | <RegionModule id="EntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule" /> | ||
14 | <RegionModule id="HGEntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule" /> | ||
15 | <RegionModule id="InventoryAccessModule" type="OpenSim.Region.CoreModules.Framework.InventoryAccess.BasicInventoryAccessModule" /> | ||
16 | <RegionModule id="HGInventoryAccessModule" type="OpenSim.Region.CoreModules.Framework.InventoryAccess.HGInventoryAccessModule" /> | ||
17 | <RegionModule id="LandManagementModule" type="OpenSim.Region.CoreModules.World.Land.LandManagementModule" /> | ||
18 | <RegionModule id="PrimCountModule" type="OpenSim.Region.CoreModules.World.Land.PrimCountModule" /> | ||
19 | <RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" /> | ||
20 | <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> | ||
21 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> | ||
22 | <RegionModule id="WorldMapModule" type="OpenSim.Region.CoreModules.World.WorldMap.WorldMapModule" /> | ||
23 | <RegionModule id="Warp3DImageModule" type="OpenSim.Region.CoreModules.World.Warp3DMap.Warp3DImageModule" /> | ||
24 | <RegionModule id="HGWorldMapModule" type="OpenSim.Region.CoreModules.Hypergrid.HGWorldMapModule" /> | ||
25 | <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" /> | ||
26 | <RegionModule id="Chat" type="OpenSim.Region.CoreModules.Avatar.Chat.ChatModule" /> | ||
27 | <RegionModule id="FriendsModule" type="OpenSim.Region.CoreModules.Avatar.Friends.FriendsModule" /> | ||
28 | <RegionModule id="HGFriendsModule" type="OpenSim.Region.CoreModules.Avatar.Friends.HGFriendsModule" /> | ||
29 | <RegionModule id="PresenceModule" type="OpenSim.Region.CoreModules.Avatar.InstantMessage.PresenceModule" /> | ||
30 | <RegionModule id="MuteListModule" type="OpenSim.Region.CoreModules.Avatar.InstantMessage.MuteListModule" /> | ||
31 | <RegionModule id="OfflineMessageModule" type="OpenSim.Region.CoreModules.Avatar.InstantMessage.OfflineMessageModule" /> | ||
32 | <RegionModule id="InstantMessageModule" type="OpenSim.Region.CoreModules.Avatar.InstantMessage.InstantMessageModule" /> | ||
33 | <RegionModule id="MessageTransferModule" type="OpenSim.Region.CoreModules.Avatar.InstantMessage.MessageTransferModule" /> | ||
34 | <RegionModule id="LureModule" type="OpenSim.Region.CoreModules.Avatar.Lure.LureModule" /> | ||
35 | <RegionModule id="InventoryTransferModule" type="OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.InventoryTransferModule" /> | ||
36 | <RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.CoreAssetCache" /> | ||
37 | <RegionModule id="GlynnTuckerAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" /> | ||
38 | <RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/> | ||
39 | <RegionModule id="LibraryModule" type="OpenSim.Region.CoreModules.Framework.Library.LibraryModule"/> | ||
40 | <!-- Service connectors OUT modules --> | ||
41 | <RegionModule id="LocalAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.LocalAssetServicesConnector" /> | ||
42 | <RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.RemoteAssetServicesConnector" /> | ||
43 | <RegionModule id="LocalAvatarServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar.LocalAvatarServicesConnector" /> | ||
44 | <RegionModule id="RemoteAvatarServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar.RemoteAvatarServicesConnector" /> | ||
45 | <RegionModule id="LocalAuthenticationServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication.LocalAuthenticationServicesConnector" /> | ||
46 | <RegionModule id="RemoteAuthenticationServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication.RemoteAuthenticationServicesConnector" /> | ||
47 | <RegionModule id="LocalAuthorizationServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization.LocalAuthorizationServicesConnector" /> | ||
48 | <RegionModule id="RemoteAuthorizationServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization.RemoteAuthorizationServicesConnector" /> | ||
49 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" /> | ||
50 | <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" /> | ||
51 | <RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" /> | ||
52 | <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> | ||
53 | <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> | ||
54 | <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> | ||
55 | <RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" /> | ||
56 | <RegionModule id="RemoteLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.RemoteLandServicesConnector" /> | ||
57 | <RegionModule id="LocalGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.LocalGridServicesConnector" /> | ||
58 | <RegionModule id="RemoteGridServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.RemoteGridServicesConnector" /> | ||
59 | <RegionModule id="LocalPresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.LocalPresenceServicesConnector" /> | ||
60 | <RegionModule id="RemotePresenceServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.RemotePresenceServicesConnector" /> | ||
61 | <RegionModule id="LocalUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.LocalUserAccountServicesConnector" /> | ||
62 | <RegionModule id="RemoteUserAccountServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts.RemoteUserAccountServicesConnector" /> | ||
63 | |||
64 | <RegionModule id="LocalGridUserServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser.LocalGridUserServicesConnector" /> | ||
65 | <RegionModule id="RemoteGridUserServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser.RemoteGridUserServicesConnector" /> | ||
66 | |||
67 | <RegionModule id="LocalSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.LocalSimulationConnectorModule" /> | ||
68 | <RegionModule id="RemoteSimulationConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation.RemoteSimulationConnectorModule" /> | ||
69 | |||
70 | <!-- Service connectors IN modules --> | ||
71 | <RegionModule id="AssetServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset.AssetServiceInConnectorModule" /> | ||
72 | <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" /> | ||
73 | <RegionModule id="LandServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Land.LandServiceInConnectorModule" /> | ||
74 | <RegionModule id="NeighbourServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour.NeighbourServiceInConnectorModule" /> \ | ||
75 | <RegionModule id="HypergridServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid.HypergridServiceInConnectorModule" /> \ | ||
76 | <RegionModule id="LLLoginServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Login.LLLoginServiceInConnectorModule" /> \ | ||
77 | <RegionModule id="SimulationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation.SimulationServiceInConnectorModule" /> \ | ||
78 | <RegionModule id="GridInfoServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.GridInfoServiceInConnectorModule" /> \ | ||
79 | <RegionModule id="AuthenticationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication.AuthenticationServiceInConnectorModule" /> | ||
80 | <RegionModule id="AccessModule" type="OpenSim.Region.CoreModules.World.AccessModule" /> \ | ||
81 | <RegionModule id="MapImageModule" type="OpenSim.Region.CoreModules.World.LegacyMap.MapImageModule" /> \ | ||
82 | |||
83 | </Extension> | ||
84 | |||
85 | <Extension path = "/OpenSim/WindModule"> | ||
86 | <WindModel id="ConfigurableWind" type="OpenSim.Region.CoreModules.World.Wind.Plugins.ConfigurableWind" /> | ||
87 | <WindModel id="SimpleRandomWind" type="OpenSim.Region.CoreModules.World.Wind.Plugins.SimpleRandomWind" /> | ||
88 | </Extension> | ||
89 | |||
90 | </Addin> | ||
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 93a045e..9d77b19 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -37,10 +37,12 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using log4net; | 38 | using log4net; |
39 | using System.Reflection; | 39 | using System.Reflection; |
40 | using Mono.Addins; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | 42 | namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture |
42 | { | 43 | { |
43 | public class DynamicTextureModule : IRegionModule, IDynamicTextureManager | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DynamicTextureModule")] |
45 | public class DynamicTextureModule : ISharedRegionModule, IDynamicTextureManager | ||
44 | { | 46 | { |
45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 48 | ||
@@ -81,6 +83,16 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
81 | /// </remarks> | 83 | /// </remarks> |
82 | private Cache m_reuseableDynamicTextures; | 84 | private Cache m_reuseableDynamicTextures; |
83 | 85 | ||
86 | /// <summary> | ||
87 | /// This constructor is only here because of the Unit Tests... | ||
88 | /// Don't use it. | ||
89 | /// </summary> | ||
90 | public DynamicTextureModule() | ||
91 | { | ||
92 | m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); | ||
93 | m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0); | ||
94 | } | ||
95 | |||
84 | #region IDynamicTextureManager Members | 96 | #region IDynamicTextureManager Members |
85 | 97 | ||
86 | public void RegisterRender(string handleType, IDynamicTextureRender render) | 98 | public void RegisterRender(string handleType, IDynamicTextureRender render) |
@@ -323,17 +335,30 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
323 | 335 | ||
324 | #endregion | 336 | #endregion |
325 | 337 | ||
326 | #region IRegionModule Members | 338 | #region ISharedRegionModule Members |
327 | 339 | ||
328 | public void Initialise(Scene scene, IConfigSource config) | 340 | public void Initialise(IConfigSource config) |
329 | { | 341 | { |
330 | IConfig texturesConfig = config.Configs["Textures"]; | 342 | IConfig texturesConfig = config.Configs["Textures"]; |
331 | if (texturesConfig != null) | 343 | if (texturesConfig != null) |
332 | { | 344 | { |
333 | ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false); | 345 | ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false); |
334 | ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false); | 346 | ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false); |
347 | |||
348 | if (ReuseTextures) | ||
349 | { | ||
350 | m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); | ||
351 | m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0); | ||
352 | } | ||
335 | } | 353 | } |
354 | } | ||
336 | 355 | ||
356 | public void PostInitialise() | ||
357 | { | ||
358 | } | ||
359 | |||
360 | public void AddRegion(Scene scene) | ||
361 | { | ||
337 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) | 362 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) |
338 | { | 363 | { |
339 | RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); | 364 | RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); |
@@ -341,13 +366,14 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
341 | } | 366 | } |
342 | } | 367 | } |
343 | 368 | ||
344 | public void PostInitialise() | 369 | public void RegionLoaded(Scene scene) |
345 | { | 370 | { |
346 | if (ReuseTextures) | 371 | } |
347 | { | 372 | |
348 | m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); | 373 | public void RemoveRegion(Scene scene) |
349 | m_reuseableDynamicTextures.DefaultTTL = new TimeSpan(24, 0, 0); | 374 | { |
350 | } | 375 | if (RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) |
376 | RegisteredScenes.Remove(scene.RegionInfo.RegionID); | ||
351 | } | 377 | } |
352 | 378 | ||
353 | public void Close() | 379 | public void Close() |
@@ -359,9 +385,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
359 | get { return "DynamicTextureModule"; } | 385 | get { return "DynamicTextureModule"; } |
360 | } | 386 | } |
361 | 387 | ||
362 | public bool IsSharedModule | 388 | public Type ReplaceableInterface |
363 | { | 389 | { |
364 | get { return true; } | 390 | get { return null; } |
365 | } | 391 | } |
366 | 392 | ||
367 | #endregion | 393 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs index e91e8b9..d943b20 100644 --- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs | |||
@@ -37,10 +37,12 @@ using OpenMetaverse; | |||
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using Mono.Addins; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Scripting.EmailModules | 42 | namespace OpenSim.Region.CoreModules.Scripting.EmailModules |
42 | { | 43 | { |
43 | public class EmailModule : IRegionModule, IEmailModule | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EmailModule")] |
45 | public class EmailModule : ISharedRegionModule, IEmailModule | ||
44 | { | 46 | { |
45 | // | 47 | // |
46 | // Log | 48 | // Log |
@@ -72,31 +74,9 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
72 | 74 | ||
73 | private bool m_Enabled = false; | 75 | private bool m_Enabled = false; |
74 | 76 | ||
75 | public void InsertEmail(UUID to, Email email) | 77 | #region ISharedRegionModule |
76 | { | ||
77 | // It's tempting to create the queue here. Don't; objects which have | ||
78 | // not yet called GetNextEmail should have no queue, and emails to them | ||
79 | // should be silently dropped. | ||
80 | |||
81 | lock (m_MailQueues) | ||
82 | { | ||
83 | if (m_MailQueues.ContainsKey(to)) | ||
84 | { | ||
85 | if (m_MailQueues[to].Count >= m_MaxQueueSize) | ||
86 | { | ||
87 | // fail silently | ||
88 | return; | ||
89 | } | ||
90 | |||
91 | lock (m_MailQueues[to]) | ||
92 | { | ||
93 | m_MailQueues[to].Add(email); | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | 78 | ||
99 | public void Initialise(Scene scene, IConfigSource config) | 79 | public void Initialise(IConfigSource config) |
100 | { | 80 | { |
101 | m_Config = config; | 81 | m_Config = config; |
102 | IConfig SMTPConfig; | 82 | IConfig SMTPConfig; |
@@ -129,36 +109,44 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
129 | SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); | 109 | SMTP_SERVER_PORT = SMTPConfig.GetInt("SMTP_SERVER_PORT", SMTP_SERVER_PORT); |
130 | SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); | 110 | SMTP_SERVER_LOGIN = SMTPConfig.GetString("SMTP_SERVER_LOGIN", SMTP_SERVER_LOGIN); |
131 | SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); | 111 | SMTP_SERVER_PASSWORD = SMTPConfig.GetString("SMTP_SERVER_PASSWORD", SMTP_SERVER_PASSWORD); |
132 | m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize); | 112 | m_MaxEmailSize = SMTPConfig.GetInt("email_max_size", m_MaxEmailSize); |
133 | } | 113 | } |
134 | catch (Exception e) | 114 | catch (Exception e) |
135 | { | 115 | { |
136 | m_log.Error("[EMAIL] DefaultEmailModule not configured: "+ e.Message); | 116 | m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message); |
137 | m_Enabled = false; | 117 | m_Enabled = false; |
138 | return; | 118 | return; |
139 | } | 119 | } |
140 | 120 | ||
141 | // It's a go! | 121 | } |
142 | if (m_Enabled) | 122 | |
123 | public void AddRegion(Scene scene) | ||
124 | { | ||
125 | if (!m_Enabled) | ||
126 | return; | ||
127 | |||
128 | // It's a go! | ||
129 | lock (m_Scenes) | ||
143 | { | 130 | { |
144 | lock (m_Scenes) | 131 | // Claim the interface slot |
145 | { | 132 | scene.RegisterModuleInterface<IEmailModule>(this); |
146 | // Claim the interface slot | ||
147 | scene.RegisterModuleInterface<IEmailModule>(this); | ||
148 | 133 | ||
149 | // Add to scene list | 134 | // Add to scene list |
150 | if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle)) | 135 | if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle)) |
151 | { | 136 | { |
152 | m_Scenes[scene.RegionInfo.RegionHandle] = scene; | 137 | m_Scenes[scene.RegionInfo.RegionHandle] = scene; |
153 | } | 138 | } |
154 | else | 139 | else |
155 | { | 140 | { |
156 | m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); | 141 | m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); |
157 | } | ||
158 | } | 142 | } |
159 | |||
160 | m_log.Info("[EMAIL] Activated DefaultEmailModule"); | ||
161 | } | 143 | } |
144 | |||
145 | m_log.Info("[EMAIL] Activated DefaultEmailModule"); | ||
146 | } | ||
147 | |||
148 | public void RemoveRegion(Scene scene) | ||
149 | { | ||
162 | } | 150 | } |
163 | 151 | ||
164 | public void PostInitialise() | 152 | public void PostInitialise() |
@@ -174,9 +162,39 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
174 | get { return "DefaultEmailModule"; } | 162 | get { return "DefaultEmailModule"; } |
175 | } | 163 | } |
176 | 164 | ||
177 | public bool IsSharedModule | 165 | public Type ReplaceableInterface |
166 | { | ||
167 | get { return null; } | ||
168 | } | ||
169 | |||
170 | public void RegionLoaded(Scene scene) | ||
178 | { | 171 | { |
179 | get { return true; } | 172 | } |
173 | |||
174 | #endregion | ||
175 | |||
176 | public void InsertEmail(UUID to, Email email) | ||
177 | { | ||
178 | // It's tempting to create the queue here. Don't; objects which have | ||
179 | // not yet called GetNextEmail should have no queue, and emails to them | ||
180 | // should be silently dropped. | ||
181 | |||
182 | lock (m_MailQueues) | ||
183 | { | ||
184 | if (m_MailQueues.ContainsKey(to)) | ||
185 | { | ||
186 | if (m_MailQueues[to].Count >= m_MaxQueueSize) | ||
187 | { | ||
188 | // fail silently | ||
189 | return; | ||
190 | } | ||
191 | |||
192 | lock (m_MailQueues[to]) | ||
193 | { | ||
194 | m_MailQueues[to].Add(email); | ||
195 | } | ||
196 | } | ||
197 | } | ||
180 | } | 198 | } |
181 | 199 | ||
182 | private bool IsLocal(UUID objectID) | 200 | private bool IsLocal(UUID objectID) |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index d328eb3..a676971 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -41,6 +41,7 @@ using OpenSim.Framework.Servers; | |||
41 | using OpenSim.Framework.Servers.HttpServer; | 41 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
44 | using Mono.Addins; | ||
44 | 45 | ||
45 | /***************************************************** | 46 | /***************************************************** |
46 | * | 47 | * |
@@ -87,7 +88,8 @@ using OpenSim.Region.Framework.Scenes; | |||
87 | 88 | ||
88 | namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | 89 | namespace OpenSim.Region.CoreModules.Scripting.HttpRequest |
89 | { | 90 | { |
90 | public class HttpRequestModule : IRegionModule, IHttpRequestModule | 91 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HttpRequestModule")] |
92 | public class HttpRequestModule : ISharedRegionModule, IHttpRequestModule | ||
91 | { | 93 | { |
92 | private object HttpListLock = new object(); | 94 | private object HttpListLock = new object(); |
93 | private int httpTimeout = 30000; | 95 | private int httpTimeout = 30000; |
@@ -270,24 +272,38 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
270 | 272 | ||
271 | #endregion | 273 | #endregion |
272 | 274 | ||
273 | #region IRegionModule Members | 275 | #region ISharedRegionModule Members |
274 | 276 | ||
275 | public void Initialise(Scene scene, IConfigSource config) | 277 | public void Initialise(IConfigSource config) |
276 | { | 278 | { |
277 | m_scene = scene; | ||
278 | |||
279 | m_scene.RegisterModuleInterface<IHttpRequestModule>(this); | ||
280 | |||
281 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); | 279 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); |
282 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); | 280 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); |
283 | 281 | ||
284 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); | 282 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); |
285 | } | 283 | } |
286 | 284 | ||
285 | public void AddRegion(Scene scene) | ||
286 | { | ||
287 | m_scene = scene; | ||
288 | |||
289 | m_scene.RegisterModuleInterface<IHttpRequestModule>(this); | ||
290 | } | ||
291 | |||
292 | public void RemoveRegion(Scene scene) | ||
293 | { | ||
294 | scene.UnregisterModuleInterface<IHttpRequestModule>(this); | ||
295 | if (scene == m_scene) | ||
296 | m_scene = null; | ||
297 | } | ||
298 | |||
287 | public void PostInitialise() | 299 | public void PostInitialise() |
288 | { | 300 | { |
289 | } | 301 | } |
290 | 302 | ||
303 | public void RegionLoaded(Scene scene) | ||
304 | { | ||
305 | } | ||
306 | |||
291 | public void Close() | 307 | public void Close() |
292 | { | 308 | { |
293 | } | 309 | } |
@@ -297,9 +313,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
297 | get { return m_name; } | 313 | get { return m_name; } |
298 | } | 314 | } |
299 | 315 | ||
300 | public bool IsSharedModule | 316 | public Type ReplaceableInterface |
301 | { | 317 | { |
302 | get { return true; } | 318 | get { return null; } |
303 | } | 319 | } |
304 | 320 | ||
305 | #endregion | 321 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 53a9679..a654477 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Collections; | 31 | using System.Collections; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using log4net; | 33 | using log4net; |
34 | using Mono.Addins; | ||
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
@@ -94,6 +95,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
94 | /// <summary> | 95 | /// <summary> |
95 | /// This module provides external URLs for in-world scripts. | 96 | /// This module provides external URLs for in-world scripts. |
96 | /// </summary> | 97 | /// </summary> |
98 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UrlModule")] | ||
97 | public class UrlModule : ISharedRegionModule, IUrlModule | 99 | public class UrlModule : ISharedRegionModule, IUrlModule |
98 | { | 100 | { |
99 | private static readonly ILog m_log = | 101 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 45e6527..65737fa 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs | |||
@@ -37,10 +37,12 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using log4net; | 38 | using log4net; |
39 | using System.Reflection; | 39 | using System.Reflection; |
40 | using Mono.Addins; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | 42 | namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL |
42 | { | 43 | { |
43 | public class LoadImageURLModule : IRegionModule, IDynamicTextureRender | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LoadImageURLModule")] |
45 | public class LoadImageURLModule : ISharedRegionModule, IDynamicTextureRender | ||
44 | { | 46 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 48 | ||
@@ -104,22 +106,32 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
104 | 106 | ||
105 | #endregion | 107 | #endregion |
106 | 108 | ||
107 | #region IRegionModule Members | 109 | #region ISharedRegionModule Members |
108 | 110 | ||
109 | public void Initialise(Scene scene, IConfigSource config) | 111 | public void Initialise(IConfigSource config) |
110 | { | 112 | { |
111 | if (m_scene == null) | ||
112 | { | ||
113 | m_scene = scene; | ||
114 | } | ||
115 | |||
116 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); | 113 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); |
117 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); | 114 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); |
118 | } | 115 | } |
119 | 116 | ||
120 | public void PostInitialise() | 117 | public void PostInitialise() |
121 | { | 118 | { |
122 | if (m_scene != null) | 119 | } |
120 | |||
121 | public void AddRegion(Scene scene) | ||
122 | { | ||
123 | if (m_scene == null) | ||
124 | m_scene = scene; | ||
125 | |||
126 | } | ||
127 | |||
128 | public void RemoveRegion(Scene scene) | ||
129 | { | ||
130 | } | ||
131 | |||
132 | public void RegionLoaded(Scene scene) | ||
133 | { | ||
134 | if (m_textureManager == null && m_scene == scene) | ||
123 | { | 135 | { |
124 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | 136 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); |
125 | if (m_textureManager != null) | 137 | if (m_textureManager != null) |
@@ -138,9 +150,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
138 | get { return m_name; } | 150 | get { return m_name; } |
139 | } | 151 | } |
140 | 152 | ||
141 | public bool IsSharedModule | 153 | public Type ReplaceableInterface |
142 | { | 154 | { |
143 | get { return true; } | 155 | get { return null; } |
144 | } | 156 | } |
145 | 157 | ||
146 | #endregion | 158 | #endregion |
@@ -172,6 +184,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
172 | 184 | ||
173 | private void HttpRequestReturn(IAsyncResult result) | 185 | private void HttpRequestReturn(IAsyncResult result) |
174 | { | 186 | { |
187 | if (m_textureManager == null) | ||
188 | { | ||
189 | m_log.WarnFormat("[LOADIMAGEURLMODULE]: No texture manager. Can't function."); | ||
190 | return; | ||
191 | } | ||
192 | |||
175 | RequestState state = (RequestState) result.AsyncState; | 193 | RequestState state = (RequestState) result.AsyncState; |
176 | WebRequest request = (WebRequest) state.Request; | 194 | WebRequest request = (WebRequest) state.Request; |
177 | Stream stream = null; | 195 | Stream stream = null; |
diff --git a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index 98396ff..f6e1d39 100644 --- a/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | |||
@@ -38,7 +38,7 @@ using OpenMetaverse; | |||
38 | using System.Linq; | 38 | using System.Linq; |
39 | using System.Linq.Expressions; | 39 | using System.Linq.Expressions; |
40 | 40 | ||
41 | namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | 41 | namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms |
42 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ScriptModuleCommsModule")] | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ScriptModuleCommsModule")] |
44 | class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms | 44 | class ScriptModuleCommsModule : INonSharedRegionModule, IScriptModuleComms |
@@ -361,6 +361,22 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms | |||
361 | return null; | 361 | return null; |
362 | } | 362 | } |
363 | 363 | ||
364 | /// <summary> | ||
365 | /// Get all registered constants | ||
366 | /// </summary> | ||
367 | public Dictionary<string, object> GetConstants() | ||
368 | { | ||
369 | Dictionary<string, object> ret = new Dictionary<string, object>(); | ||
370 | |||
371 | lock (m_constants) | ||
372 | { | ||
373 | foreach (KeyValuePair<string, object> kvp in m_constants) | ||
374 | ret[kvp.Key] = kvp.Value; | ||
375 | } | ||
376 | |||
377 | return ret; | ||
378 | } | ||
379 | |||
364 | #endregion | 380 | #endregion |
365 | 381 | ||
366 | } | 382 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index b4e3d77..689e8a7 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -40,12 +40,14 @@ using OpenSim.Region.Framework.Interfaces; | |||
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using log4net; | 41 | using log4net; |
42 | using System.Reflection; | 42 | using System.Reflection; |
43 | using Mono.Addins; | ||
43 | 44 | ||
44 | //using Cairo; | 45 | //using Cairo; |
45 | 46 | ||
46 | namespace OpenSim.Region.CoreModules.Scripting.VectorRender | 47 | namespace OpenSim.Region.CoreModules.Scripting.VectorRender |
47 | { | 48 | { |
48 | public class VectorRenderModule : IRegionModule, IDynamicTextureRender | 49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VectorRenderModule")] |
50 | public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender | ||
49 | { | 51 | { |
50 | // These fields exist for testing purposes, please do not remove. | 52 | // These fields exist for testing purposes, please do not remove. |
51 | // private static bool s_flipper; | 53 | // private static bool s_flipper; |
@@ -56,6 +58,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
56 | 58 | ||
57 | private Scene m_scene; | 59 | private Scene m_scene; |
58 | private IDynamicTextureManager m_textureManager; | 60 | private IDynamicTextureManager m_textureManager; |
61 | |||
59 | private Graphics m_graph; | 62 | private Graphics m_graph; |
60 | private string m_fontName = "Arial"; | 63 | private string m_fontName = "Arial"; |
61 | 64 | ||
@@ -103,6 +106,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
103 | 106 | ||
104 | public bool AsyncConvertData(UUID id, string bodyData, string extraParams) | 107 | public bool AsyncConvertData(UUID id, string bodyData, string extraParams) |
105 | { | 108 | { |
109 | if (m_textureManager == null) | ||
110 | { | ||
111 | m_log.Warn("[VECTORRENDERMODULE]: No texture manager. Can't function"); | ||
112 | return false; | ||
113 | } | ||
106 | // XXX: This isn't actually being done asynchronously! | 114 | // XXX: This isn't actually being done asynchronously! |
107 | m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); | 115 | m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); |
108 | 116 | ||
@@ -131,45 +139,49 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
131 | 139 | ||
132 | #endregion | 140 | #endregion |
133 | 141 | ||
134 | #region IRegionModule Members | 142 | #region ISharedRegionModule Members |
135 | 143 | ||
136 | public void Initialise(Scene scene, IConfigSource config) | 144 | public void Initialise(IConfigSource config) |
137 | { | 145 | { |
138 | if (m_scene == null) | ||
139 | { | ||
140 | m_scene = scene; | ||
141 | } | ||
142 | |||
143 | if (m_graph == null) | ||
144 | { | ||
145 | // We won't dispose of these explicitly since this module is only removed when the entire simulator | ||
146 | // is shut down. | ||
147 | Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); | ||
148 | m_graph = Graphics.FromImage(bitmap); | ||
149 | } | ||
150 | |||
151 | IConfig cfg = config.Configs["VectorRender"]; | 146 | IConfig cfg = config.Configs["VectorRender"]; |
152 | if (null != cfg) | 147 | if (null != cfg) |
153 | { | 148 | { |
154 | m_fontName = cfg.GetString("font_name", m_fontName); | 149 | m_fontName = cfg.GetString("font_name", m_fontName); |
155 | } | 150 | } |
156 | m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); | 151 | m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); |
152 | |||
153 | // We won't dispose of these explicitly since this module is only removed when the entire simulator | ||
154 | // is shut down. | ||
155 | Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); | ||
156 | m_graph = Graphics.FromImage(bitmap); | ||
157 | } | 157 | } |
158 | 158 | ||
159 | public void PostInitialise() | 159 | public void PostInitialise() |
160 | { | 160 | { |
161 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | 161 | } |
162 | if (m_textureManager != null) | 162 | |
163 | public void AddRegion(Scene scene) | ||
164 | { | ||
165 | if (m_scene == null) | ||
163 | { | 166 | { |
164 | m_textureManager.RegisterRender(GetContentType(), this); | 167 | m_scene = scene; |
165 | } | 168 | } |
169 | } | ||
166 | 170 | ||
167 | // This code exists for testing purposes, please do not remove. | 171 | public void RegionLoaded(Scene scene) |
168 | // s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data; | 172 | { |
169 | // s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data; | 173 | if (m_textureManager == null && m_scene == scene) |
174 | { | ||
175 | m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); | ||
176 | if (m_textureManager != null) | ||
177 | { | ||
178 | m_textureManager.RegisterRender(GetContentType(), this); | ||
179 | } | ||
180 | } | ||
181 | } | ||
170 | 182 | ||
171 | // Terrain dirt - smallest bin/assets file (6004 bytes) | 183 | public void RemoveRegion(Scene scene) |
172 | // s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data; | 184 | { |
173 | } | 185 | } |
174 | 186 | ||
175 | public void Close() | 187 | public void Close() |
@@ -181,9 +193,9 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
181 | get { return "VectorRenderModule"; } | 193 | get { return "VectorRenderModule"; } |
182 | } | 194 | } |
183 | 195 | ||
184 | public bool IsSharedModule | 196 | public Type ReplaceableInterface |
185 | { | 197 | { |
186 | get { return true; } | 198 | get { return null; } |
187 | } | 199 | } |
188 | 200 | ||
189 | #endregion | 201 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 8358bc0..2c2c99c 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs | |||
@@ -28,8 +28,13 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text.RegularExpressions; | ||
32 | |||
31 | using Nini.Config; | 33 | using Nini.Config; |
34 | using Mono.Addins; | ||
35 | |||
32 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | |||
33 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
@@ -85,7 +90,8 @@ using OpenSim.Region.Framework.Scenes; | |||
85 | 90 | ||
86 | namespace OpenSim.Region.CoreModules.Scripting.WorldComm | 91 | namespace OpenSim.Region.CoreModules.Scripting.WorldComm |
87 | { | 92 | { |
88 | public class WorldCommModule : IRegionModule, IWorldComm | 93 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldCommModule")] |
94 | public class WorldCommModule : IWorldComm, INonSharedRegionModule | ||
89 | { | 95 | { |
90 | // private static readonly ILog m_log = | 96 | // private static readonly ILog m_log = |
91 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 97 | // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -98,9 +104,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
98 | private int m_saydistance = 20; | 104 | private int m_saydistance = 20; |
99 | private int m_shoutdistance = 100; | 105 | private int m_shoutdistance = 100; |
100 | 106 | ||
101 | #region IRegionModule Members | 107 | #region INonSharedRegionModule Members |
102 | 108 | ||
103 | public void Initialise(Scene scene, IConfigSource config) | 109 | public void Initialise(IConfigSource config) |
104 | { | 110 | { |
105 | // wrap this in a try block so that defaults will work if | 111 | // wrap this in a try block so that defaults will work if |
106 | // the config file doesn't specify otherwise. | 112 | // the config file doesn't specify otherwise. |
@@ -108,29 +114,49 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
108 | int maxhandles = 64; | 114 | int maxhandles = 64; |
109 | try | 115 | try |
110 | { | 116 | { |
111 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 117 | m_whisperdistance = config.Configs["Chat"].GetInt( |
112 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 118 | "whisper_distance", m_whisperdistance); |
113 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 119 | m_saydistance = config.Configs["Chat"].GetInt( |
114 | maxlisteners = config.Configs["LL-Functions"].GetInt("max_listens_per_region", maxlisteners); | 120 | "say_distance", m_saydistance); |
115 | maxhandles = config.Configs["LL-Functions"].GetInt("max_listens_per_script", maxhandles); | 121 | m_shoutdistance = config.Configs["Chat"].GetInt( |
122 | "shout_distance", m_shoutdistance); | ||
123 | maxlisteners = config.Configs["LL-Functions"].GetInt( | ||
124 | "max_listens_per_region", maxlisteners); | ||
125 | maxhandles = config.Configs["LL-Functions"].GetInt( | ||
126 | "max_listens_per_script", maxhandles); | ||
116 | } | 127 | } |
117 | catch (Exception) | 128 | catch (Exception) |
118 | { | 129 | { |
119 | } | 130 | } |
120 | if (maxlisteners < 1) maxlisteners = int.MaxValue; | 131 | if (maxlisteners < 1) maxlisteners = int.MaxValue; |
121 | if (maxhandles < 1) maxhandles = int.MaxValue; | 132 | if (maxhandles < 1) maxhandles = int.MaxValue; |
133 | m_listenerManager = new ListenerManager(maxlisteners, maxhandles); | ||
134 | m_pendingQ = new Queue(); | ||
135 | m_pending = Queue.Synchronized(m_pendingQ); | ||
136 | } | ||
122 | 137 | ||
138 | public void PostInitialise() | ||
139 | { | ||
140 | } | ||
141 | |||
142 | public void AddRegion(Scene scene) | ||
143 | { | ||
123 | m_scene = scene; | 144 | m_scene = scene; |
124 | m_scene.RegisterModuleInterface<IWorldComm>(this); | 145 | m_scene.RegisterModuleInterface<IWorldComm>(this); |
125 | m_listenerManager = new ListenerManager(maxlisteners, maxhandles); | ||
126 | m_scene.EventManager.OnChatFromClient += DeliverClientMessage; | 146 | m_scene.EventManager.OnChatFromClient += DeliverClientMessage; |
127 | m_scene.EventManager.OnChatBroadcast += DeliverClientMessage; | 147 | m_scene.EventManager.OnChatBroadcast += DeliverClientMessage; |
128 | m_pendingQ = new Queue(); | ||
129 | m_pending = Queue.Synchronized(m_pendingQ); | ||
130 | } | 148 | } |
131 | 149 | ||
132 | public void PostInitialise() | 150 | public void RegionLoaded(Scene scene) { } |
151 | |||
152 | public void RemoveRegion(Scene scene) | ||
133 | { | 153 | { |
154 | if (scene != m_scene) | ||
155 | return; | ||
156 | |||
157 | m_scene.UnregisterModuleInterface<IWorldComm>(this); | ||
158 | m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage; | ||
159 | m_scene.EventManager.OnChatBroadcast -= DeliverClientMessage; | ||
134 | } | 160 | } |
135 | 161 | ||
136 | public void Close() | 162 | public void Close() |
@@ -142,10 +168,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
142 | get { return "WorldCommModule"; } | 168 | get { return "WorldCommModule"; } |
143 | } | 169 | } |
144 | 170 | ||
145 | public bool IsSharedModule | 171 | public Type ReplaceableInterface { get { return null; } } |
146 | { | ||
147 | get { return false; } | ||
148 | } | ||
149 | 172 | ||
150 | #endregion | 173 | #endregion |
151 | 174 | ||
@@ -170,12 +193,42 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
170 | /// <param name="hostID">UUID of the SceneObjectPart</param> | 193 | /// <param name="hostID">UUID of the SceneObjectPart</param> |
171 | /// <param name="channel">channel to listen on</param> | 194 | /// <param name="channel">channel to listen on</param> |
172 | /// <param name="name">name to filter on</param> | 195 | /// <param name="name">name to filter on</param> |
173 | /// <param name="id">key to filter on (user given, could be totally faked)</param> | 196 | /// <param name="id"> |
197 | /// key to filter on (user given, could be totally faked) | ||
198 | /// </param> | ||
174 | /// <param name="msg">msg to filter on</param> | 199 | /// <param name="msg">msg to filter on</param> |
175 | /// <returns>number of the scripts handle</returns> | 200 | /// <returns>number of the scripts handle</returns> |
176 | public int Listen(uint localID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg) | 201 | public int Listen(uint localID, UUID itemID, UUID hostID, int channel, |
202 | string name, UUID id, string msg) | ||
177 | { | 203 | { |
178 | return m_listenerManager.AddListener(localID, itemID, hostID, channel, name, id, msg); | 204 | return m_listenerManager.AddListener(localID, itemID, hostID, |
205 | channel, name, id, msg); | ||
206 | } | ||
207 | |||
208 | /// <summary> | ||
209 | /// Create a listen event callback with the specified filters. | ||
210 | /// The parameters localID,itemID are needed to uniquely identify | ||
211 | /// the script during 'peek' time. Parameter hostID is needed to | ||
212 | /// determine the position of the script. | ||
213 | /// </summary> | ||
214 | /// <param name="localID">localID of the script engine</param> | ||
215 | /// <param name="itemID">UUID of the script engine</param> | ||
216 | /// <param name="hostID">UUID of the SceneObjectPart</param> | ||
217 | /// <param name="channel">channel to listen on</param> | ||
218 | /// <param name="name">name to filter on</param> | ||
219 | /// <param name="id"> | ||
220 | /// key to filter on (user given, could be totally faked) | ||
221 | /// </param> | ||
222 | /// <param name="msg">msg to filter on</param> | ||
223 | /// <param name="regexBitfield"> | ||
224 | /// Bitfield indicating which strings should be processed as regex. | ||
225 | /// </param> | ||
226 | /// <returns>number of the scripts handle</returns> | ||
227 | public int Listen(uint localID, UUID itemID, UUID hostID, int channel, | ||
228 | string name, UUID id, string msg, int regexBitfield) | ||
229 | { | ||
230 | return m_listenerManager.AddListener(localID, itemID, hostID, | ||
231 | channel, name, id, msg, regexBitfield); | ||
179 | } | 232 | } |
180 | 233 | ||
181 | /// <summary> | 234 | /// <summary> |
@@ -224,7 +277,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
224 | 277 | ||
225 | if ((source = m_scene.GetSceneObjectPart(id)) != null) | 278 | if ((source = m_scene.GetSceneObjectPart(id)) != null) |
226 | position = source.AbsolutePosition; | 279 | position = source.AbsolutePosition; |
227 | else if ((avatar = m_scene.GetScenePresence(id)) != null) | 280 | else if ((avatar = m_scene.GetScenePresence(id)) != null) |
228 | position = avatar.AbsolutePosition; | 281 | position = avatar.AbsolutePosition; |
229 | else if (ChatTypeEnum.Region == type) | 282 | else if (ChatTypeEnum.Region == type) |
230 | position = CenterOfRegion; | 283 | position = CenterOfRegion; |
@@ -247,7 +300,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
247 | /// <param name="name">name of sender (object or avatar)</param> | 300 | /// <param name="name">name of sender (object or avatar)</param> |
248 | /// <param name="id">key of sender (object or avatar)</param> | 301 | /// <param name="id">key of sender (object or avatar)</param> |
249 | /// <param name="msg">msg to sent</param> | 302 | /// <param name="msg">msg to sent</param> |
250 | public void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg, Vector3 position) | 303 | public void DeliverMessage(ChatTypeEnum type, int channel, |
304 | string name, UUID id, string msg, Vector3 position) | ||
251 | { | 305 | { |
252 | // m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", | 306 | // m_log.DebugFormat("[WorldComm] got[2] type {0}, channel {1}, name {2}, id {3}, msg {4}", |
253 | // type, channel, name, id, msg); | 307 | // type, channel, name, id, msg); |
@@ -255,17 +309,21 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
255 | // Determine which listen event filters match the given set of arguments, this results | 309 | // Determine which listen event filters match the given set of arguments, this results |
256 | // in a limited set of listeners, each belonging a host. If the host is in range, add them | 310 | // in a limited set of listeners, each belonging a host. If the host is in range, add them |
257 | // to the pending queue. | 311 | // to the pending queue. |
258 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 312 | foreach (ListenerInfo li |
313 | in m_listenerManager.GetListeners(UUID.Zero, channel, | ||
314 | name, id, msg)) | ||
259 | { | 315 | { |
260 | // Dont process if this message is from yourself! | 316 | // Dont process if this message is from yourself! |
261 | if (li.GetHostID().Equals(id)) | 317 | if (li.GetHostID().Equals(id)) |
262 | continue; | 318 | continue; |
263 | 319 | ||
264 | SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID()); | 320 | SceneObjectPart sPart = m_scene.GetSceneObjectPart( |
321 | li.GetHostID()); | ||
265 | if (sPart == null) | 322 | if (sPart == null) |
266 | continue; | 323 | continue; |
267 | 324 | ||
268 | double dis = Util.GetDistanceTo(sPart.AbsolutePosition, position); | 325 | double dis = Util.GetDistanceTo(sPart.AbsolutePosition, |
326 | position); | ||
269 | switch (type) | 327 | switch (type) |
270 | { | 328 | { |
271 | case ChatTypeEnum.Whisper: | 329 | case ChatTypeEnum.Whisper: |
@@ -308,14 +366,16 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
308 | /// <param name='msg'> | 366 | /// <param name='msg'> |
309 | /// Message. | 367 | /// Message. |
310 | /// </param> | 368 | /// </param> |
311 | public void DeliverMessageTo(UUID target, int channel, Vector3 pos, string name, UUID id, string msg) | 369 | public void DeliverMessageTo(UUID target, int channel, Vector3 pos, |
370 | string name, UUID id, string msg) | ||
312 | { | 371 | { |
313 | // Is id an avatar? | 372 | // Is id an avatar? |
314 | ScenePresence sp = m_scene.GetScenePresence(target); | 373 | ScenePresence sp = m_scene.GetScenePresence(target); |
315 | 374 | ||
316 | if (sp != null) | 375 | if (sp != null) |
317 | { | 376 | { |
318 | // ignore if a child agent this is restricted to inside one region | 377 | // ignore if a child agent this is restricted to inside one |
378 | // region | ||
319 | if (sp.IsChildAgent) | 379 | if (sp.IsChildAgent) |
320 | return; | 380 | return; |
321 | 381 | ||
@@ -324,8 +384,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
324 | // non zero channel messages only go to the attachments | 384 | // non zero channel messages only go to the attachments |
325 | if (channel == 0) | 385 | if (channel == 0) |
326 | { | 386 | { |
327 | m_scene.SimChatToAgent(target, Utils.StringToBytes(msg), pos, name, id, false); | 387 | m_scene.SimChatToAgent(target, Utils.StringToBytes(msg), |
328 | } | 388 | pos, name, id, false); |
389 | } | ||
329 | else | 390 | else |
330 | { | 391 | { |
331 | List<SceneObjectGroup> attachments = sp.GetAttachments(); | 392 | List<SceneObjectGroup> attachments = sp.GetAttachments(); |
@@ -341,13 +402,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
341 | } | 402 | } |
342 | 403 | ||
343 | // Need to check each attachment | 404 | // Need to check each attachment |
344 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 405 | foreach (ListenerInfo li |
406 | in m_listenerManager.GetListeners(UUID.Zero, | ||
407 | channel, name, id, msg)) | ||
345 | { | 408 | { |
346 | if (li.GetHostID().Equals(id)) | 409 | if (li.GetHostID().Equals(id)) |
347 | continue; | 410 | continue; |
348 | 411 | ||
349 | if (m_scene.GetSceneObjectPart(li.GetHostID()) == null) | 412 | if (m_scene.GetSceneObjectPart( |
413 | li.GetHostID()) == null) | ||
414 | { | ||
350 | continue; | 415 | continue; |
416 | } | ||
351 | 417 | ||
352 | if (targets.Contains(li.GetHostID())) | 418 | if (targets.Contains(li.GetHostID())) |
353 | QueueMessage(new ListenerInfo(li, name, id, msg)); | 419 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
@@ -358,17 +424,20 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
358 | } | 424 | } |
359 | 425 | ||
360 | // No avatar found so look for an object | 426 | // No avatar found so look for an object |
361 | foreach (ListenerInfo li in m_listenerManager.GetListeners(UUID.Zero, channel, name, id, msg)) | 427 | foreach (ListenerInfo li |
428 | in m_listenerManager.GetListeners(UUID.Zero, channel, | ||
429 | name, id, msg)) | ||
362 | { | 430 | { |
363 | // Dont process if this message is from yourself! | 431 | // Dont process if this message is from yourself! |
364 | if (li.GetHostID().Equals(id)) | 432 | if (li.GetHostID().Equals(id)) |
365 | continue; | 433 | continue; |
366 | 434 | ||
367 | SceneObjectPart sPart = m_scene.GetSceneObjectPart(li.GetHostID()); | 435 | SceneObjectPart sPart = m_scene.GetSceneObjectPart( |
436 | li.GetHostID()); | ||
368 | if (sPart == null) | 437 | if (sPart == null) |
369 | continue; | 438 | continue; |
370 | 439 | ||
371 | if ( li.GetHostID().Equals(target)) | 440 | if (li.GetHostID().Equals(target)) |
372 | { | 441 | { |
373 | QueueMessage(new ListenerInfo(li, name, id, msg)); | 442 | QueueMessage(new ListenerInfo(li, name, id, msg)); |
374 | break; | 443 | break; |
@@ -422,9 +491,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
422 | private void DeliverClientMessage(Object sender, OSChatMessage e) | 491 | private void DeliverClientMessage(Object sender, OSChatMessage e) |
423 | { | 492 | { |
424 | if (null != e.Sender) | 493 | if (null != e.Sender) |
425 | DeliverMessage(e.Type, e.Channel, e.Sender.Name, e.Sender.AgentId, e.Message, e.Position); | 494 | { |
495 | DeliverMessage(e.Type, e.Channel, e.Sender.Name, | ||
496 | e.Sender.AgentId, e.Message, e.Position); | ||
497 | } | ||
426 | else | 498 | else |
427 | DeliverMessage(e.Type, e.Channel, e.From, UUID.Zero, e.Message, e.Position); | 499 | { |
500 | DeliverMessage(e.Type, e.Channel, e.From, UUID.Zero, | ||
501 | e.Message, e.Position); | ||
502 | } | ||
428 | } | 503 | } |
429 | 504 | ||
430 | public Object[] GetSerializationData(UUID itemID) | 505 | public Object[] GetSerializationData(UUID itemID) |
@@ -441,7 +516,8 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
441 | 516 | ||
442 | public class ListenerManager | 517 | public class ListenerManager |
443 | { | 518 | { |
444 | private Dictionary<int, List<ListenerInfo>> m_listeners = new Dictionary<int, List<ListenerInfo>>(); | 519 | private Dictionary<int, List<ListenerInfo>> m_listeners = |
520 | new Dictionary<int, List<ListenerInfo>>(); | ||
445 | private int m_maxlisteners; | 521 | private int m_maxlisteners; |
446 | private int m_maxhandles; | 522 | private int m_maxhandles; |
447 | private int m_curlisteners; | 523 | private int m_curlisteners; |
@@ -465,15 +541,25 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
465 | m_curlisteners = 0; | 541 | m_curlisteners = 0; |
466 | } | 542 | } |
467 | 543 | ||
468 | public int AddListener(uint localID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg) | 544 | public int AddListener(uint localID, UUID itemID, UUID hostID, |
545 | int channel, string name, UUID id, string msg) | ||
546 | { | ||
547 | return AddListener(localID, itemID, hostID, channel, name, id, | ||
548 | msg, 0); | ||
549 | } | ||
550 | |||
551 | public int AddListener(uint localID, UUID itemID, UUID hostID, | ||
552 | int channel, string name, UUID id, string msg, | ||
553 | int regexBitfield) | ||
469 | { | 554 | { |
470 | // do we already have a match on this particular filter event? | 555 | // do we already have a match on this particular filter event? |
471 | List<ListenerInfo> coll = GetListeners(itemID, channel, name, id, msg); | 556 | List<ListenerInfo> coll = GetListeners(itemID, channel, name, id, |
557 | msg); | ||
472 | 558 | ||
473 | if (coll.Count > 0) | 559 | if (coll.Count > 0) |
474 | { | 560 | { |
475 | // special case, called with same filter settings, return same handle | 561 | // special case, called with same filter settings, return same |
476 | // (2008-05-02, tested on 1.21.1 server, still holds) | 562 | // handle (2008-05-02, tested on 1.21.1 server, still holds) |
477 | return coll[0].GetHandle(); | 563 | return coll[0].GetHandle(); |
478 | } | 564 | } |
479 | 565 | ||
@@ -485,16 +571,19 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
485 | 571 | ||
486 | if (newHandle > 0) | 572 | if (newHandle > 0) |
487 | { | 573 | { |
488 | ListenerInfo li = new ListenerInfo(newHandle, localID, itemID, hostID, channel, name, id, msg); | 574 | ListenerInfo li = new ListenerInfo(newHandle, localID, |
575 | itemID, hostID, channel, name, id, msg, | ||
576 | regexBitfield); | ||
489 | 577 | ||
490 | List<ListenerInfo> listeners; | 578 | List<ListenerInfo> listeners; |
491 | if (!m_listeners.TryGetValue(channel,out listeners)) | 579 | if (!m_listeners.TryGetValue( |
492 | { | 580 | channel, out listeners)) |
493 | listeners = new List<ListenerInfo>(); | 581 | { |
494 | m_listeners.Add(channel, listeners); | 582 | listeners = new List<ListenerInfo>(); |
495 | } | 583 | m_listeners.Add(channel, listeners); |
496 | listeners.Add(li); | 584 | } |
497 | m_curlisteners++; | 585 | listeners.Add(li); |
586 | m_curlisteners++; | ||
498 | 587 | ||
499 | return newHandle; | 588 | return newHandle; |
500 | } | 589 | } |
@@ -507,11 +596,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
507 | { | 596 | { |
508 | lock (m_listeners) | 597 | lock (m_listeners) |
509 | { | 598 | { |
510 | foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) | 599 | foreach (KeyValuePair<int, List<ListenerInfo>> lis |
600 | in m_listeners) | ||
511 | { | 601 | { |
512 | foreach (ListenerInfo li in lis.Value) | 602 | foreach (ListenerInfo li in lis.Value) |
513 | { | 603 | { |
514 | if (li.GetItemID().Equals(itemID) && li.GetHandle().Equals(handle)) | 604 | if (li.GetItemID().Equals(itemID) && |
605 | li.GetHandle().Equals(handle)) | ||
515 | { | 606 | { |
516 | lis.Value.Remove(li); | 607 | lis.Value.Remove(li); |
517 | if (lis.Value.Count == 0) | 608 | if (lis.Value.Count == 0) |
@@ -534,13 +625,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
534 | 625 | ||
535 | lock (m_listeners) | 626 | lock (m_listeners) |
536 | { | 627 | { |
537 | foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) | 628 | foreach (KeyValuePair<int, List<ListenerInfo>> lis |
629 | in m_listeners) | ||
538 | { | 630 | { |
539 | foreach (ListenerInfo li in lis.Value) | 631 | foreach (ListenerInfo li in lis.Value) |
540 | { | 632 | { |
541 | if (li.GetItemID().Equals(itemID)) | 633 | if (li.GetItemID().Equals(itemID)) |
542 | { | 634 | { |
543 | // store them first, else the enumerated bails on us | 635 | // store them first, else the enumerated bails on |
636 | // us | ||
544 | removedListeners.Add(li); | 637 | removedListeners.Add(li); |
545 | } | 638 | } |
546 | } | 639 | } |
@@ -567,11 +660,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
567 | { | 660 | { |
568 | lock (m_listeners) | 661 | lock (m_listeners) |
569 | { | 662 | { |
570 | foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) | 663 | foreach (KeyValuePair<int, List<ListenerInfo>> lis |
664 | in m_listeners) | ||
571 | { | 665 | { |
572 | foreach (ListenerInfo li in lis.Value) | 666 | foreach (ListenerInfo li in lis.Value) |
573 | { | 667 | { |
574 | if (li.GetItemID().Equals(itemID) && li.GetHandle() == handle) | 668 | if (li.GetItemID().Equals(itemID) && |
669 | li.GetHandle() == handle) | ||
575 | { | 670 | { |
576 | li.Activate(); | 671 | li.Activate(); |
577 | // only one, bail out | 672 | // only one, bail out |
@@ -586,11 +681,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
586 | { | 681 | { |
587 | lock (m_listeners) | 682 | lock (m_listeners) |
588 | { | 683 | { |
589 | foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) | 684 | foreach (KeyValuePair<int, List<ListenerInfo>> lis |
685 | in m_listeners) | ||
590 | { | 686 | { |
591 | foreach (ListenerInfo li in lis.Value) | 687 | foreach (ListenerInfo li in lis.Value) |
592 | { | 688 | { |
593 | if (li.GetItemID().Equals(itemID) && li.GetHandle() == handle) | 689 | if (li.GetItemID().Equals(itemID) && |
690 | li.GetHandle() == handle) | ||
594 | { | 691 | { |
595 | li.Deactivate(); | 692 | li.Deactivate(); |
596 | // only one, bail out | 693 | // only one, bail out |
@@ -601,19 +698,24 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
601 | } | 698 | } |
602 | } | 699 | } |
603 | 700 | ||
604 | // non-locked access, since its always called in the context of the lock | 701 | /// <summary> |
702 | /// non-locked access, since its always called in the context of the | ||
703 | /// lock | ||
704 | /// </summary> | ||
705 | /// <param name="itemID"></param> | ||
706 | /// <returns></returns> | ||
605 | private int GetNewHandle(UUID itemID) | 707 | private int GetNewHandle(UUID itemID) |
606 | { | 708 | { |
607 | List<int> handles = new List<int>(); | 709 | List<int> handles = new List<int>(); |
608 | 710 | ||
609 | // build a list of used keys for this specific itemID... | 711 | // build a list of used keys for this specific itemID... |
610 | foreach (KeyValuePair<int,List<ListenerInfo>> lis in m_listeners) | 712 | foreach (KeyValuePair<int, List<ListenerInfo>> lis in m_listeners) |
611 | { | 713 | { |
612 | foreach (ListenerInfo li in lis.Value) | 714 | foreach (ListenerInfo li in lis.Value) |
613 | { | 715 | { |
614 | if (li.GetItemID().Equals(itemID)) | 716 | if (li.GetItemID().Equals(itemID)) |
615 | handles.Add(li.GetHandle()); | 717 | handles.Add(li.GetHandle()); |
616 | } | 718 | } |
617 | } | 719 | } |
618 | 720 | ||
619 | // Note: 0 is NOT a valid handle for llListen() to return | 721 | // Note: 0 is NOT a valid handle for llListen() to return |
@@ -626,17 +728,46 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
626 | return -1; | 728 | return -1; |
627 | } | 729 | } |
628 | 730 | ||
629 | // Theres probably a more clever and efficient way to | 731 | /// These are duplicated from ScriptBaseClass |
630 | // do this, maybe with regex. | 732 | /// http://opensimulator.org/mantis/view.php?id=6106#c21945 |
631 | // PM2008: Ha, one could even be smart and define a specialized Enumerator. | 733 | #region Constants for the bitfield parameter of osListenRegex |
632 | public List<ListenerInfo> GetListeners(UUID itemID, int channel, string name, UUID id, string msg) | 734 | |
735 | /// <summary> | ||
736 | /// process name parameter as regex | ||
737 | /// </summary> | ||
738 | public const int OS_LISTEN_REGEX_NAME = 0x1; | ||
739 | |||
740 | /// <summary> | ||
741 | /// process message parameter as regex | ||
742 | /// </summary> | ||
743 | public const int OS_LISTEN_REGEX_MESSAGE = 0x2; | ||
744 | |||
745 | #endregion | ||
746 | |||
747 | /// <summary> | ||
748 | /// Get listeners matching the input parameters. | ||
749 | /// </summary> | ||
750 | /// <remarks> | ||
751 | /// Theres probably a more clever and efficient way to do this, maybe | ||
752 | /// with regex. | ||
753 | /// PM2008: Ha, one could even be smart and define a specialized | ||
754 | /// Enumerator. | ||
755 | /// </remarks> | ||
756 | /// <param name="itemID"></param> | ||
757 | /// <param name="channel"></param> | ||
758 | /// <param name="name"></param> | ||
759 | /// <param name="id"></param> | ||
760 | /// <param name="msg"></param> | ||
761 | /// <returns></returns> | ||
762 | public List<ListenerInfo> GetListeners(UUID itemID, int channel, | ||
763 | string name, UUID id, string msg) | ||
633 | { | 764 | { |
634 | List<ListenerInfo> collection = new List<ListenerInfo>(); | 765 | List<ListenerInfo> collection = new List<ListenerInfo>(); |
635 | 766 | ||
636 | lock (m_listeners) | 767 | lock (m_listeners) |
637 | { | 768 | { |
638 | List<ListenerInfo> listeners; | 769 | List<ListenerInfo> listeners; |
639 | if (!m_listeners.TryGetValue(channel,out listeners)) | 770 | if (!m_listeners.TryGetValue(channel, out listeners)) |
640 | { | 771 | { |
641 | return collection; | 772 | return collection; |
642 | } | 773 | } |
@@ -647,11 +778,15 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
647 | { | 778 | { |
648 | continue; | 779 | continue; |
649 | } | 780 | } |
650 | if (!itemID.Equals(UUID.Zero) && !li.GetItemID().Equals(itemID)) | 781 | if (!itemID.Equals(UUID.Zero) && |
782 | !li.GetItemID().Equals(itemID)) | ||
651 | { | 783 | { |
652 | continue; | 784 | continue; |
653 | } | 785 | } |
654 | if (li.GetName().Length > 0 && !li.GetName().Equals(name)) | 786 | if (li.GetName().Length > 0 && ( |
787 | ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) != OS_LISTEN_REGEX_NAME && !li.GetName().Equals(name)) || | ||
788 | ((li.RegexBitfield & OS_LISTEN_REGEX_NAME) == OS_LISTEN_REGEX_NAME && !Regex.IsMatch(name, li.GetName())) | ||
789 | )) | ||
655 | { | 790 | { |
656 | continue; | 791 | continue; |
657 | } | 792 | } |
@@ -659,7 +794,10 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
659 | { | 794 | { |
660 | continue; | 795 | continue; |
661 | } | 796 | } |
662 | if (li.GetMessage().Length > 0 && !li.GetMessage().Equals(msg)) | 797 | if (li.GetMessage().Length > 0 && ( |
798 | ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) != OS_LISTEN_REGEX_MESSAGE && !li.GetMessage().Equals(msg)) || | ||
799 | ((li.RegexBitfield & OS_LISTEN_REGEX_MESSAGE) == OS_LISTEN_REGEX_MESSAGE && !Regex.IsMatch(msg, li.GetMessage())) | ||
800 | )) | ||
663 | { | 801 | { |
664 | continue; | 802 | continue; |
665 | } | 803 | } |
@@ -692,10 +830,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
692 | { | 830 | { |
693 | int idx = 0; | 831 | int idx = 0; |
694 | Object[] item = new Object[6]; | 832 | Object[] item = new Object[6]; |
833 | int dataItemLength = 6; | ||
695 | 834 | ||
696 | while (idx < data.Length) | 835 | while (idx < data.Length) |
697 | { | 836 | { |
698 | Array.Copy(data, idx, item, 0, 6); | 837 | dataItemLength = (idx + 7 == data.Length || (idx + 7 < data.Length && data[idx + 7] is bool)) ? 7 : 6; |
838 | item = new Object[dataItemLength]; | ||
839 | Array.Copy(data, idx, item, 0, dataItemLength); | ||
699 | 840 | ||
700 | ListenerInfo info = | 841 | ListenerInfo info = |
701 | ListenerInfo.FromData(localID, itemID, hostID, item); | 842 | ListenerInfo.FromData(localID, itemID, hostID, item); |
@@ -703,39 +844,98 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
703 | lock (m_listeners) | 844 | lock (m_listeners) |
704 | { | 845 | { |
705 | if (!m_listeners.ContainsKey((int)item[2])) | 846 | if (!m_listeners.ContainsKey((int)item[2])) |
706 | m_listeners.Add((int)item[2], new List<ListenerInfo>()); | 847 | { |
848 | m_listeners.Add((int)item[2], | ||
849 | new List<ListenerInfo>()); | ||
850 | } | ||
707 | m_listeners[(int)item[2]].Add(info); | 851 | m_listeners[(int)item[2]].Add(info); |
708 | } | 852 | } |
709 | 853 | ||
710 | idx+=6; | 854 | idx += dataItemLength; |
711 | } | 855 | } |
712 | } | 856 | } |
713 | } | 857 | } |
714 | 858 | ||
715 | public class ListenerInfo: IWorldCommListenerInfo | 859 | public class ListenerInfo : IWorldCommListenerInfo |
716 | { | 860 | { |
717 | private bool m_active; // Listener is active or not | 861 | /// <summary> |
718 | private int m_handle; // Assigned handle of this listener | 862 | /// Listener is active or not |
719 | private uint m_localID; // Local ID from script engine | 863 | /// </summary> |
720 | private UUID m_itemID; // ID of the host script engine | 864 | private bool m_active; |
721 | private UUID m_hostID; // ID of the host/scene part | ||
722 | private int m_channel; // Channel | ||
723 | private UUID m_id; // ID to filter messages from | ||
724 | private string m_name; // Object name to filter messages from | ||
725 | private string m_message; // The message | ||
726 | 865 | ||
727 | public ListenerInfo(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, UUID id, string message) | 866 | /// <summary> |
867 | /// Assigned handle of this listener | ||
868 | /// </summary> | ||
869 | private int m_handle; | ||
870 | |||
871 | /// <summary> | ||
872 | /// Local ID from script engine | ||
873 | /// </summary> | ||
874 | private uint m_localID; | ||
875 | |||
876 | /// <summary> | ||
877 | /// ID of the host script engine | ||
878 | /// </summary> | ||
879 | private UUID m_itemID; | ||
880 | |||
881 | /// <summary> | ||
882 | /// ID of the host/scene part | ||
883 | /// </summary> | ||
884 | private UUID m_hostID; | ||
885 | |||
886 | /// <summary> | ||
887 | /// Channel | ||
888 | /// </summary> | ||
889 | private int m_channel; | ||
890 | |||
891 | /// <summary> | ||
892 | /// ID to filter messages from | ||
893 | /// </summary> | ||
894 | private UUID m_id; | ||
895 | |||
896 | /// <summary> | ||
897 | /// Object name to filter messages from | ||
898 | /// </summary> | ||
899 | private string m_name; | ||
900 | |||
901 | /// <summary> | ||
902 | /// The message | ||
903 | /// </summary> | ||
904 | private string m_message; | ||
905 | |||
906 | public ListenerInfo(int handle, uint localID, UUID ItemID, | ||
907 | UUID hostID, int channel, string name, UUID id, | ||
908 | string message) | ||
909 | { | ||
910 | Initialise(handle, localID, ItemID, hostID, channel, name, id, | ||
911 | message, 0); | ||
912 | } | ||
913 | |||
914 | public ListenerInfo(int handle, uint localID, UUID ItemID, | ||
915 | UUID hostID, int channel, string name, UUID id, | ||
916 | string message, int regexBitfield) | ||
728 | { | 917 | { |
729 | Initialise(handle, localID, ItemID, hostID, channel, name, id, message); | 918 | Initialise(handle, localID, ItemID, hostID, channel, name, id, |
919 | message, regexBitfield); | ||
730 | } | 920 | } |
731 | 921 | ||
732 | public ListenerInfo(ListenerInfo li, string name, UUID id, string message) | 922 | public ListenerInfo(ListenerInfo li, string name, UUID id, |
923 | string message) | ||
733 | { | 924 | { |
734 | Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, li.m_channel, name, id, message); | 925 | Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, |
926 | li.m_channel, name, id, message, 0); | ||
735 | } | 927 | } |
736 | 928 | ||
737 | private void Initialise(int handle, uint localID, UUID ItemID, UUID hostID, int channel, string name, | 929 | public ListenerInfo(ListenerInfo li, string name, UUID id, |
738 | UUID id, string message) | 930 | string message, int regexBitfield) |
931 | { | ||
932 | Initialise(li.m_handle, li.m_localID, li.m_itemID, li.m_hostID, | ||
933 | li.m_channel, name, id, message, regexBitfield); | ||
934 | } | ||
935 | |||
936 | private void Initialise(int handle, uint localID, UUID ItemID, | ||
937 | UUID hostID, int channel, string name, UUID id, | ||
938 | string message, int regexBitfield) | ||
739 | { | 939 | { |
740 | m_active = true; | 940 | m_active = true; |
741 | m_handle = handle; | 941 | m_handle = handle; |
@@ -746,11 +946,12 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
746 | m_name = name; | 946 | m_name = name; |
747 | m_id = id; | 947 | m_id = id; |
748 | m_message = message; | 948 | m_message = message; |
949 | RegexBitfield = regexBitfield; | ||
749 | } | 950 | } |
750 | 951 | ||
751 | public Object[] GetSerializationData() | 952 | public Object[] GetSerializationData() |
752 | { | 953 | { |
753 | Object[] data = new Object[6]; | 954 | Object[] data = new Object[7]; |
754 | 955 | ||
755 | data[0] = m_active; | 956 | data[0] = m_active; |
756 | data[1] = m_handle; | 957 | data[1] = m_handle; |
@@ -758,16 +959,22 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
758 | data[3] = m_name; | 959 | data[3] = m_name; |
759 | data[4] = m_id; | 960 | data[4] = m_id; |
760 | data[5] = m_message; | 961 | data[5] = m_message; |
962 | data[6] = RegexBitfield; | ||
761 | 963 | ||
762 | return data; | 964 | return data; |
763 | } | 965 | } |
764 | 966 | ||
765 | public static ListenerInfo FromData(uint localID, UUID ItemID, UUID hostID, Object[] data) | 967 | public static ListenerInfo FromData(uint localID, UUID ItemID, |
968 | UUID hostID, Object[] data) | ||
766 | { | 969 | { |
767 | ListenerInfo linfo = new ListenerInfo((int)data[1], localID, | 970 | ListenerInfo linfo = new ListenerInfo((int)data[1], localID, |
768 | ItemID, hostID, (int)data[2], (string)data[3], | 971 | ItemID, hostID, (int)data[2], (string)data[3], |
769 | (UUID)data[4], (string)data[5]); | 972 | (UUID)data[4], (string)data[5]); |
770 | linfo.m_active=(bool)data[0]; | 973 | linfo.m_active = (bool)data[0]; |
974 | if (data.Length >= 7) | ||
975 | { | ||
976 | linfo.RegexBitfield = (int)data[6]; | ||
977 | } | ||
771 | 978 | ||
772 | return linfo; | 979 | return linfo; |
773 | } | 980 | } |
@@ -826,5 +1033,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm | |||
826 | { | 1033 | { |
827 | return m_id; | 1034 | return m_id; |
828 | } | 1035 | } |
1036 | |||
1037 | public int RegexBitfield { get; private set; } | ||
829 | } | 1038 | } |
830 | } | 1039 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index 0003af2..385f5ad 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Framework.Servers; | |||
40 | using OpenSim.Framework.Servers.HttpServer; | 40 | using OpenSim.Framework.Servers.HttpServer; |
41 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 42 | using OpenSim.Region.Framework.Scenes; |
43 | using Mono.Addins; | ||
43 | 44 | ||
44 | /***************************************************** | 45 | /***************************************************** |
45 | * | 46 | * |
@@ -76,7 +77,8 @@ using OpenSim.Region.Framework.Scenes; | |||
76 | 77 | ||
77 | namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | 78 | namespace OpenSim.Region.CoreModules.Scripting.XMLRPC |
78 | { | 79 | { |
79 | public class XMLRPCModule : IRegionModule, IXMLRPC | 80 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "XMLRPCModule")] |
81 | public class XMLRPCModule : ISharedRegionModule, IXMLRPC | ||
80 | { | 82 | { |
81 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 83 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
82 | 84 | ||
@@ -86,6 +88,10 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | |||
86 | private Dictionary<UUID, RPCChannelInfo> m_openChannels; | 88 | private Dictionary<UUID, RPCChannelInfo> m_openChannels; |
87 | private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses; | 89 | private Dictionary<UUID, SendRemoteDataRequest> m_pendingSRDResponses; |
88 | private int m_remoteDataPort = 0; | 90 | private int m_remoteDataPort = 0; |
91 | public int Port | ||
92 | { | ||
93 | get { return m_remoteDataPort; } | ||
94 | } | ||
89 | 95 | ||
90 | private Dictionary<UUID, RPCRequestInfo> m_rpcPending; | 96 | private Dictionary<UUID, RPCRequestInfo> m_rpcPending; |
91 | private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses; | 97 | private Dictionary<UUID, RPCRequestInfo> m_rpcPendingResponses; |
@@ -94,34 +100,24 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | |||
94 | private int RemoteReplyScriptWait = 300; | 100 | private int RemoteReplyScriptWait = 300; |
95 | private object XMLRPCListLock = new object(); | 101 | private object XMLRPCListLock = new object(); |
96 | 102 | ||
97 | #region IRegionModule Members | 103 | #region ISharedRegionModule Members |
98 | 104 | ||
99 | public void Initialise(Scene scene, IConfigSource config) | 105 | public void Initialise(IConfigSource config) |
100 | { | 106 | { |
101 | // We need to create these early because the scripts might be calling | 107 | // We need to create these early because the scripts might be calling |
102 | // But since this gets called for every region, we need to make sure they | 108 | // But since this gets called for every region, we need to make sure they |
103 | // get called only one time (or we lose any open channels) | 109 | // get called only one time (or we lose any open channels) |
104 | if (null == m_openChannels) | 110 | m_openChannels = new Dictionary<UUID, RPCChannelInfo>(); |
105 | { | 111 | m_rpcPending = new Dictionary<UUID, RPCRequestInfo>(); |
106 | m_openChannels = new Dictionary<UUID, RPCChannelInfo>(); | 112 | m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>(); |
107 | m_rpcPending = new Dictionary<UUID, RPCRequestInfo>(); | 113 | m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>(); |
108 | m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>(); | ||
109 | m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>(); | ||
110 | 114 | ||
111 | try | 115 | try |
112 | { | 116 | { |
113 | m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort); | 117 | m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort); |
114 | } | ||
115 | catch (Exception) | ||
116 | { | ||
117 | } | ||
118 | } | 118 | } |
119 | 119 | catch (Exception) | |
120 | if (!m_scenes.Contains(scene)) | ||
121 | { | 120 | { |
122 | m_scenes.Add(scene); | ||
123 | |||
124 | scene.RegisterModuleInterface<IXMLRPC>(this); | ||
125 | } | 121 | } |
126 | } | 122 | } |
127 | 123 | ||
@@ -131,32 +127,56 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | |||
131 | { | 127 | { |
132 | // Start http server | 128 | // Start http server |
133 | // Attach xmlrpc handlers | 129 | // Attach xmlrpc handlers |
134 | // m_log.InfoFormat( | 130 | // m_log.InfoFormat( |
135 | // "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.", | 131 | // "[XML RPC MODULE]: Starting up XMLRPC Server on port {0} for llRemoteData commands.", |
136 | // m_remoteDataPort); | 132 | // m_remoteDataPort); |
137 | 133 | ||
138 | IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort); | 134 | IHttpServer httpServer = MainServer.GetHttpServer((uint)m_remoteDataPort); |
139 | httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); | 135 | httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); |
140 | } | 136 | } |
141 | } | 137 | } |
142 | 138 | ||
143 | public void Close() | 139 | public void AddRegion(Scene scene) |
140 | { | ||
141 | if (!IsEnabled()) | ||
142 | return; | ||
143 | |||
144 | if (!m_scenes.Contains(scene)) | ||
145 | { | ||
146 | m_scenes.Add(scene); | ||
147 | |||
148 | scene.RegisterModuleInterface<IXMLRPC>(this); | ||
149 | } | ||
150 | } | ||
151 | |||
152 | public void RegionLoaded(Scene scene) | ||
144 | { | 153 | { |
145 | } | 154 | } |
146 | 155 | ||
147 | public string Name | 156 | public void RemoveRegion(Scene scene) |
148 | { | 157 | { |
149 | get { return m_name; } | 158 | if (!IsEnabled()) |
159 | return; | ||
160 | |||
161 | if (m_scenes.Contains(scene)) | ||
162 | { | ||
163 | scene.UnregisterModuleInterface<IXMLRPC>(this); | ||
164 | m_scenes.Remove(scene); | ||
165 | } | ||
150 | } | 166 | } |
151 | 167 | ||
152 | public bool IsSharedModule | 168 | public void Close() |
153 | { | 169 | { |
154 | get { return true; } | ||
155 | } | 170 | } |
156 | 171 | ||
157 | public int Port | 172 | public string Name |
158 | { | 173 | { |
159 | get { return m_remoteDataPort; } | 174 | get { return m_name; } |
175 | } | ||
176 | |||
177 | public Type ReplaceableInterface | ||
178 | { | ||
179 | get { return null; } | ||
160 | } | 180 | } |
161 | 181 | ||
162 | #endregion | 182 | #endregion |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs index 5541684..7b4668a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
@@ -39,6 +40,7 @@ using OpenSim.Server.Handlers.Base; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AssetServiceInConnectorModule")] | ||
42 | public class AssetServiceInConnectorModule : ISharedRegionModule | 44 | public class AssetServiceInConnectorModule : ISharedRegionModule |
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); |
@@ -47,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset | |||
47 | private IConfigSource m_Config; | 49 | private IConfigSource m_Config; |
48 | bool m_Registered = false; | 50 | bool m_Registered = false; |
49 | 51 | ||
50 | #region IRegionModule interface | 52 | #region Region Module interface |
51 | 53 | ||
52 | public void Initialise(IConfigSource config) | 54 | public void Initialise(IConfigSource config) |
53 | { | 55 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs index ccf2275..2cdffe6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Authentication/AuthenticationServiceInConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
@@ -41,6 +42,7 @@ using OpenSim.Services.Interfaces; | |||
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication |
43 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AuthenticationServiceInConnectorModule")] | ||
44 | public class AuthenticationServiceInConnectorModule : ISharedRegionModule | 46 | public class AuthenticationServiceInConnectorModule : ISharedRegionModule |
45 | { | 47 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication | |||
49 | private IConfigSource m_Config; | 51 | private IConfigSource m_Config; |
50 | bool m_Registered = false; | 52 | bool m_Registered = false; |
51 | 53 | ||
52 | #region IRegionModule interface | 54 | #region Region Module interface |
53 | 55 | ||
54 | public void Initialise(IConfigSource config) | 56 | public void Initialise(IConfigSource config) |
55 | { | 57 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs index 0e16e5a..22857d0 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/GridInfoServiceInConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
@@ -41,6 +42,7 @@ using OpenSim.Services.Interfaces; | |||
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid |
43 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GridInfoServiceInConnectorModule")] | ||
44 | public class GridInfoServiceInConnectorModule : ISharedRegionModule | 46 | public class GridInfoServiceInConnectorModule : ISharedRegionModule |
45 | { | 47 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -49,7 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid | |||
49 | private IConfigSource m_Config; | 51 | private IConfigSource m_Config; |
50 | bool m_Registered = false; | 52 | bool m_Registered = false; |
51 | 53 | ||
52 | #region IRegionModule interface | 54 | #region Region Module interface |
53 | 55 | ||
54 | public void Initialise(IConfigSource config) | 56 | public void Initialise(IConfigSource config) |
55 | { | 57 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index a7dd0dd..f749295 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
@@ -42,6 +43,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | 44 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid |
44 | { | 45 | { |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HypergridServiceInConnectorModule")] | ||
45 | public class HypergridServiceInConnectorModule : ISharedRegionModule | 47 | public class HypergridServiceInConnectorModule : ISharedRegionModule |
46 | { | 48 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -53,7 +55,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | |||
53 | private GatekeeperServiceInConnector m_HypergridHandler; | 55 | private GatekeeperServiceInConnector m_HypergridHandler; |
54 | private UserAgentServerConnector m_UASHandler; | 56 | private UserAgentServerConnector m_UASHandler; |
55 | 57 | ||
56 | #region IRegionModule interface | 58 | #region Region Module interface |
57 | 59 | ||
58 | public void Initialise(IConfigSource config) | 60 | public void Initialise(IConfigSource config) |
59 | { | 61 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs index 831ea27..0a4e736 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
@@ -39,6 +40,7 @@ using OpenSim.Server.Handlers.Base; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "InventoryServiceInConnectorModule")] | ||
42 | public class InventoryServiceInConnectorModule : ISharedRegionModule | 44 | public class InventoryServiceInConnectorModule : ISharedRegionModule |
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); |
@@ -47,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory | |||
47 | private IConfigSource m_Config; | 49 | private IConfigSource m_Config; |
48 | bool m_Registered = false; | 50 | bool m_Registered = false; |
49 | 51 | ||
50 | #region IRegionModule interface | 52 | #region Region Module interface |
51 | 53 | ||
52 | public void Initialise(IConfigSource config) | 54 | public void Initialise(IConfigSource config) |
53 | { | 55 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs index 2f3c350..2fd21be 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
@@ -42,6 +43,7 @@ using OpenMetaverse; | |||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land | 44 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land |
44 | { | 45 | { |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LandServiceInConnectorModule")] | ||
45 | public class LandServiceInConnectorModule : ISharedRegionModule, ILandService | 47 | public class LandServiceInConnectorModule : ISharedRegionModule, ILandService |
46 | { | 48 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -51,7 +53,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land | |||
51 | private IConfigSource m_Config; | 53 | private IConfigSource m_Config; |
52 | private List<Scene> m_Scenes = new List<Scene>(); | 54 | private List<Scene> m_Scenes = new List<Scene>(); |
53 | 55 | ||
54 | #region IRegionModule interface | 56 | #region Region Module interface |
55 | 57 | ||
56 | public void Initialise(IConfigSource config) | 58 | public void Initialise(IConfigSource config) |
57 | { | 59 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs index ecdb380..425febd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Login/LLLoginServiceInConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
@@ -42,6 +43,7 @@ using OpenSim.Services.Interfaces; | |||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Login | 44 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Login |
44 | { | 45 | { |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LLLoginServiceInConnectorModule")] | ||
45 | public class LLLoginServiceInConnectorModule : ISharedRegionModule | 47 | public class LLLoginServiceInConnectorModule : ISharedRegionModule |
46 | { | 48 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -51,7 +53,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Login | |||
51 | private IConfigSource m_Config; | 53 | private IConfigSource m_Config; |
52 | private List<Scene> m_Scenes = new List<Scene>(); | 54 | private List<Scene> m_Scenes = new List<Scene>(); |
53 | 55 | ||
54 | #region IRegionModule interface | 56 | #region Region Module interface |
55 | 57 | ||
56 | public void Initialise(IConfigSource config) | 58 | public void Initialise(IConfigSource config) |
57 | { | 59 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs index d38af23..c14bce7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/MapImage/MapImageServiceInConnectorModule.cs | |||
@@ -42,7 +42,7 @@ using OpenSim.Services.Interfaces; | |||
42 | 42 | ||
43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage |
44 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceInConnectorModule")] |
46 | public class MapImageServiceInConnectorModule : ISharedRegionModule | 46 | public class MapImageServiceInConnectorModule : ISharedRegionModule |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.MapImage | |||
50 | 50 | ||
51 | private IConfigSource m_Config; | 51 | private IConfigSource m_Config; |
52 | 52 | ||
53 | #region IRegionModule interface | 53 | #region Region Module interface |
54 | 54 | ||
55 | public void Initialise(IConfigSource config) | 55 | public void Initialise(IConfigSource config) |
56 | { | 56 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs index b544ab3..6bf47cb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
@@ -41,6 +42,7 @@ using OpenSim.Services.Interfaces; | |||
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour |
43 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "NeighbourServiceInConnectorModule")] | ||
44 | public class NeighbourServiceInConnectorModule : ISharedRegionModule, INeighbourService | 46 | public class NeighbourServiceInConnectorModule : ISharedRegionModule, INeighbourService |
45 | { | 47 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -50,7 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour | |||
50 | private IConfigSource m_Config; | 52 | private IConfigSource m_Config; |
51 | private List<Scene> m_Scenes = new List<Scene>(); | 53 | private List<Scene> m_Scenes = new List<Scene>(); |
52 | 54 | ||
53 | #region IRegionModule interface | 55 | #region Region Module interface |
54 | 56 | ||
55 | public void Initialise(IConfigSource config) | 57 | public void Initialise(IConfigSource config) |
56 | { | 58 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs index 0a5275d..57d1132 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
@@ -40,7 +41,7 @@ using OpenSim.Server.Handlers.Base; | |||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation |
42 | { | 43 | { |
43 | // Under construction | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimulationServiceInConnectorModule")] |
44 | public class SimulationServiceInConnectorModule : ISharedRegionModule | 45 | public class SimulationServiceInConnectorModule : ISharedRegionModule |
45 | { | 46 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -49,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation | |||
49 | private IConfigSource m_Config; | 50 | private IConfigSource m_Config; |
50 | bool m_Registered = false; | 51 | bool m_Registered = false; |
51 | 52 | ||
52 | #region IRegionModule interface | 53 | #region Region Module interface |
53 | 54 | ||
54 | public void Initialise(IConfigSource config) | 55 | public void Initialise(IConfigSource config) |
55 | { | 56 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index 1e1c7d0..d221d68 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using System; | 31 | using System; |
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -40,8 +41,8 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset |
42 | { | 43 | { |
43 | public class HGAssetBroker : | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGAssetBroker")] |
44 | ISharedRegionModule, IAssetService | 45 | public class HGAssetBroker : ISharedRegionModule, IAssetService |
45 | { | 46 | { |
46 | private static readonly ILog m_log = | 47 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 48 | LogManager.GetLogger( |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 449c1f1..480cd69 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using System; | 31 | using System; |
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -38,6 +39,7 @@ using OpenSim.Services.Interfaces; | |||
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | 40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset |
40 | { | 41 | { |
42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalAssetServicesConnector")] | ||
41 | public class LocalAssetServicesConnector : ISharedRegionModule, IAssetService | 43 | public class LocalAssetServicesConnector : ISharedRegionModule, IAssetService |
42 | { | 44 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs index 8a22cfc..e6eeacf 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/RemoteAssetServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using System; | 30 | using System; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Reflection; | 32 | using System.Reflection; |
@@ -38,6 +39,7 @@ using OpenSim.Services.Interfaces; | |||
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | 40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset |
40 | { | 41 | { |
42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteAssetServicesConnector")] | ||
41 | public class RemoteAssetServicesConnector : | 43 | public class RemoteAssetServicesConnector : |
42 | AssetServicesConnector, ISharedRegionModule, IAssetService | 44 | AssetServicesConnector, ISharedRegionModule, IAssetService |
43 | { | 45 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/LocalAuthenticationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/LocalAuthenticationServiceConnector.cs index 9484a5a..16f42a7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/LocalAuthenticationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/LocalAuthenticationServiceConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
@@ -39,6 +40,7 @@ using OpenMetaverse; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalAuthenticationServicesConnector")] | ||
42 | public class LocalAuthenticationServicesConnector : ISharedRegionModule, IAuthenticationService | 44 | public class LocalAuthenticationServicesConnector : ISharedRegionModule, IAuthenticationService |
43 | { | 45 | { |
44 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/RemoteAuthenticationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/RemoteAuthenticationServiceConnector.cs index a053bc2..7cb8b22 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/RemoteAuthenticationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authentication/RemoteAuthenticationServiceConnector.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using log4net; | 30 | using log4net; |
31 | using Mono.Addins; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
33 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
@@ -36,6 +37,7 @@ using OpenSim.Services.Connectors; | |||
36 | 37 | ||
37 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication | 38 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication |
38 | { | 39 | { |
40 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteAuthenticationServicesConnector")] | ||
39 | public class RemoteAuthenticationServicesConnector : AuthenticationServicesConnector, | 41 | public class RemoteAuthenticationServicesConnector : AuthenticationServicesConnector, |
40 | ISharedRegionModule, IAuthenticationService | 42 | ISharedRegionModule, IAuthenticationService |
41 | { | 43 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs index 267fb9e..1acb695 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/LocalAuthorizationServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using System; | 31 | using System; |
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -39,6 +40,7 @@ using OpenMetaverse; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalAuthorizationServicesConnector")] | ||
42 | public class LocalAuthorizationServicesConnector : INonSharedRegionModule, IAuthorizationService | 44 | public class LocalAuthorizationServicesConnector : INonSharedRegionModule, IAuthorizationService |
43 | { | 45 | { |
44 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs index 86c0099..b8d409d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/RemoteAuthorizationServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using System; | 30 | using System; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Reflection; | 32 | using System.Reflection; |
@@ -39,6 +40,7 @@ using OpenMetaverse; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteAuthorizationServicesConnector")] | ||
42 | public class RemoteAuthorizationServicesConnector : | 44 | public class RemoteAuthorizationServicesConnector : |
43 | AuthorizationServicesConnector, ISharedRegionModule, IAuthorizationService | 45 | AuthorizationServicesConnector, ISharedRegionModule, IAuthorizationService |
44 | { | 46 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs index 9ee19f8..c3ef588 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/LocalAvatarServiceConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
@@ -40,6 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar |
42 | { | 43 | { |
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalAvatarServicesConnector")] | ||
43 | public class LocalAvatarServicesConnector : ISharedRegionModule, IAvatarService | 45 | public class LocalAvatarServicesConnector : ISharedRegionModule, IAvatarService |
44 | { | 46 | { |
45 | private static readonly ILog m_log = | 47 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs index d665a54..a087aea 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Avatar/RemoteAvatarServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using Mono.Addins; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using log4net; | 31 | using log4net; |
31 | using System.Reflection; | 32 | using System.Reflection; |
@@ -36,6 +37,7 @@ using OpenSim.Services.Connectors; | |||
36 | 37 | ||
37 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar | 38 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar |
38 | { | 39 | { |
40 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteAvatarServicesConnector")] | ||
39 | public class RemoteAvatarServicesConnector : AvatarServicesConnector, | 41 | public class RemoteAvatarServicesConnector : AvatarServicesConnector, |
40 | ISharedRegionModule, IAvatarService | 42 | ISharedRegionModule, IAvatarService |
41 | { | 43 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 3c6e381..c0c2ca7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using System; | 31 | using System; |
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -41,6 +42,7 @@ using OpenMetaverse; | |||
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid |
43 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalGridServicesConnector")] | ||
44 | public class LocalGridServicesConnector : ISharedRegionModule, IGridService | 46 | public class LocalGridServicesConnector : ISharedRegionModule, IGridService |
45 | { | 47 | { |
46 | private static readonly ILog m_log = | 48 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index e6c89d7..b2646ba 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using System; | 30 | using System; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Reflection; | 32 | using System.Reflection; |
@@ -42,6 +43,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | 44 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid |
44 | { | 45 | { |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteGridServicesConnector")] | ||
45 | public class RemoteGridServicesConnector : ISharedRegionModule, IGridService | 47 | public class RemoteGridServicesConnector : ISharedRegionModule, IGridService |
46 | { | 48 | { |
47 | private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs index 90fe69e..5734334 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/LocalGridUserServiceConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
@@ -39,6 +40,7 @@ using OpenMetaverse; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalGridUserServicesConnector")] | ||
42 | public class LocalGridUserServicesConnector : ISharedRegionModule, IGridUserService | 44 | public class LocalGridUserServicesConnector : ISharedRegionModule, IGridUserService |
43 | { | 45 | { |
44 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs index 04acf67..f7e6eb8 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/RemoteGridUserServiceConnector.cs | |||
@@ -36,10 +36,12 @@ using OpenSim.Services.Connectors; | |||
36 | 36 | ||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using log4net; | 38 | using log4net; |
39 | using Mono.Addins; | ||
39 | using Nini.Config; | 40 | using Nini.Config; |
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser |
42 | { | 43 | { |
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteGridUserServicesConnector")] | ||
43 | public class RemoteGridUserServicesConnector : ISharedRegionModule, IGridUserService | 45 | public class RemoteGridUserServicesConnector : ISharedRegionModule, IGridUserService |
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); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index cf6d2f7..e474ef6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using System; | 31 | using System; |
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -42,6 +43,7 @@ using OpenMetaverse; | |||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | 44 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory |
44 | { | 45 | { |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGInventoryBroker")] | ||
45 | public class HGInventoryBroker : ISharedRegionModule, IInventoryService | 47 | public class HGInventoryBroker : ISharedRegionModule, IInventoryService |
46 | { | 48 | { |
47 | private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 097ff1a..ec5751d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | 31 | ||
31 | using System; | 32 | using System; |
@@ -41,6 +42,7 @@ using OpenMetaverse; | |||
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory |
43 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalInventoryServicesConnector")] | ||
44 | public class LocalInventoryServicesConnector : ISharedRegionModule, IInventoryService | 46 | public class LocalInventoryServicesConnector : ISharedRegionModule, IInventoryService |
45 | { | 47 | { |
46 | private static readonly ILog m_log = | 48 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 11e0150..2d3ba82 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -29,6 +29,7 @@ using log4net; | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Monitoring; | 35 | using OpenSim.Framework.Monitoring; |
@@ -40,6 +41,7 @@ using OpenMetaverse; | |||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory |
42 | { | 43 | { |
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteXInventoryServicesConnector")] | ||
43 | public class RemoteXInventoryServicesConnector : ISharedRegionModule, IInventoryService | 45 | public class RemoteXInventoryServicesConnector : ISharedRegionModule, IInventoryService |
44 | { | 46 | { |
45 | private static readonly ILog m_log = | 47 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs index 86c0b85..5329933 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/LocalLandServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using System; | 31 | using System; |
31 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -39,8 +40,8 @@ using OpenMetaverse; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land |
41 | { | 42 | { |
42 | public class LocalLandServicesConnector : | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalLandServicesConnector")] |
43 | ISharedRegionModule, ILandService | 44 | public class LocalLandServicesConnector : ISharedRegionModule, ILandService |
44 | { | 45 | { |
45 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
46 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs index 766ef81..77dfa4a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Land/RemoteLandServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using System; | 30 | using System; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Reflection; | 32 | using System.Reflection; |
@@ -41,6 +42,7 @@ using OpenMetaverse; | |||
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land |
43 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteLandServicesConnector")] | ||
44 | public class RemoteLandServicesConnector : | 46 | public class RemoteLandServicesConnector : |
45 | LandServicesConnector, ISharedRegionModule, ILandService | 47 | LandServicesConnector, ISharedRegionModule, ILandService |
46 | { | 48 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs index 9d282b8..a839086 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs | |||
@@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage | |||
52 | /// <remarks> | 52 | /// <remarks> |
53 | /// </remarks> | 53 | /// </remarks> |
54 | 54 | ||
55 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 55 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")] |
56 | public class MapImageServiceModule : ISharedRegionModule | 56 | public class MapImageServiceModule : ISharedRegionModule |
57 | { | 57 | { |
58 | private static readonly ILog m_log = | 58 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs index 7a90686..fd89428 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -39,6 +40,7 @@ using OpenSim.Services.Interfaces; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalNeighbourServicesConnector")] | ||
42 | public class LocalNeighbourServicesConnector : | 44 | public class LocalNeighbourServicesConnector : |
43 | ISharedRegionModule, INeighbourService | 45 | ISharedRegionModule, INeighbourService |
44 | { | 46 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs index c6fc2a1..e6772f3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using Mono.Addins; | ||
29 | using System; | 30 | using System; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Reflection; | 32 | using System.Reflection; |
@@ -39,6 +40,7 @@ using OpenSim.Server.Base; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteNeighbourServicesConnector")] | ||
42 | public class RemoteNeighbourServicesConnector : | 44 | public class RemoteNeighbourServicesConnector : |
43 | NeighbourServicesConnector, ISharedRegionModule, INeighbourService | 45 | NeighbourServicesConnector, ISharedRegionModule, INeighbourService |
44 | { | 46 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs new file mode 100644 index 0000000..fdbe10a --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/BasePresenceServiceConnector.cs | |||
@@ -0,0 +1,137 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net; | ||
32 | using Mono.Addins; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Server.Base; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | ||
40 | |||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | ||
42 | { | ||
43 | public class BasePresenceServiceConnector : IPresenceService | ||
44 | { | ||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | protected bool m_Enabled; | ||
48 | |||
49 | protected PresenceDetector m_PresenceDetector; | ||
50 | |||
51 | /// <summary> | ||
52 | /// Underlying presence service. Do not use directly. | ||
53 | /// </summary> | ||
54 | public IPresenceService m_PresenceService; | ||
55 | |||
56 | public Type ReplaceableInterface | ||
57 | { | ||
58 | get { return null; } | ||
59 | } | ||
60 | |||
61 | public void AddRegion(Scene scene) | ||
62 | { | ||
63 | if (!m_Enabled) | ||
64 | return; | ||
65 | |||
66 | // m_log.DebugFormat( | ||
67 | // "[LOCAL PRESENCE CONNECTOR]: Registering IPresenceService to scene {0}", scene.RegionInfo.RegionName); | ||
68 | |||
69 | scene.RegisterModuleInterface<IPresenceService>(this); | ||
70 | m_PresenceDetector.AddRegion(scene); | ||
71 | |||
72 | m_log.InfoFormat("[BASE PRESENCE SERVICE CONNECTOR]: Enabled for region {0}", scene.Name); | ||
73 | } | ||
74 | |||
75 | public void RemoveRegion(Scene scene) | ||
76 | { | ||
77 | if (!m_Enabled) | ||
78 | return; | ||
79 | |||
80 | m_PresenceDetector.RemoveRegion(scene); | ||
81 | } | ||
82 | |||
83 | public void RegionLoaded(Scene scene) | ||
84 | { | ||
85 | if (!m_Enabled) | ||
86 | return; | ||
87 | |||
88 | } | ||
89 | |||
90 | public void PostInitialise() | ||
91 | { | ||
92 | } | ||
93 | |||
94 | public void Close() | ||
95 | { | ||
96 | } | ||
97 | |||
98 | #region IPresenceService | ||
99 | |||
100 | public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) | ||
101 | { | ||
102 | m_log.Warn("[BASE PRESENCE SERVICE CONNECTOR]: LoginAgent connector not implemented at the simulators"); | ||
103 | return false; | ||
104 | } | ||
105 | |||
106 | public bool LogoutAgent(UUID sessionID) | ||
107 | { | ||
108 | return m_PresenceService.LogoutAgent(sessionID); | ||
109 | } | ||
110 | |||
111 | public bool LogoutRegionAgents(UUID regionID) | ||
112 | { | ||
113 | return m_PresenceService.LogoutRegionAgents(regionID); | ||
114 | } | ||
115 | |||
116 | public bool ReportAgent(UUID sessionID, UUID regionID) | ||
117 | { | ||
118 | return m_PresenceService.ReportAgent(sessionID, regionID); | ||
119 | } | ||
120 | |||
121 | public PresenceInfo GetAgent(UUID sessionID) | ||
122 | { | ||
123 | return m_PresenceService.GetAgent(sessionID); | ||
124 | } | ||
125 | |||
126 | public PresenceInfo[] GetAgents(string[] userIDs) | ||
127 | { | ||
128 | // Don't bother potentially making a useless network call if we not going to ask for any users anyway. | ||
129 | if (userIDs.Length == 0) | ||
130 | return new PresenceInfo[0]; | ||
131 | |||
132 | return m_PresenceService.GetAgents(userIDs); | ||
133 | } | ||
134 | |||
135 | #endregion | ||
136 | } | ||
137 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs index 49dd633..db5c520 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/LocalPresenceServiceConnector.cs | |||
@@ -24,51 +24,29 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
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 | using System; | 28 | using System; |
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | 31 | using log4net; | |
32 | using Mono.Addins; | ||
33 | using Nini.Config; | ||
34 | using OpenMetaverse; | ||
31 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
32 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Server.Base; | 37 | using OpenSim.Server.Base; |
34 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
35 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | 39 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; |
36 | 40 | ||
37 | using OpenMetaverse; | ||
38 | using log4net; | ||
39 | using Nini.Config; | ||
40 | |||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence |
42 | { | 42 | { |
43 | public class LocalPresenceServicesConnector : ISharedRegionModule, IPresenceService | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalPresenceServicesConnector")] |
44 | public class LocalPresenceServicesConnector : BasePresenceServiceConnector, ISharedRegionModule, IPresenceService | ||
44 | { | 45 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 47 | ||
47 | private bool m_Enabled = false; | ||
48 | |||
49 | private PresenceDetector m_PresenceDetector; | ||
50 | |||
51 | /// <summary> | ||
52 | /// Underlying presence service. Do not use directly. | ||
53 | /// </summary> | ||
54 | public IPresenceService m_PresenceService; | ||
55 | |||
56 | public LocalPresenceServicesConnector() | ||
57 | { | ||
58 | } | ||
59 | |||
60 | public LocalPresenceServicesConnector(IConfigSource source) | ||
61 | { | ||
62 | Initialise(source); | ||
63 | } | ||
64 | |||
65 | #region ISharedRegionModule | 48 | #region ISharedRegionModule |
66 | 49 | ||
67 | public Type ReplaceableInterface | ||
68 | { | ||
69 | get { return null; } | ||
70 | } | ||
71 | |||
72 | public string Name | 50 | public string Name |
73 | { | 51 | { |
74 | get { return "LocalPresenceServicesConnector"; } | 52 | get { return "LocalPresenceServicesConnector"; } |
@@ -119,81 +97,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
119 | } | 97 | } |
120 | } | 98 | } |
121 | 99 | ||
122 | public void PostInitialise() | ||
123 | { | ||
124 | } | ||
125 | |||
126 | public void Close() | ||
127 | { | ||
128 | } | ||
129 | |||
130 | public void AddRegion(Scene scene) | ||
131 | { | ||
132 | if (!m_Enabled) | ||
133 | return; | ||
134 | |||
135 | // m_log.DebugFormat( | ||
136 | // "[LOCAL PRESENCE CONNECTOR]: Registering IPresenceService to scene {0}", scene.RegionInfo.RegionName); | ||
137 | |||
138 | scene.RegisterModuleInterface<IPresenceService>(this); | ||
139 | m_PresenceDetector.AddRegion(scene); | ||
140 | |||
141 | m_log.InfoFormat("[LOCAL PRESENCE CONNECTOR]: Enabled local presence for region {0}", scene.RegionInfo.RegionName); | ||
142 | |||
143 | } | ||
144 | |||
145 | public void RemoveRegion(Scene scene) | ||
146 | { | ||
147 | if (!m_Enabled) | ||
148 | return; | ||
149 | |||
150 | m_PresenceDetector.RemoveRegion(scene); | ||
151 | } | ||
152 | |||
153 | public void RegionLoaded(Scene scene) | ||
154 | { | ||
155 | if (!m_Enabled) | ||
156 | return; | ||
157 | |||
158 | } | ||
159 | |||
160 | #endregion | ||
161 | |||
162 | #region IPresenceService | ||
163 | |||
164 | public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) | ||
165 | { | ||
166 | m_log.Warn("[LOCAL PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators"); | ||
167 | return false; | ||
168 | } | ||
169 | |||
170 | public bool LogoutAgent(UUID sessionID) | ||
171 | { | ||
172 | return m_PresenceService.LogoutAgent(sessionID); | ||
173 | } | ||
174 | |||
175 | |||
176 | public bool LogoutRegionAgents(UUID regionID) | ||
177 | { | ||
178 | return m_PresenceService.LogoutRegionAgents(regionID); | ||
179 | } | ||
180 | |||
181 | public bool ReportAgent(UUID sessionID, UUID regionID) | ||
182 | { | ||
183 | return m_PresenceService.ReportAgent(sessionID, regionID); | ||
184 | } | ||
185 | |||
186 | public PresenceInfo GetAgent(UUID sessionID) | ||
187 | { | ||
188 | return m_PresenceService.GetAgent(sessionID); | ||
189 | } | ||
190 | |||
191 | public PresenceInfo[] GetAgents(string[] userIDs) | ||
192 | { | ||
193 | return m_PresenceService.GetAgents(userIDs); | ||
194 | } | ||
195 | |||
196 | #endregion | 100 | #endregion |
197 | |||
198 | } | 101 | } |
199 | } | 102 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs index bf4e9ab..6ca5c28 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/RemotePresenceServiceConnector.cs | |||
@@ -37,26 +37,18 @@ using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | |||
37 | 37 | ||
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | using log4net; | 39 | using log4net; |
40 | using Mono.Addins; | ||
40 | using Nini.Config; | 41 | using Nini.Config; |
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence |
43 | { | 44 | { |
44 | public class RemotePresenceServicesConnector : ISharedRegionModule, IPresenceService | 45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemotePresenceServicesConnector")] |
46 | public class RemotePresenceServicesConnector : BasePresenceServiceConnector, ISharedRegionModule | ||
45 | { | 47 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 49 | ||
48 | #region ISharedRegionModule | 50 | #region ISharedRegionModule |
49 | 51 | ||
50 | private bool m_Enabled = false; | ||
51 | |||
52 | private PresenceDetector m_PresenceDetector; | ||
53 | private IPresenceService m_RemoteConnector; | ||
54 | |||
55 | public Type ReplaceableInterface | ||
56 | { | ||
57 | get { return null; } | ||
58 | } | ||
59 | |||
60 | public string Name | 52 | public string Name |
61 | { | 53 | { |
62 | get { return "RemotePresenceServicesConnector"; } | 54 | get { return "RemotePresenceServicesConnector"; } |
@@ -70,7 +62,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
70 | string name = moduleConfig.GetString("PresenceServices", ""); | 62 | string name = moduleConfig.GetString("PresenceServices", ""); |
71 | if (name == Name) | 63 | if (name == Name) |
72 | { | 64 | { |
73 | m_RemoteConnector = new PresenceServicesConnector(source); | 65 | m_PresenceService = new PresenceServicesConnector(source); |
74 | 66 | ||
75 | m_Enabled = true; | 67 | m_Enabled = true; |
76 | 68 | ||
@@ -79,81 +71,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence | |||
79 | m_log.Info("[REMOTE PRESENCE CONNECTOR]: Remote presence enabled"); | 71 | m_log.Info("[REMOTE PRESENCE CONNECTOR]: Remote presence enabled"); |
80 | } | 72 | } |
81 | } | 73 | } |
82 | |||
83 | } | ||
84 | |||
85 | public void PostInitialise() | ||
86 | { | ||
87 | } | ||
88 | |||
89 | public void Close() | ||
90 | { | ||
91 | } | ||
92 | |||
93 | public void AddRegion(Scene scene) | ||
94 | { | ||
95 | if (!m_Enabled) | ||
96 | return; | ||
97 | |||
98 | scene.RegisterModuleInterface<IPresenceService>(this); | ||
99 | m_PresenceDetector.AddRegion(scene); | ||
100 | |||
101 | m_log.InfoFormat("[REMOTE PRESENCE CONNECTOR]: Enabled remote presence for region {0}", scene.RegionInfo.RegionName); | ||
102 | |||
103 | } | ||
104 | |||
105 | public void RemoveRegion(Scene scene) | ||
106 | { | ||
107 | if (!m_Enabled) | ||
108 | return; | ||
109 | |||
110 | m_PresenceDetector.RemoveRegion(scene); | ||
111 | } | ||
112 | |||
113 | public void RegionLoaded(Scene scene) | ||
114 | { | ||
115 | if (!m_Enabled) | ||
116 | return; | ||
117 | |||
118 | } | ||
119 | |||
120 | #endregion | ||
121 | |||
122 | #region IPresenceService | ||
123 | |||
124 | public bool LoginAgent(string userID, UUID sessionID, UUID secureSessionID) | ||
125 | { | ||
126 | m_log.Warn("[REMOTE PRESENCE CONNECTOR]: LoginAgent connector not implemented at the simulators"); | ||
127 | return false; | ||
128 | } | ||
129 | |||
130 | public bool LogoutAgent(UUID sessionID) | ||
131 | { | ||
132 | return m_RemoteConnector.LogoutAgent(sessionID); | ||
133 | } | ||
134 | |||
135 | |||
136 | public bool LogoutRegionAgents(UUID regionID) | ||
137 | { | ||
138 | return m_RemoteConnector.LogoutRegionAgents(regionID); | ||
139 | } | ||
140 | |||
141 | public bool ReportAgent(UUID sessionID, UUID regionID) | ||
142 | { | ||
143 | return m_RemoteConnector.ReportAgent(sessionID, regionID); | ||
144 | } | ||
145 | |||
146 | public PresenceInfo GetAgent(UUID sessionID) | ||
147 | { | ||
148 | return m_RemoteConnector.GetAgent(sessionID); | ||
149 | } | ||
150 | |||
151 | public PresenceInfo[] GetAgents(string[] userIDs) | ||
152 | { | ||
153 | return m_RemoteConnector.GetAgents(userIDs); | ||
154 | } | 74 | } |
155 | 75 | ||
156 | #endregion | 76 | #endregion |
157 | |||
158 | } | 77 | } |
159 | } | 78 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs index 4556df3..7e365ca 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs | |||
@@ -35,7 +35,6 @@ using NUnit.Framework; | |||
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using Nini.Config; | 37 | using Nini.Config; |
38 | |||
39 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; | 38 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; |
40 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
41 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | 40 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; |
@@ -44,7 +43,7 @@ using OpenSim.Tests.Common; | |||
44 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests | 43 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests |
45 | { | 44 | { |
46 | [TestFixture] | 45 | [TestFixture] |
47 | public class PresenceConnectorsTests | 46 | public class PresenceConnectorsTests : OpenSimTestCase |
48 | { | 47 | { |
49 | LocalPresenceServicesConnector m_LocalConnector; | 48 | LocalPresenceServicesConnector m_LocalConnector; |
50 | private void SetUp() | 49 | private void SetUp() |
@@ -56,7 +55,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests | |||
56 | config.Configs["PresenceService"].Set("LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService"); | 55 | config.Configs["PresenceService"].Set("LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService"); |
57 | config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 56 | config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
58 | 57 | ||
59 | m_LocalConnector = new LocalPresenceServicesConnector(config); | 58 | m_LocalConnector = new LocalPresenceServicesConnector(); |
59 | m_LocalConnector.Initialise(config); | ||
60 | 60 | ||
61 | // Let's stick in a test presence | 61 | // Let's stick in a test presence |
62 | m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero); | 62 | m_LocalConnector.m_PresenceService.LoginAgent(UUID.Zero.ToString(), UUID.Zero, UUID.Zero); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 1e52d37..3c18074 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -29,6 +29,7 @@ using System.Collections.Generic; | |||
29 | using System.Linq; | 29 | using System.Linq; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -39,6 +40,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalSimulationConnectorModule")] | ||
42 | public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService | 44 | public class LocalSimulationConnectorModule : ISharedRegionModule, ISimulationService |
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); |
@@ -58,7 +60,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
58 | /// </summary> | 60 | /// </summary> |
59 | private bool m_ModuleEnabled = false; | 61 | private bool m_ModuleEnabled = false; |
60 | 62 | ||
61 | #region IRegionModule | 63 | #region Region Module interface |
62 | 64 | ||
63 | public void Initialise(IConfigSource config) | 65 | public void Initialise(IConfigSource config) |
64 | { | 66 | { |
@@ -156,7 +158,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
156 | } | 158 | } |
157 | } | 159 | } |
158 | 160 | ||
159 | #endregion /* IRegionModule */ | 161 | #endregion |
160 | 162 | ||
161 | #region ISimulation | 163 | #region ISimulation |
162 | 164 | ||
@@ -374,4 +376,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
374 | 376 | ||
375 | #endregion | 377 | #endregion |
376 | } | 378 | } |
377 | } \ No newline at end of file | 379 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index bd4a23b..b2a1b23 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -32,6 +32,7 @@ using System.Net; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text; | 33 | using System.Text; |
34 | using log4net; | 34 | using log4net; |
35 | using Mono.Addins; | ||
35 | using Nini.Config; | 36 | using Nini.Config; |
36 | using OpenMetaverse; | 37 | using OpenMetaverse; |
37 | using OpenMetaverse.StructuredData; | 38 | using OpenMetaverse.StructuredData; |
@@ -46,6 +47,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
46 | 47 | ||
47 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | 48 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation |
48 | { | 49 | { |
50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteSimulationConnectorModule")] | ||
49 | public class RemoteSimulationConnectorModule : ISharedRegionModule, ISimulationService | 51 | public class RemoteSimulationConnectorModule : ISharedRegionModule, ISimulationService |
50 | { | 52 | { |
51 | private bool initialized = false; | 53 | private bool initialized = false; |
@@ -60,7 +62,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
60 | protected bool m_safemode; | 62 | protected bool m_safemode; |
61 | protected IPAddress m_thisIP; | 63 | protected IPAddress m_thisIP; |
62 | 64 | ||
63 | #region IRegionModule | 65 | #region Region Module interface |
64 | 66 | ||
65 | public virtual void Initialise(IConfigSource config) | 67 | public virtual void Initialise(IConfigSource config) |
66 | { | 68 | { |
@@ -147,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
147 | m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName); | 149 | m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName); |
148 | } | 150 | } |
149 | 151 | ||
150 | #endregion /* IRegionModule */ | 152 | #endregion |
151 | 153 | ||
152 | #region IInterregionComms | 154 | #region IInterregionComms |
153 | 155 | ||
@@ -302,4 +304,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
302 | 304 | ||
303 | #endregion /* IInterregionComms */ | 305 | #endregion /* IInterregionComms */ |
304 | } | 306 | } |
305 | } \ No newline at end of file | 307 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 0a0ce3c..529bfd7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
@@ -39,6 +40,7 @@ using OpenMetaverse; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | 41 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalUserAccountServicesConnector")] | ||
42 | public class LocalUserAccountServicesConnector : ISharedRegionModule, IUserAccountService | 44 | public class LocalUserAccountServicesConnector : ISharedRegionModule, IUserAccountService |
43 | { | 45 | { |
44 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index 3321b38..5aa87d3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using Nini.Config; | 29 | using Nini.Config; |
30 | using log4net; | 30 | using log4net; |
31 | using Mono.Addins; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
33 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
@@ -38,6 +39,7 @@ using OpenMetaverse; | |||
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | 40 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts |
40 | { | 41 | { |
42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteUserAccountServicesConnector")] | ||
41 | public class RemoteUserAccountServicesConnector : UserAccountServicesConnector, | 43 | public class RemoteUserAccountServicesConnector : UserAccountServicesConnector, |
42 | ISharedRegionModule, IUserAccountService | 44 | ISharedRegionModule, IUserAccountService |
43 | { | 45 | { |
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index e7b1454..1599f15 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -39,6 +40,7 @@ using OpenSim.Services.Interfaces; | |||
39 | 40 | ||
40 | namespace OpenSim.Region.CoreModules.World | 41 | namespace OpenSim.Region.CoreModules.World |
41 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AccessModule")] | ||
42 | public class AccessModule : ISharedRegionModule | 44 | public class AccessModule : ISharedRegionModule |
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); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index ea806ec..c810242 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -552,13 +552,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
552 | 552 | ||
553 | // Validate User and Group UUID's | 553 | // Validate User and Group UUID's |
554 | 554 | ||
555 | if (!ResolveUserUuid(scene, parcel.OwnerID)) | 555 | if (parcel.IsGroupOwned) |
556 | parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner; | ||
557 | |||
558 | if (!ResolveGroupUuid(parcel.GroupID)) | ||
559 | { | 556 | { |
560 | parcel.GroupID = UUID.Zero; | 557 | if (!ResolveGroupUuid(parcel.GroupID)) |
561 | parcel.IsGroupOwned = false; | 558 | { |
559 | parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner; | ||
560 | parcel.GroupID = UUID.Zero; | ||
561 | parcel.IsGroupOwned = false; | ||
562 | } | ||
563 | } | ||
564 | else | ||
565 | { | ||
566 | if (!ResolveUserUuid(scene, parcel.OwnerID)) | ||
567 | parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner; | ||
568 | |||
569 | if (!ResolveGroupUuid(parcel.GroupID)) | ||
570 | parcel.GroupID = UUID.Zero; | ||
562 | } | 571 | } |
563 | 572 | ||
564 | List<LandAccessEntry> accessList = new List<LandAccessEntry>(); | 573 | List<LandAccessEntry> accessList = new List<LandAccessEntry>(); |
@@ -571,8 +580,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
571 | parcel.ParcelAccessList = accessList; | 580 | parcel.ParcelAccessList = accessList; |
572 | 581 | ||
573 | // m_log.DebugFormat( | 582 | // m_log.DebugFormat( |
574 | // "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}", | 583 | // "[ARCHIVER]: Adding parcel {0}, local id {1}, owner {2}, group {3}, isGroupOwned {4}, area {5}", |
575 | // parcel.Name, parcel.LocalID, parcel.Area); | 584 | // parcel.Name, parcel.LocalID, parcel.OwnerID, parcel.GroupID, parcel.IsGroupOwned, parcel.Area); |
576 | 585 | ||
577 | landData.Add(parcel); | 586 | landData.Add(parcel); |
578 | } | 587 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs index a66ed88..d8dace2 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs | |||
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
110 | lastX = (lastX == null) ? curLastX : (lastX > curLastX) ? lastX : curLastX; | 110 | lastX = (lastX == null) ? curLastX : (lastX > curLastX) ? lastX : curLastX; |
111 | } | 111 | } |
112 | 112 | ||
113 | Rect = new Rectangle((int)firstX, (int)firstY, (int)(lastY - firstY + 1), (int)(lastX - firstX + 1)); | 113 | Rect = new Rectangle((int)firstX, (int)firstY, (int)(lastX - firstX + 1), (int)(lastY - firstY + 1)); |
114 | 114 | ||
115 | 115 | ||
116 | // Calculate the subdirectory in which each region will be stored in the archive | 116 | // Calculate the subdirectory in which each region will be stored in the archive |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs index d751b1c..7bdd65c 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs | |||
@@ -167,7 +167,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
167 | } | 167 | } |
168 | scenesGroup.CalcSceneLocations(); | 168 | scenesGroup.CalcSceneLocations(); |
169 | 169 | ||
170 | |||
171 | m_archiveWriter = new TarArchiveWriter(m_saveStream); | 170 | m_archiveWriter = new TarArchiveWriter(m_saveStream); |
172 | 171 | ||
173 | try | 172 | try |
@@ -216,7 +215,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
216 | } | 215 | } |
217 | } | 216 | } |
218 | 217 | ||
219 | |||
220 | private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, AssetType> assetUuids) | 218 | private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, AssetType> assetUuids) |
221 | { | 219 | { |
222 | m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.RegionInfo.RegionName); | 220 | m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.RegionInfo.RegionName); |
@@ -540,7 +538,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
540 | xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); | 538 | xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); |
541 | } | 539 | } |
542 | 540 | ||
543 | |||
544 | protected void Save(Scene scene, List<SceneObjectGroup> sceneObjects, string regionDir) | 541 | protected void Save(Scene scene, List<SceneObjectGroup> sceneObjects, string regionDir) |
545 | { | 542 | { |
546 | if (regionDir != string.Empty) | 543 | if (regionDir != string.Empty) |
@@ -560,8 +557,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
560 | foreach (ILandObject lo in landObjects) | 557 | foreach (ILandObject lo in landObjects) |
561 | { | 558 | { |
562 | LandData landData = lo.LandData; | 559 | LandData landData = lo.LandData; |
563 | string landDataPath = String.Format("{0}{1}{2}.xml", | 560 | string landDataPath |
564 | regionDir, ArchiveConstants.LANDDATA_PATH, landData.GlobalID.ToString()); | 561 | = String.Format("{0}{1}", regionDir, ArchiveConstants.CreateOarLandDataPath(landData)); |
565 | m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData, m_options)); | 562 | m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData, m_options)); |
566 | } | 563 | } |
567 | 564 | ||
@@ -604,7 +601,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
604 | 601 | ||
605 | CloseArchive(String.Empty); | 602 | CloseArchive(String.Empty); |
606 | } | 603 | } |
607 | |||
608 | 604 | ||
609 | /// <summary> | 605 | /// <summary> |
610 | /// Closes the archive and notifies that we're done. | 606 | /// Closes the archive and notifies that we're done. |
@@ -629,6 +625,5 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
629 | 625 | ||
630 | m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage); | 626 | m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage); |
631 | } | 627 | } |
632 | |||
633 | } | 628 | } |
634 | } | 629 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 2a87dc2..1be6386 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -32,6 +32,9 @@ using System.Reflection; | |||
32 | using log4net; | 32 | using log4net; |
33 | using NDesk.Options; | 33 | using NDesk.Options; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using Mono.Addins; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
37 | 40 | ||
@@ -40,6 +43,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
40 | /// <summary> | 43 | /// <summary> |
41 | /// This module loads and saves OpenSimulator region archives | 44 | /// This module loads and saves OpenSimulator region archives |
42 | /// </summary> | 45 | /// </summary> |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ArchiverModule")] | ||
43 | public class ArchiverModule : INonSharedRegionModule, IRegionArchiverModule | 47 | public class ArchiverModule : INonSharedRegionModule, IRegionArchiverModule |
44 | { | 48 | { |
45 | private static readonly ILog m_log = | 49 | private static readonly ILog m_log = |
@@ -117,7 +121,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
117 | // | 121 | // |
118 | // foreach (string param in mainParams) | 122 | // foreach (string param in mainParams) |
119 | // m_log.DebugFormat("GOT PARAM [{0}]", param); | 123 | // m_log.DebugFormat("GOT PARAM [{0}]", param); |
120 | 124 | ||
121 | if (mainParams.Count > 2) | 125 | if (mainParams.Count > 2) |
122 | { | 126 | { |
123 | DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty); | 127 | DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty); |
@@ -150,14 +154,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
150 | 154 | ||
151 | List<string> mainParams = ops.Parse(cmdparams); | 155 | List<string> mainParams = ops.Parse(cmdparams); |
152 | 156 | ||
157 | string path; | ||
153 | if (mainParams.Count > 2) | 158 | if (mainParams.Count > 2) |
154 | { | 159 | path = mainParams[2]; |
155 | ArchiveRegion(mainParams[2], options); | ||
156 | } | ||
157 | else | 160 | else |
158 | { | 161 | path = DEFAULT_OAR_BACKUP_FILENAME; |
159 | ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, options); | 162 | |
160 | } | 163 | // Not doing this right now as this causes some problems with auto-backup systems. Maybe a force flag is |
164 | // needed | ||
165 | // if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, path)) | ||
166 | // return; | ||
167 | |||
168 | ArchiveRegion(path, options); | ||
161 | } | 169 | } |
162 | 170 | ||
163 | public void ArchiveRegion(string savePath, Dictionary<string, object> options) | 171 | public void ArchiveRegion(string savePath, Dictionary<string, object> options) |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 5787279..103eb47 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -129,6 +129,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
129 | m_options = options; | 129 | m_options = options; |
130 | m_repliesRequired = uuids.Count; | 130 | m_repliesRequired = uuids.Count; |
131 | 131 | ||
132 | // FIXME: This is a really poor way of handling the timeout since it will always leave the original requesting thread | ||
133 | // hanging. Need to restructure so an original request thread waits for a ManualResetEvent on asset received | ||
134 | // so we can properly abort that thread. Or request all assets synchronously, though that would be a more | ||
135 | // radical change | ||
132 | m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT); | 136 | m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT); |
133 | m_requestCallbackTimer.AutoReset = false; | 137 | m_requestCallbackTimer.AutoReset = false; |
134 | m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout); | 138 | m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 82f49b0..eec1cec 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -31,16 +31,19 @@ using System.IO; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using log4net.Config; | 33 | using log4net.Config; |
34 | using Nini.Config; | ||
34 | using NUnit.Framework; | 35 | using NUnit.Framework; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
36 | using OpenMetaverse.Assets; | 37 | using OpenMetaverse.Assets; |
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Serialization; | 39 | using OpenSim.Framework.Serialization; |
39 | using OpenSim.Framework.Serialization.External; | 40 | using OpenSim.Framework.Serialization.External; |
41 | using OpenSim.Region.CoreModules.World.Land; | ||
40 | using OpenSim.Region.CoreModules.World.Serialiser; | 42 | using OpenSim.Region.CoreModules.World.Serialiser; |
41 | using OpenSim.Region.CoreModules.World.Terrain; | 43 | using OpenSim.Region.CoreModules.World.Terrain; |
42 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Region.Framework.Scenes.Serialization; | 45 | using OpenSim.Region.Framework.Scenes.Serialization; |
46 | using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; | ||
44 | using OpenSim.Tests.Common; | 47 | using OpenSim.Tests.Common; |
45 | using OpenSim.Tests.Common.Mock; | 48 | using OpenSim.Tests.Common.Mock; |
46 | using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; | 49 | using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; |
@@ -69,9 +72,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
69 | { | 72 | { |
70 | base.SetUp(); | 73 | base.SetUp(); |
71 | 74 | ||
72 | // FIXME: Do something about this - relying on statics in unit tests causes trouble sooner or later | ||
73 | new SceneManager(); | ||
74 | |||
75 | m_archiverModule = new ArchiverModule(); | 75 | m_archiverModule = new ArchiverModule(); |
76 | m_serialiserModule = new SerialiserModule(); | 76 | m_serialiserModule = new SerialiserModule(); |
77 | TerrainModule terrainModule = new TerrainModule(); | 77 | TerrainModule terrainModule = new TerrainModule(); |
@@ -127,6 +127,53 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
127 | 127 | ||
128 | return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; | 128 | return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; |
129 | } | 129 | } |
130 | |||
131 | private void CreateTestObjects(Scene scene, out SceneObjectGroup sog1, out SceneObjectGroup sog2, out UUID ncAssetUuid) | ||
132 | { | ||
133 | SceneObjectPart part1 = CreateSceneObjectPart1(); | ||
134 | sog1 = new SceneObjectGroup(part1); | ||
135 | scene.AddNewSceneObject(sog1, false); | ||
136 | |||
137 | AssetNotecard nc = new AssetNotecard(); | ||
138 | nc.BodyText = "Hello World!"; | ||
139 | nc.Encode(); | ||
140 | ncAssetUuid = UUID.Random(); | ||
141 | UUID ncItemUuid = UUID.Random(); | ||
142 | AssetBase ncAsset | ||
143 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); | ||
144 | m_scene.AssetService.Store(ncAsset); | ||
145 | |||
146 | TaskInventoryItem ncItem | ||
147 | = new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid }; | ||
148 | SceneObjectPart part2 = CreateSceneObjectPart2(); | ||
149 | sog2 = new SceneObjectGroup(part2); | ||
150 | part2.Inventory.AddInventoryItem(ncItem, true); | ||
151 | |||
152 | scene.AddNewSceneObject(sog2, false); | ||
153 | } | ||
154 | |||
155 | private static void CreateSoundAsset(TarArchiveWriter tar, Assembly assembly, string soundDataResourceName, out byte[] soundData, out UUID soundUuid) | ||
156 | { | ||
157 | using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName)) | ||
158 | { | ||
159 | using (BinaryReader br = new BinaryReader(resource)) | ||
160 | { | ||
161 | // FIXME: Use the inspector instead | ||
162 | soundData = br.ReadBytes(99999999); | ||
163 | soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
164 | string soundAssetFileName | ||
165 | = ArchiveConstants.ASSETS_PATH + soundUuid | ||
166 | + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV]; | ||
167 | tar.WriteFile(soundAssetFileName, soundData); | ||
168 | |||
169 | /* | ||
170 | AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData); | ||
171 | scene.AssetService.Store(soundAsset); | ||
172 | asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav"; | ||
173 | */ | ||
174 | } | ||
175 | } | ||
176 | } | ||
130 | 177 | ||
131 | /// <summary> | 178 | /// <summary> |
132 | /// Test saving an OpenSim Region Archive. | 179 | /// Test saving an OpenSim Region Archive. |
@@ -204,30 +251,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
204 | // TODO: Test presence of more files and contents of files. | 251 | // TODO: Test presence of more files and contents of files. |
205 | } | 252 | } |
206 | 253 | ||
207 | private void CreateTestObjects(Scene scene, out SceneObjectGroup sog1, out SceneObjectGroup sog2, out UUID ncAssetUuid) | ||
208 | { | ||
209 | SceneObjectPart part1 = CreateSceneObjectPart1(); | ||
210 | sog1 = new SceneObjectGroup(part1); | ||
211 | scene.AddNewSceneObject(sog1, false); | ||
212 | |||
213 | AssetNotecard nc = new AssetNotecard(); | ||
214 | nc.BodyText = "Hello World!"; | ||
215 | nc.Encode(); | ||
216 | ncAssetUuid = UUID.Random(); | ||
217 | UUID ncItemUuid = UUID.Random(); | ||
218 | AssetBase ncAsset | ||
219 | = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); | ||
220 | m_scene.AssetService.Store(ncAsset); | ||
221 | |||
222 | TaskInventoryItem ncItem | ||
223 | = new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid }; | ||
224 | SceneObjectPart part2 = CreateSceneObjectPart2(); | ||
225 | sog2 = new SceneObjectGroup(part2); | ||
226 | part2.Inventory.AddInventoryItem(ncItem, true); | ||
227 | |||
228 | scene.AddNewSceneObject(sog2, false); | ||
229 | } | ||
230 | |||
231 | /// <summary> | 254 | /// <summary> |
232 | /// Test saving an OpenSim Region Archive with the no assets option | 255 | /// Test saving an OpenSim Region Archive with the no assets option |
233 | /// </summary> | 256 | /// </summary> |
@@ -309,59 +332,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
309 | } | 332 | } |
310 | 333 | ||
311 | /// <summary> | 334 | /// <summary> |
312 | /// Test loading an OpenSim Region Archive where the scene object parts are not ordered by link number (e.g. | ||
313 | /// 2 can come after 3). | ||
314 | /// </summary> | ||
315 | [Test] | ||
316 | public void TestLoadOarUnorderedParts() | ||
317 | { | ||
318 | TestHelpers.InMethod(); | ||
319 | |||
320 | UUID ownerId = TestHelpers.ParseTail(0xaaaa); | ||
321 | |||
322 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
323 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | ||
324 | |||
325 | tar.WriteFile( | ||
326 | ArchiveConstants.CONTROL_FILE_PATH, | ||
327 | new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); | ||
328 | |||
329 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11); | ||
330 | SceneObjectPart sop2 | ||
331 | = SceneHelpers.CreateSceneObjectPart("obj1-Part2", TestHelpers.ParseTail(0x12), ownerId); | ||
332 | SceneObjectPart sop3 | ||
333 | = SceneHelpers.CreateSceneObjectPart("obj1-Part3", TestHelpers.ParseTail(0x13), ownerId); | ||
334 | |||
335 | // Add the parts so they will be written out in reverse order to the oar | ||
336 | sog1.AddPart(sop3); | ||
337 | sop3.LinkNum = 3; | ||
338 | sog1.AddPart(sop2); | ||
339 | sop2.LinkNum = 2; | ||
340 | |||
341 | tar.WriteFile( | ||
342 | ArchiveConstants.CreateOarObjectPath(sog1.Name, sog1.UUID, sog1.AbsolutePosition), | ||
343 | SceneObjectSerializer.ToXml2Format(sog1)); | ||
344 | |||
345 | tar.Close(); | ||
346 | |||
347 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
348 | |||
349 | lock (this) | ||
350 | { | ||
351 | m_scene.EventManager.OnOarFileLoaded += LoadCompleted; | ||
352 | m_archiverModule.DearchiveRegion(archiveReadStream); | ||
353 | } | ||
354 | |||
355 | Assert.That(m_lastErrorMessage, Is.Null); | ||
356 | |||
357 | SceneObjectPart part2 = m_scene.GetSceneObjectPart("obj1-Part2"); | ||
358 | Assert.That(part2.LinkNum, Is.EqualTo(2)); | ||
359 | |||
360 | SceneObjectPart part3 = m_scene.GetSceneObjectPart("obj1-Part3"); | ||
361 | Assert.That(part3.LinkNum, Is.EqualTo(3)); | ||
362 | } | ||
363 | |||
364 | /// <summary> | ||
365 | /// Test loading an OpenSim Region Archive. | 335 | /// Test loading an OpenSim Region Archive. |
366 | /// </summary> | 336 | /// </summary> |
367 | [Test] | 337 | [Test] |
@@ -435,50 +405,57 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
435 | TestLoadedRegion(part1, soundItemName, soundData); | 405 | TestLoadedRegion(part1, soundItemName, soundData); |
436 | } | 406 | } |
437 | 407 | ||
438 | private static void CreateSoundAsset(TarArchiveWriter tar, Assembly assembly, string soundDataResourceName, out byte[] soundData, out UUID soundUuid) | 408 | /// <summary> |
409 | /// Test loading an OpenSim Region Archive where the scene object parts are not ordered by link number (e.g. | ||
410 | /// 2 can come after 3). | ||
411 | /// </summary> | ||
412 | [Test] | ||
413 | public void TestLoadOarUnorderedParts() | ||
439 | { | 414 | { |
440 | using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName)) | 415 | TestHelpers.InMethod(); |
441 | { | ||
442 | using (BinaryReader br = new BinaryReader(resource)) | ||
443 | { | ||
444 | // FIXME: Use the inspector instead | ||
445 | soundData = br.ReadBytes(99999999); | ||
446 | soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
447 | string soundAssetFileName | ||
448 | = ArchiveConstants.ASSETS_PATH + soundUuid | ||
449 | + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV]; | ||
450 | tar.WriteFile(soundAssetFileName, soundData); | ||
451 | 416 | ||
452 | /* | 417 | UUID ownerId = TestHelpers.ParseTail(0xaaaa); |
453 | AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData); | ||
454 | scene.AssetService.Store(soundAsset); | ||
455 | asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav"; | ||
456 | */ | ||
457 | } | ||
458 | } | ||
459 | } | ||
460 | 418 | ||
461 | private void TestLoadedRegion(SceneObjectPart part1, string soundItemName, byte[] soundData) | 419 | MemoryStream archiveWriteStream = new MemoryStream(); |
462 | { | 420 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); |
463 | SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name); | ||
464 | 421 | ||
465 | Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); | 422 | tar.WriteFile( |
466 | Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical"); | 423 | ArchiveConstants.CONTROL_FILE_PATH, |
467 | Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal"); | 424 | new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); |
468 | Assert.That( | ||
469 | object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal"); | ||
470 | Assert.That( | ||
471 | object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal"); | ||
472 | Assert.That(object1PartLoaded.SitTargetOrientation, Is.EqualTo(part1.SitTargetOrientation)); | ||
473 | Assert.That(object1PartLoaded.SitTargetPosition, Is.EqualTo(part1.SitTargetPosition)); | ||
474 | 425 | ||
475 | TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0]; | 426 | SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11); |
476 | Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); | 427 | SceneObjectPart sop2 |
477 | AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); | 428 | = SceneHelpers.CreateSceneObjectPart("obj1-Part2", TestHelpers.ParseTail(0x12), ownerId); |
478 | Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); | 429 | SceneObjectPart sop3 |
479 | Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); | 430 | = SceneHelpers.CreateSceneObjectPart("obj1-Part3", TestHelpers.ParseTail(0x13), ownerId); |
480 | 431 | ||
481 | Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels"); | 432 | // Add the parts so they will be written out in reverse order to the oar |
433 | sog1.AddPart(sop3); | ||
434 | sop3.LinkNum = 3; | ||
435 | sog1.AddPart(sop2); | ||
436 | sop2.LinkNum = 2; | ||
437 | |||
438 | tar.WriteFile( | ||
439 | ArchiveConstants.CreateOarObjectPath(sog1.Name, sog1.UUID, sog1.AbsolutePosition), | ||
440 | SceneObjectSerializer.ToXml2Format(sog1)); | ||
441 | |||
442 | tar.Close(); | ||
443 | |||
444 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
445 | |||
446 | lock (this) | ||
447 | { | ||
448 | m_scene.EventManager.OnOarFileLoaded += LoadCompleted; | ||
449 | m_archiverModule.DearchiveRegion(archiveReadStream); | ||
450 | } | ||
451 | |||
452 | Assert.That(m_lastErrorMessage, Is.Null); | ||
453 | |||
454 | SceneObjectPart part2 = m_scene.GetSceneObjectPart("obj1-Part2"); | ||
455 | Assert.That(part2.LinkNum, Is.EqualTo(2)); | ||
456 | |||
457 | SceneObjectPart part3 = m_scene.GetSceneObjectPart("obj1-Part3"); | ||
458 | Assert.That(part3.LinkNum, Is.EqualTo(3)); | ||
482 | } | 459 | } |
483 | 460 | ||
484 | /// <summary> | 461 | /// <summary> |
@@ -538,8 +515,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
538 | SerialiserModule serialiserModule = new SerialiserModule(); | 515 | SerialiserModule serialiserModule = new SerialiserModule(); |
539 | TerrainModule terrainModule = new TerrainModule(); | 516 | TerrainModule terrainModule = new TerrainModule(); |
540 | 517 | ||
541 | m_sceneHelpers = new SceneHelpers(); | 518 | SceneHelpers m_sceneHelpers2 = new SceneHelpers(); |
542 | TestScene scene2 = m_sceneHelpers.SetupScene(); | 519 | TestScene scene2 = m_sceneHelpers2.SetupScene(); |
543 | SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule); | 520 | SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule); |
544 | 521 | ||
545 | // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is | 522 | // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is |
@@ -563,6 +540,71 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
563 | } | 540 | } |
564 | 541 | ||
565 | /// <summary> | 542 | /// <summary> |
543 | /// Test OAR loading where the land parcel is group deeded. | ||
544 | /// </summary> | ||
545 | /// <remarks> | ||
546 | /// In this situation, the owner ID is set to the group ID. | ||
547 | /// </remarks> | ||
548 | [Test] | ||
549 | public void TestLoadOarDeededLand() | ||
550 | { | ||
551 | TestHelpers.InMethod(); | ||
552 | // TestHelpers.EnableLogging(); | ||
553 | |||
554 | UUID landID = TestHelpers.ParseTail(0x10); | ||
555 | |||
556 | MockGroupsServicesConnector groupsService = new MockGroupsServicesConnector(); | ||
557 | |||
558 | IConfigSource configSource = new IniConfigSource(); | ||
559 | IConfig config = configSource.AddConfig("Groups"); | ||
560 | config.Set("Enabled", true); | ||
561 | config.Set("Module", "GroupsModule"); | ||
562 | config.Set("DebugEnabled", true); | ||
563 | SceneHelpers.SetupSceneModules( | ||
564 | m_scene, configSource, new object[] { new GroupsModule(), groupsService, new LandManagementModule() }); | ||
565 | |||
566 | // Create group in scene for loading | ||
567 | // FIXME: For now we'll put up with the issue that we'll get a group ID that varies across tests. | ||
568 | UUID groupID | ||
569 | = groupsService.CreateGroup(UUID.Zero, "group1", "", true, UUID.Zero, 3, true, true, true, UUID.Zero); | ||
570 | |||
571 | // Construct OAR | ||
572 | MemoryStream oarStream = new MemoryStream(); | ||
573 | TarArchiveWriter tar = new TarArchiveWriter(oarStream); | ||
574 | |||
575 | tar.WriteDir(ArchiveConstants.LANDDATA_PATH); | ||
576 | tar.WriteFile( | ||
577 | ArchiveConstants.CONTROL_FILE_PATH, | ||
578 | new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); | ||
579 | |||
580 | LandObject lo = new LandObject(groupID, true, null); | ||
581 | lo.SetLandBitmap(lo.BasicFullRegionLandBitmap()); | ||
582 | LandData ld = lo.LandData; | ||
583 | ld.GlobalID = landID; | ||
584 | |||
585 | string ldPath = ArchiveConstants.CreateOarLandDataPath(ld); | ||
586 | tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, null)); | ||
587 | tar.Close(); | ||
588 | |||
589 | oarStream = new MemoryStream(oarStream.ToArray()); | ||
590 | |||
591 | // Load OAR | ||
592 | lock (this) | ||
593 | { | ||
594 | m_scene.EventManager.OnOarFileLoaded += LoadCompleted; | ||
595 | m_archiverModule.DearchiveRegion(oarStream); | ||
596 | } | ||
597 | |||
598 | ILandObject rLo = m_scene.LandChannel.GetLandObject(16, 16); | ||
599 | LandData rLd = rLo.LandData; | ||
600 | |||
601 | Assert.That(rLd.GlobalID, Is.EqualTo(landID)); | ||
602 | Assert.That(rLd.OwnerID, Is.EqualTo(groupID)); | ||
603 | Assert.That(rLd.GroupID, Is.EqualTo(groupID)); | ||
604 | Assert.That(rLd.IsGroupOwned, Is.EqualTo(true)); | ||
605 | } | ||
606 | |||
607 | /// <summary> | ||
566 | /// Test loading the region settings of an OpenSim Region Archive. | 608 | /// Test loading the region settings of an OpenSim Region Archive. |
567 | /// </summary> | 609 | /// </summary> |
568 | [Test] | 610 | [Test] |
@@ -781,9 +823,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
781 | } | 823 | } |
782 | } | 824 | } |
783 | 825 | ||
784 | |||
785 | // Save OAR | 826 | // Save OAR |
786 | |||
787 | MemoryStream archiveWriteStream = new MemoryStream(); | 827 | MemoryStream archiveWriteStream = new MemoryStream(); |
788 | m_scene.EventManager.OnOarFileSaved += SaveCompleted; | 828 | m_scene.EventManager.OnOarFileSaved += SaveCompleted; |
789 | 829 | ||
@@ -800,7 +840,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
800 | 840 | ||
801 | 841 | ||
802 | // Check that the OAR contains the expected data | 842 | // Check that the OAR contains the expected data |
803 | |||
804 | Assert.That(m_lastRequestId, Is.EqualTo(requestId)); | 843 | Assert.That(m_lastRequestId, Is.EqualTo(requestId)); |
805 | 844 | ||
806 | byte[] archive = archiveWriteStream.ToArray(); | 845 | byte[] archive = archiveWriteStream.ToArray(); |
@@ -892,7 +931,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
892 | } | 931 | } |
893 | 932 | ||
894 | ArchiveScenesGroup scenesGroup = new ArchiveScenesGroup(); | 933 | ArchiveScenesGroup scenesGroup = new ArchiveScenesGroup(); |
895 | SceneManager.Instance.ForEachScene(delegate(Scene scene) | 934 | m_sceneHelpers.SceneManager.ForEachScene(delegate(Scene scene) |
896 | { | 935 | { |
897 | scenesGroup.AddScene(scene); | 936 | scenesGroup.AddScene(scene); |
898 | }); | 937 | }); |
@@ -950,13 +989,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
950 | 989 | ||
951 | // Delete the current objects, to test that they're loaded from the OAR and didn't | 990 | // Delete the current objects, to test that they're loaded from the OAR and didn't |
952 | // just remain in the scene. | 991 | // just remain in the scene. |
953 | SceneManager.Instance.ForEachScene(delegate(Scene scene) | 992 | m_sceneHelpers.SceneManager.ForEachScene(delegate(Scene scene) |
954 | { | 993 | { |
955 | scene.DeleteAllSceneObjects(); | 994 | scene.DeleteAllSceneObjects(); |
956 | }); | 995 | }); |
957 | 996 | ||
958 | // Create a "hole", to test that that the corresponding region isn't loaded from the OAR | 997 | // Create a "hole", to test that that the corresponding region isn't loaded from the OAR |
959 | SceneManager.Instance.CloseScene(SceneManager.Instance.Scenes[1]); | 998 | m_sceneHelpers.SceneManager.CloseScene(SceneManager.Instance.Scenes[1]); |
960 | 999 | ||
961 | 1000 | ||
962 | // Check thay the OAR file contains the expected data | 1001 | // Check thay the OAR file contains the expected data |
@@ -971,10 +1010,32 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
971 | 1010 | ||
972 | Assert.That(m_lastErrorMessage, Is.Null); | 1011 | Assert.That(m_lastErrorMessage, Is.Null); |
973 | 1012 | ||
974 | Assert.AreEqual(3, SceneManager.Instance.Scenes.Count); | 1013 | Assert.AreEqual(3, m_sceneHelpers.SceneManager.Scenes.Count); |
975 | 1014 | ||
976 | TestLoadedRegion(part1, soundItemName, soundData); | 1015 | TestLoadedRegion(part1, soundItemName, soundData); |
977 | } | 1016 | } |
978 | 1017 | ||
1018 | private void TestLoadedRegion(SceneObjectPart part1, string soundItemName, byte[] soundData) | ||
1019 | { | ||
1020 | SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name); | ||
1021 | |||
1022 | Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); | ||
1023 | Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical"); | ||
1024 | Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal"); | ||
1025 | Assert.That( | ||
1026 | object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal"); | ||
1027 | Assert.That( | ||
1028 | object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal"); | ||
1029 | Assert.That(object1PartLoaded.SitTargetOrientation, Is.EqualTo(part1.SitTargetOrientation)); | ||
1030 | Assert.That(object1PartLoaded.SitTargetPosition, Is.EqualTo(part1.SitTargetPosition)); | ||
1031 | |||
1032 | TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0]; | ||
1033 | Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); | ||
1034 | AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); | ||
1035 | Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); | ||
1036 | Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); | ||
1037 | |||
1038 | Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels"); | ||
1039 | } | ||
979 | } | 1040 | } |
980 | } | 1041 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs index 5fa3dc2..d217f36 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs | |||
@@ -27,15 +27,17 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Mono.Addins; | ||
30 | using Nini.Config; | 31 | using Nini.Config; |
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
35 | 36 | ||
36 | namespace OpenSim.Region.CoreModules | 37 | namespace OpenSim.Region.CoreModules.World |
37 | { | 38 | { |
38 | public class CloudModule : ICloudModule | 39 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CloudModule")] |
40 | public class CloudModule : ICloudModule, INonSharedRegionModule | ||
39 | { | 41 | { |
40 | // private static readonly log4net.ILog m_log | 42 | // private static readonly log4net.ILog m_log |
41 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 43 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
@@ -48,7 +50,7 @@ namespace OpenSim.Region.CoreModules | |||
48 | private float m_cloudDensity = 1.0F; | 50 | private float m_cloudDensity = 1.0F; |
49 | private float[] cloudCover = new float[16 * 16]; | 51 | private float[] cloudCover = new float[16 * 16]; |
50 | 52 | ||
51 | public void Initialise(Scene scene, IConfigSource config) | 53 | public void Initialise(IConfigSource config) |
52 | { | 54 | { |
53 | IConfig cloudConfig = config.Configs["Cloud"]; | 55 | IConfig cloudConfig = config.Configs["Cloud"]; |
54 | 56 | ||
@@ -59,21 +61,40 @@ namespace OpenSim.Region.CoreModules | |||
59 | m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); | 61 | m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); |
60 | } | 62 | } |
61 | 63 | ||
62 | if (m_enabled) | 64 | } |
63 | { | ||
64 | 65 | ||
65 | m_scene = scene; | 66 | public void AddRegion(Scene scene) |
67 | { | ||
68 | if (!m_enabled) | ||
69 | return; | ||
66 | 70 | ||
67 | scene.EventManager.OnNewClient += CloudsToClient; | 71 | m_scene = scene; |
68 | scene.RegisterModuleInterface<ICloudModule>(this); | ||
69 | scene.EventManager.OnFrame += CloudUpdate; | ||
70 | 72 | ||
71 | GenerateCloudCover(); | 73 | scene.EventManager.OnNewClient += CloudsToClient; |
74 | scene.RegisterModuleInterface<ICloudModule>(this); | ||
75 | scene.EventManager.OnFrame += CloudUpdate; | ||
72 | 76 | ||
73 | m_ready = true; | 77 | GenerateCloudCover(); |
74 | 78 | ||
75 | } | 79 | m_ready = true; |
80 | } | ||
81 | |||
82 | public void RemoveRegion(Scene scene) | ||
83 | { | ||
84 | if (!m_enabled) | ||
85 | return; | ||
76 | 86 | ||
87 | m_ready = false; | ||
88 | // Remove our hooks | ||
89 | m_scene.EventManager.OnNewClient -= CloudsToClient; | ||
90 | m_scene.EventManager.OnFrame -= CloudUpdate; | ||
91 | m_scene.UnregisterModuleInterface<ICloudModule>(this); | ||
92 | |||
93 | m_scene = null; | ||
94 | } | ||
95 | |||
96 | public void RegionLoaded(Scene scene) | ||
97 | { | ||
77 | } | 98 | } |
78 | 99 | ||
79 | public void PostInitialise() | 100 | public void PostInitialise() |
@@ -82,13 +103,6 @@ namespace OpenSim.Region.CoreModules | |||
82 | 103 | ||
83 | public void Close() | 104 | public void Close() |
84 | { | 105 | { |
85 | if (m_enabled) | ||
86 | { | ||
87 | m_ready = false; | ||
88 | // Remove our hooks | ||
89 | m_scene.EventManager.OnNewClient -= CloudsToClient; | ||
90 | m_scene.EventManager.OnFrame -= CloudUpdate; | ||
91 | } | ||
92 | } | 106 | } |
93 | 107 | ||
94 | public string Name | 108 | public string Name |
@@ -96,12 +110,11 @@ namespace OpenSim.Region.CoreModules | |||
96 | get { return "CloudModule"; } | 110 | get { return "CloudModule"; } |
97 | } | 111 | } |
98 | 112 | ||
99 | public bool IsSharedModule | 113 | public Type ReplaceableInterface |
100 | { | 114 | { |
101 | get { return false; } | 115 | get { return null; } |
102 | } | 116 | } |
103 | 117 | ||
104 | |||
105 | public float CloudCover(int x, int y, int z) | 118 | public float CloudCover(int x, int y, int z) |
106 | { | 119 | { |
107 | float cover = 0f; | 120 | float cover = 0f; |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 0e6d663..eb06fcc 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -53,6 +53,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
53 | 53 | ||
54 | protected EstateManagementCommands m_commands; | 54 | protected EstateManagementCommands m_commands; |
55 | 55 | ||
56 | /// <summary> | ||
57 | /// If false, region restart requests from the client are blocked even if they are otherwise legitimate. | ||
58 | /// </summary> | ||
59 | public bool AllowRegionRestartFromClient { get; set; } | ||
60 | |||
56 | private EstateTerrainXferHandler TerrainUploader; | 61 | private EstateTerrainXferHandler TerrainUploader; |
57 | public TelehubManager m_Telehub; | 62 | public TelehubManager m_Telehub; |
58 | 63 | ||
@@ -60,6 +65,53 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
60 | public event ChangeDelegate OnEstateInfoChange; | 65 | public event ChangeDelegate OnEstateInfoChange; |
61 | public event MessageDelegate OnEstateMessage; | 66 | public event MessageDelegate OnEstateMessage; |
62 | 67 | ||
68 | #region Region Module interface | ||
69 | |||
70 | public string Name { get { return "EstateManagementModule"; } } | ||
71 | |||
72 | public Type ReplaceableInterface { get { return null; } } | ||
73 | |||
74 | public void Initialise(IConfigSource source) | ||
75 | { | ||
76 | AllowRegionRestartFromClient = true; | ||
77 | |||
78 | IConfig config = source.Configs["EstateManagement"]; | ||
79 | |||
80 | if (config != null) | ||
81 | AllowRegionRestartFromClient = config.GetBoolean("AllowRegionRestartFromClient", true); | ||
82 | } | ||
83 | |||
84 | public void AddRegion(Scene scene) | ||
85 | { | ||
86 | Scene = scene; | ||
87 | Scene.RegisterModuleInterface<IEstateModule>(this); | ||
88 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; | ||
89 | Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; | ||
90 | |||
91 | m_Telehub = new TelehubManager(scene); | ||
92 | |||
93 | m_commands = new EstateManagementCommands(this); | ||
94 | m_commands.Initialise(); | ||
95 | } | ||
96 | |||
97 | public void RemoveRegion(Scene scene) {} | ||
98 | |||
99 | public void RegionLoaded(Scene scene) | ||
100 | { | ||
101 | // Sets up the sun module based no the saved Estate and Region Settings | ||
102 | // DO NOT REMOVE or the sun will stop working | ||
103 | scene.TriggerEstateSunUpdate(); | ||
104 | |||
105 | UserManager = scene.RequestModuleInterface<IUserManagement>(); | ||
106 | } | ||
107 | |||
108 | public void Close() | ||
109 | { | ||
110 | m_commands.Close(); | ||
111 | } | ||
112 | |||
113 | #endregion | ||
114 | |||
63 | #region Packet Data Responders | 115 | #region Packet Data Responders |
64 | 116 | ||
65 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) | 117 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) |
@@ -184,6 +236,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
184 | Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; | 236 | Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; |
185 | break; | 237 | break; |
186 | } | 238 | } |
239 | |||
187 | Scene.RegionInfo.RegionSettings.Save(); | 240 | Scene.RegionInfo.RegionSettings.Save(); |
188 | TriggerRegionInfoChange(); | 241 | TriggerRegionInfoChange(); |
189 | sendRegionInfoPacketToAll(); | 242 | sendRegionInfoPacketToAll(); |
@@ -215,6 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
215 | Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; | 268 | Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; |
216 | break; | 269 | break; |
217 | } | 270 | } |
271 | |||
218 | Scene.RegionInfo.RegionSettings.Save(); | 272 | Scene.RegionInfo.RegionSettings.Save(); |
219 | TriggerRegionInfoChange(); | 273 | TriggerRegionInfoChange(); |
220 | sendRegionHandshakeToAll(); | 274 | sendRegionHandshakeToAll(); |
@@ -255,6 +309,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
255 | 309 | ||
256 | private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) | 310 | private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) |
257 | { | 311 | { |
312 | if (!AllowRegionRestartFromClient) | ||
313 | { | ||
314 | remoteClient.SendAlertMessage("Region restart has been disabled on this simulator."); | ||
315 | return; | ||
316 | } | ||
317 | |||
258 | IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>(); | 318 | IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>(); |
259 | if (restartModule != null) | 319 | if (restartModule != null) |
260 | { | 320 | { |
@@ -271,6 +331,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
271 | } | 331 | } |
272 | 332 | ||
273 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); | 333 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); |
334 | |||
335 | m_log.InfoFormat( | ||
336 | "User {0} requested restart of region {1} in {2} seconds", | ||
337 | remoteClient.Name, Scene.Name, times.Count != 0 ? times[0] : 0); | ||
274 | } | 338 | } |
275 | } | 339 | } |
276 | 340 | ||
@@ -295,7 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
295 | 359 | ||
296 | if ((estateAccessType & 4) != 0) // User add | 360 | if ((estateAccessType & 4) != 0) // User add |
297 | { | 361 | { |
298 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 362 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) |
299 | { | 363 | { |
300 | if ((estateAccessType & 1) != 0) // All estates | 364 | if ((estateAccessType & 1) != 0) // All estates |
301 | { | 365 | { |
@@ -325,9 +389,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
325 | } | 389 | } |
326 | 390 | ||
327 | } | 391 | } |
392 | |||
328 | if ((estateAccessType & 8) != 0) // User remove | 393 | if ((estateAccessType & 8) != 0) // User remove |
329 | { | 394 | { |
330 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 395 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) |
331 | { | 396 | { |
332 | if ((estateAccessType & 1) != 0) // All estates | 397 | if ((estateAccessType & 1) != 0) // All estates |
333 | { | 398 | { |
@@ -356,9 +421,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
356 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | 421 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); |
357 | } | 422 | } |
358 | } | 423 | } |
424 | |||
359 | if ((estateAccessType & 16) != 0) // Group add | 425 | if ((estateAccessType & 16) != 0) // Group add |
360 | { | 426 | { |
361 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 427 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) |
362 | { | 428 | { |
363 | if ((estateAccessType & 1) != 0) // All estates | 429 | if ((estateAccessType & 1) != 0) // All estates |
364 | { | 430 | { |
@@ -387,9 +453,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
387 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | 453 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); |
388 | } | 454 | } |
389 | } | 455 | } |
456 | |||
390 | if ((estateAccessType & 32) != 0) // Group remove | 457 | if ((estateAccessType & 32) != 0) // Group remove |
391 | { | 458 | { |
392 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 459 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) |
393 | { | 460 | { |
394 | if ((estateAccessType & 1) != 0) // All estates | 461 | if ((estateAccessType & 1) != 0) // All estates |
395 | { | 462 | { |
@@ -418,9 +485,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
418 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | 485 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); |
419 | } | 486 | } |
420 | } | 487 | } |
488 | |||
421 | if ((estateAccessType & 64) != 0) // Ban add | 489 | if ((estateAccessType & 64) != 0) // Ban add |
422 | { | 490 | { |
423 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) | 491 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false)) |
424 | { | 492 | { |
425 | EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; | 493 | EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; |
426 | 494 | ||
@@ -495,9 +563,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
495 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | 563 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); |
496 | } | 564 | } |
497 | } | 565 | } |
566 | |||
498 | if ((estateAccessType & 128) != 0) // Ban remove | 567 | if ((estateAccessType & 128) != 0) // Ban remove |
499 | { | 568 | { |
500 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) | 569 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false)) |
501 | { | 570 | { |
502 | EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; | 571 | EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; |
503 | 572 | ||
@@ -550,9 +619,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
550 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | 619 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); |
551 | } | 620 | } |
552 | } | 621 | } |
622 | |||
553 | if ((estateAccessType & 256) != 0) // Manager add | 623 | if ((estateAccessType & 256) != 0) // Manager add |
554 | { | 624 | { |
555 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 625 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) |
556 | { | 626 | { |
557 | if ((estateAccessType & 1) != 0) // All estates | 627 | if ((estateAccessType & 1) != 0) // All estates |
558 | { | 628 | { |
@@ -581,9 +651,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
581 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); | 651 | remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); |
582 | } | 652 | } |
583 | } | 653 | } |
654 | |||
584 | if ((estateAccessType & 512) != 0) // Manager remove | 655 | if ((estateAccessType & 512) != 0) // Manager remove |
585 | { | 656 | { |
586 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 657 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) |
587 | { | 658 | { |
588 | if ((estateAccessType & 1) != 0) // All estates | 659 | if ((estateAccessType & 1) != 0) // All estates |
589 | { | 660 | { |
@@ -614,7 +685,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
614 | } | 685 | } |
615 | } | 686 | } |
616 | 687 | ||
617 | public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) | 688 | public void handleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) |
618 | { | 689 | { |
619 | SceneObjectPart part; | 690 | SceneObjectPart part; |
620 | 691 | ||
@@ -1072,45 +1143,6 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1072 | 1143 | ||
1073 | #endregion | 1144 | #endregion |
1074 | 1145 | ||
1075 | #region IRegionModule Members | ||
1076 | |||
1077 | public string Name { get { return "EstateManagementModule"; } } | ||
1078 | |||
1079 | public Type ReplaceableInterface { get { return null; } } | ||
1080 | |||
1081 | public void Initialise(IConfigSource source) {} | ||
1082 | |||
1083 | public void AddRegion(Scene scene) | ||
1084 | { | ||
1085 | Scene = scene; | ||
1086 | Scene.RegisterModuleInterface<IEstateModule>(this); | ||
1087 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; | ||
1088 | Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; | ||
1089 | |||
1090 | m_Telehub = new TelehubManager(scene); | ||
1091 | |||
1092 | m_commands = new EstateManagementCommands(this); | ||
1093 | m_commands.Initialise(); | ||
1094 | } | ||
1095 | |||
1096 | public void RemoveRegion(Scene scene) {} | ||
1097 | |||
1098 | public void RegionLoaded(Scene scene) | ||
1099 | { | ||
1100 | // Sets up the sun module based no the saved Estate and Region Settings | ||
1101 | // DO NOT REMOVE or the sun will stop working | ||
1102 | scene.TriggerEstateSunUpdate(); | ||
1103 | |||
1104 | UserManager = scene.RequestModuleInterface<IUserManagement>(); | ||
1105 | } | ||
1106 | |||
1107 | public void Close() | ||
1108 | { | ||
1109 | m_commands.Close(); | ||
1110 | } | ||
1111 | |||
1112 | #endregion | ||
1113 | |||
1114 | #region Other Functions | 1146 | #region Other Functions |
1115 | 1147 | ||
1116 | public void changeWaterHeight(float height) | 1148 | public void changeWaterHeight(float height) |
diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs new file mode 100644 index 0000000..bd22155 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs | |||
@@ -0,0 +1,112 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Diagnostics; | ||
32 | using System.Reflection; | ||
33 | using System.Text; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using OpenMetaverse; | ||
37 | using OpenMetaverse.StructuredData; | ||
38 | using OpenMetaverse.Messages.Linden; | ||
39 | using Mono.Addins; | ||
40 | using OpenSim.Framework; | ||
41 | using OpenSim.Framework.Capabilities; | ||
42 | using OpenSim.Framework.Console; | ||
43 | using OpenSim.Framework.Servers; | ||
44 | using OpenSim.Framework.Servers.HttpServer; | ||
45 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | ||
46 | using OpenSim.Region.Framework.Interfaces; | ||
47 | using OpenSim.Region.Framework.Scenes; | ||
48 | using OpenSim.Region.Physics.Manager; | ||
49 | using OpenSim.Services.Interfaces; | ||
50 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
51 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
52 | |||
53 | namespace OpenSim.Region.CoreModules.World.Land | ||
54 | { | ||
55 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DwellModule")] | ||
56 | public class DwellModule : IDwellModule, INonSharedRegionModule | ||
57 | { | ||
58 | private Scene m_scene; | ||
59 | |||
60 | public Type ReplaceableInterface | ||
61 | { | ||
62 | get { return typeof(IDwellModule); } | ||
63 | } | ||
64 | |||
65 | public string Name | ||
66 | { | ||
67 | get { return "DwellModule"; } | ||
68 | } | ||
69 | |||
70 | public void Initialise(IConfigSource source) | ||
71 | { | ||
72 | } | ||
73 | |||
74 | public void AddRegion(Scene scene) | ||
75 | { | ||
76 | m_scene = scene; | ||
77 | |||
78 | m_scene.EventManager.OnNewClient += OnNewClient; | ||
79 | } | ||
80 | |||
81 | public void RegionLoaded(Scene scene) | ||
82 | { | ||
83 | } | ||
84 | |||
85 | public void RemoveRegion(Scene scene) | ||
86 | { | ||
87 | } | ||
88 | |||
89 | public void Close() | ||
90 | { | ||
91 | } | ||
92 | |||
93 | public void OnNewClient(IClientAPI client) | ||
94 | { | ||
95 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; | ||
96 | } | ||
97 | |||
98 | private void ClientOnParcelDwellRequest(int localID, IClientAPI client) | ||
99 | { | ||
100 | ILandObject parcel = m_scene.LandChannel.GetLandObject(localID); | ||
101 | if (parcel == null) | ||
102 | return; | ||
103 | |||
104 | client.SendParcelDwellReply(localID, parcel.LandData.GlobalID, parcel.LandData.Dwell); | ||
105 | } | ||
106 | |||
107 | public int GetDwell(UUID parcelID) | ||
108 | { | ||
109 | return 0; | ||
110 | } | ||
111 | } | ||
112 | } | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 95edf62..7149aad 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -36,6 +36,7 @@ using Nini.Config; | |||
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenMetaverse.StructuredData; | 37 | using OpenMetaverse.StructuredData; |
38 | using OpenMetaverse.Messages.Linden; | 38 | using OpenMetaverse.Messages.Linden; |
39 | using Mono.Addins; | ||
39 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Capabilities; | 41 | using OpenSim.Framework.Capabilities; |
41 | using OpenSim.Framework.Console; | 42 | using OpenSim.Framework.Console; |
@@ -60,6 +61,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
60 | public byte RegionAccess; | 61 | public byte RegionAccess; |
61 | } | 62 | } |
62 | 63 | ||
64 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LandManagementModule")] | ||
63 | public class LandManagementModule : INonSharedRegionModule | 65 | public class LandManagementModule : INonSharedRegionModule |
64 | { | 66 | { |
65 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 67 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -207,7 +209,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
207 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; | 209 | client.OnParcelInfoRequest += ClientOnParcelInfoRequest; |
208 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; | 210 | client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; |
209 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; | 211 | client.OnPreAgentUpdate += ClientOnPreAgentUpdate; |
210 | client.OnParcelDwellRequest += ClientOnParcelDwellRequest; | ||
211 | 212 | ||
212 | EntityBase presenceEntity; | 213 | EntityBase presenceEntity; |
213 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) | 214 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) |
@@ -799,17 +800,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
799 | } | 800 | } |
800 | } | 801 | } |
801 | 802 | ||
802 | private void ClientOnParcelDwellRequest(int localID, IClientAPI client) | ||
803 | { | ||
804 | ILandObject parcel = null; | ||
805 | lock (m_landList) | ||
806 | { | ||
807 | if (!m_landList.TryGetValue(localID, out parcel)) | ||
808 | return; | ||
809 | } | ||
810 | client.SendParcelDwellReply(localID, parcel.LandData.GlobalID, parcel.LandData.Dwell); | ||
811 | } | ||
812 | |||
813 | #endregion | 803 | #endregion |
814 | 804 | ||
815 | #region Parcel Modification | 805 | #region Parcel Modification |
@@ -962,6 +952,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
962 | ILandObject newLand = startLandObject.Copy(); | 952 | ILandObject newLand = startLandObject.Copy(); |
963 | newLand.LandData.Name = newLand.LandData.Name; | 953 | newLand.LandData.Name = newLand.LandData.Name; |
964 | newLand.LandData.GlobalID = UUID.Random(); | 954 | newLand.LandData.GlobalID = UUID.Random(); |
955 | newLand.LandData.Dwell = 0; | ||
965 | 956 | ||
966 | newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y)); | 957 | newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y)); |
967 | 958 | ||
@@ -1387,10 +1378,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1387 | 1378 | ||
1388 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1379 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1389 | { | 1380 | { |
1381 | // m_log.DebugFormat( | ||
1382 | // "[LAND MANAGMENT MODULE]: Processing {0} incoming parcels on {1}", data.Count, m_scene.Name); | ||
1383 | |||
1390 | for (int i = 0; i < data.Count; i++) | 1384 | for (int i = 0; i < data.Count; i++) |
1391 | { | ||
1392 | IncomingLandObjectFromStorage(data[i]); | 1385 | IncomingLandObjectFromStorage(data[i]); |
1393 | } | ||
1394 | } | 1386 | } |
1395 | 1387 | ||
1396 | public void IncomingLandObjectFromStorage(LandData data) | 1388 | public void IncomingLandObjectFromStorage(LandData data) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 8829f27..5969d45 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -727,9 +727,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
727 | int ty = min_y * 4; | 727 | int ty = min_y * 4; |
728 | if (ty > ((int)Constants.RegionSize - 1)) | 728 | if (ty > ((int)Constants.RegionSize - 1)) |
729 | ty = ((int)Constants.RegionSize - 1); | 729 | ty = ((int)Constants.RegionSize - 1); |
730 | |||
730 | LandData.AABBMin = | 731 | LandData.AABBMin = |
731 | new Vector3((float) (min_x * 4), (float) (min_y * 4), | 732 | new Vector3( |
732 | (float) m_scene.Heightmap[tx, ty]); | 733 | (float)(min_x * 4), (float)(min_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); |
733 | 734 | ||
734 | tx = max_x * 4; | 735 | tx = max_x * 4; |
735 | if (tx > ((int)Constants.RegionSize - 1)) | 736 | if (tx > ((int)Constants.RegionSize - 1)) |
@@ -737,9 +738,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
737 | ty = max_y * 4; | 738 | ty = max_y * 4; |
738 | if (ty > ((int)Constants.RegionSize - 1)) | 739 | if (ty > ((int)Constants.RegionSize - 1)) |
739 | ty = ((int)Constants.RegionSize - 1); | 740 | ty = ((int)Constants.RegionSize - 1); |
740 | LandData.AABBMax = | 741 | |
741 | new Vector3((float) (max_x * 4), (float) (max_y * 4), | 742 | LandData.AABBMax |
742 | (float) m_scene.Heightmap[tx, ty]); | 743 | = new Vector3( |
744 | (float)(max_x * 4), (float)(max_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); | ||
745 | |||
743 | LandData.Area = tempArea; | 746 | LandData.Area = tempArea; |
744 | } | 747 | } |
745 | 748 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 665875f..f9cc0cf 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -34,6 +34,7 @@ using log4net; | |||
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using Mono.Addins; | ||
37 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
39 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
@@ -49,6 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
49 | public Dictionary <UUID, int> Users = new Dictionary <UUID, int>(); | 50 | public Dictionary <UUID, int> Users = new Dictionary <UUID, int>(); |
50 | } | 51 | } |
51 | 52 | ||
53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PrimCountModule")] | ||
52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule | 54 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule |
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); |
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index b5ee4d2..14eca42 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | |||
@@ -41,7 +41,7 @@ using OpenSim.Tests.Common.Mock; | |||
41 | namespace OpenSim.Region.CoreModules.World.Land.Tests | 41 | namespace OpenSim.Region.CoreModules.World.Land.Tests |
42 | { | 42 | { |
43 | [TestFixture] | 43 | [TestFixture] |
44 | public class PrimCountModuleTests | 44 | public class PrimCountModuleTests : OpenSimTestCase |
45 | { | 45 | { |
46 | protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); | 46 | protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); |
47 | protected UUID m_groupId = new UUID("00000000-0000-0000-8888-000000000000"); | 47 | protected UUID m_groupId = new UUID("00000000-0000-0000-8888-000000000000"); |
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index aa306c7..8a422b0 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.Drawing; | 30 | using System.Drawing; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Addins; | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenMetaverse.Imaging; | 36 | using OpenMetaverse.Imaging; |
@@ -59,6 +60,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
59 | public face[] trns; | 60 | public face[] trns; |
60 | } | 61 | } |
61 | 62 | ||
63 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageModule")] | ||
62 | public class MapImageModule : IMapImageGenerator, INonSharedRegionModule | 64 | public class MapImageModule : IMapImageGenerator, INonSharedRegionModule |
63 | { | 65 | { |
64 | private static readonly ILog m_log = | 66 | private static readonly ILog m_log = |
@@ -131,7 +133,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
131 | 133 | ||
132 | #endregion | 134 | #endregion |
133 | 135 | ||
134 | #region IRegionModule Members | 136 | #region Region Module interface |
135 | 137 | ||
136 | public void Initialise(IConfigSource source) | 138 | public void Initialise(IConfigSource source) |
137 | { | 139 | { |
diff --git a/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs index 1526886..c3cea7a 100644 --- a/OpenSim/Region/CoreModules/LightShare/EnvironmentModule.cs +++ b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs | |||
@@ -51,10 +51,10 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
51 | private Scene m_scene = null; | 51 | private Scene m_scene = null; |
52 | private UUID regionID = UUID.Zero; | 52 | private UUID regionID = UUID.Zero; |
53 | private static bool Enabled = false; | 53 | private static bool Enabled = false; |
54 | 54 | ||
55 | private static readonly string capsName = "EnvironmentSettings"; | 55 | private static readonly string capsName = "EnvironmentSettings"; |
56 | private static readonly string capsBase = "/CAPS/0020/"; | 56 | private static readonly string capsBase = "/CAPS/0020/"; |
57 | 57 | ||
58 | private LLSDEnvironmentSetResponse setResponse = null; | 58 | private LLSDEnvironmentSetResponse setResponse = null; |
59 | 59 | ||
60 | #region INonSharedRegionModule | 60 | #region INonSharedRegionModule |
@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
72 | } | 72 | } |
73 | 73 | ||
74 | Enabled = true; | 74 | Enabled = true; |
75 | 75 | ||
76 | m_log.InfoFormat("[{0}]: Module is enabled.", Name); | 76 | m_log.InfoFormat("[{0}]: Module is enabled.", Name); |
77 | } | 77 | } |
78 | 78 | ||
@@ -132,8 +132,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
132 | #region Events | 132 | #region Events |
133 | private void OnRegisterCaps(UUID agentID, Caps caps) | 133 | private void OnRegisterCaps(UUID agentID, Caps caps) |
134 | { | 134 | { |
135 | // m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}", | 135 | // m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}", |
136 | // Name, agentID, caps.RegionName); | 136 | // Name, agentID, caps.RegionName); |
137 | 137 | ||
138 | string capsPath = capsBase + UUID.Random(); | 138 | string capsPath = capsBase + UUID.Random(); |
139 | 139 | ||
@@ -163,8 +163,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
163 | private string GetEnvironmentSettings(string request, string path, string param, | 163 | private string GetEnvironmentSettings(string request, string path, string param, |
164 | UUID agentID, Caps caps) | 164 | UUID agentID, Caps caps) |
165 | { | 165 | { |
166 | // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}", | 166 | // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}", |
167 | // Name, agentID, caps.RegionName); | 167 | // Name, agentID, caps.RegionName); |
168 | 168 | ||
169 | string env = String.Empty; | 169 | string env = String.Empty; |
170 | 170 | ||
@@ -188,8 +188,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
188 | UUID agentID, Caps caps) | 188 | UUID agentID, Caps caps) |
189 | { | 189 | { |
190 | 190 | ||
191 | // m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}", | 191 | // m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}", |
192 | // Name, agentID, caps.RegionName); | 192 | // Name, agentID, caps.RegionName); |
193 | 193 | ||
194 | setResponse.regionID = regionID; | 194 | setResponse.regionID = regionID; |
195 | setResponse.success = false; | 195 | setResponse.success = false; |
@@ -204,7 +204,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
204 | { | 204 | { |
205 | m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request); | 205 | m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request); |
206 | setResponse.success = true; | 206 | setResponse.success = true; |
207 | 207 | ||
208 | m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}", | 208 | m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}", |
209 | Name, agentID, caps.RegionName); | 209 | Name, agentID, caps.RegionName); |
210 | } | 210 | } |
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs index 16cbbf5..4e20196 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs | |||
@@ -27,21 +27,20 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
31 | using System.Reflection; | 30 | using System.Reflection; |
32 | using OpenMetaverse; | 31 | using OpenMetaverse; |
33 | using log4net; | ||
34 | using Nini.Config; | ||
35 | using OpenSim.Data; | ||
36 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
37 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | 33 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
38 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
40 | 36 | using log4net; | |
37 | using Nini.Config; | ||
38 | using Mono.Addins; | ||
41 | 39 | ||
42 | namespace OpenSim.Region.CoreModules.World.LightShare | 40 | namespace OpenSim.Region.CoreModules.World.LightShare |
43 | { | 41 | { |
44 | public class LightShareModule : IRegionModule, ICommandableModule | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LightShareModule")] |
43 | public class LightShareModule : INonSharedRegionModule, ILightShareModule, ICommandableModule | ||
45 | { | 44 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | private readonly Commander m_commander = new Commander("windlight"); | 46 | private readonly Commander m_commander = new Commander("windlight"); |
@@ -57,48 +56,86 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
57 | 56 | ||
58 | #endregion | 57 | #endregion |
59 | 58 | ||
60 | #region IRegionModule Members | 59 | #region INonSharedRegionModule Members |
61 | 60 | ||
62 | public static bool EnableWindlight | 61 | public void Initialise(IConfigSource config) |
63 | { | 62 | { |
64 | get | 63 | try |
65 | { | 64 | { |
66 | return m_enableWindlight; | 65 | m_enableWindlight = config.Configs["LightShare"].GetBoolean("enable_windlight", false); |
67 | } | 66 | } |
68 | set | 67 | catch (Exception) |
69 | { | 68 | { |
69 | m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default"); | ||
70 | } | 70 | } |
71 | |||
72 | m_log.DebugFormat("[WINDLIGHT]: windlight module {0}", (m_enableWindlight ? "enabled" : "disabled")); | ||
71 | } | 73 | } |
72 | 74 | ||
73 | public void Initialise(Scene scene, IConfigSource config) | 75 | public void AddRegion(Scene scene) |
74 | { | 76 | { |
77 | if (!m_enableWindlight) | ||
78 | return; | ||
79 | |||
75 | m_scene = scene; | 80 | m_scene = scene; |
76 | m_scene.RegisterModuleInterface<IRegionModule>(this); | 81 | m_scene.RegisterModuleInterface<ILightShareModule>(this); |
77 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | 82 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; |
78 | 83 | ||
79 | // ini file settings | 84 | m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; |
80 | try | 85 | m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; |
81 | { | 86 | m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; |
82 | m_enableWindlight = config.Configs["LightShare"].GetBoolean("enable_windlight", false); | 87 | m_scene.LoadWindlightProfile(); |
83 | } | 88 | |
84 | catch (Exception) | 89 | InstallCommands(); |
90 | } | ||
91 | |||
92 | public void RemoveRegion(Scene scene) | ||
93 | { | ||
94 | if (!m_enableWindlight) | ||
95 | return; | ||
96 | |||
97 | m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; | ||
98 | |||
99 | m_scene.EventManager.OnMakeRootAgent -= EventManager_OnMakeRootAgent; | ||
100 | m_scene.EventManager.OnSaveNewWindlightProfile -= EventManager_OnSaveNewWindlightProfile; | ||
101 | m_scene.EventManager.OnSendNewWindlightProfileTargeted -= EventManager_OnSendNewWindlightProfileTargeted; | ||
102 | |||
103 | m_scene = null; | ||
104 | } | ||
105 | |||
106 | public void Close() | ||
107 | { | ||
108 | } | ||
109 | |||
110 | public string Name | ||
111 | { | ||
112 | get { return "LightShareModule"; } | ||
113 | } | ||
114 | |||
115 | public void RegionLoaded(Scene scene) | ||
116 | { | ||
117 | } | ||
118 | |||
119 | public Type ReplaceableInterface | ||
120 | { | ||
121 | get { return null; } | ||
122 | } | ||
123 | |||
124 | #endregion | ||
125 | |||
126 | public static bool EnableWindlight | ||
127 | { | ||
128 | get | ||
85 | { | 129 | { |
86 | m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default"); | 130 | return m_enableWindlight; |
87 | } | 131 | } |
88 | 132 | set | |
89 | if (m_enableWindlight) | ||
90 | { | 133 | { |
91 | m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; | ||
92 | m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; | ||
93 | m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; | ||
94 | m_scene.LoadWindlightProfile(); | ||
95 | } | 134 | } |
96 | |||
97 | InstallCommands(); | ||
98 | |||
99 | m_log.Debug("[WINDLIGHT]: Initialised windlight module"); | ||
100 | } | 135 | } |
101 | 136 | ||
137 | #region events | ||
138 | |||
102 | private List<byte[]> compileWindlightSettings(RegionLightShareData wl) | 139 | private List<byte[]> compileWindlightSettings(RegionLightShareData wl) |
103 | { | 140 | { |
104 | byte[] mBlock = new Byte[249]; | 141 | byte[] mBlock = new Byte[249]; |
@@ -186,29 +223,6 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
186 | m_scene.ForEachRootClient(SendProfileToClient); | 223 | m_scene.ForEachRootClient(SendProfileToClient); |
187 | } | 224 | } |
188 | 225 | ||
189 | public void PostInitialise() | ||
190 | { | ||
191 | |||
192 | } | ||
193 | |||
194 | public void Close() | ||
195 | { | ||
196 | } | ||
197 | |||
198 | public string Name | ||
199 | { | ||
200 | get { return "LightShareModule"; } | ||
201 | } | ||
202 | |||
203 | public bool IsSharedModule | ||
204 | { | ||
205 | get { return false; } | ||
206 | } | ||
207 | |||
208 | #endregion | ||
209 | |||
210 | #region events | ||
211 | |||
212 | #endregion | 226 | #endregion |
213 | 227 | ||
214 | #region ICommandableModule Members | 228 | #region ICommandableModule Members |
@@ -243,7 +257,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
243 | private void HandleDisable(Object[] args) | 257 | private void HandleDisable(Object[] args) |
244 | { | 258 | { |
245 | m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled"); | 259 | m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled"); |
246 | m_enableWindlight=false; | 260 | m_enableWindlight = false; |
247 | } | 261 | } |
248 | 262 | ||
249 | private void HandleEnable(Object[] args) | 263 | private void HandleEnable(Object[] args) |
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index 396095a..ba4b041 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs | |||
@@ -44,7 +44,7 @@ using OpenSim.Tests.Common.Mock; | |||
44 | namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests | 44 | namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests |
45 | { | 45 | { |
46 | [TestFixture] | 46 | [TestFixture] |
47 | public class MoapTests | 47 | public class MoapTests : OpenSimTestCase |
48 | { | 48 | { |
49 | protected TestScene m_scene; | 49 | protected TestScene m_scene; |
50 | protected MoapModule m_module; | 50 | protected MoapModule m_module; |
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 87241e1..ab8f143 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | |||
@@ -27,10 +27,12 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
30 | using System.Linq; | 31 | using System.Linq; |
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Text; | 33 | using System.Text; |
33 | using System.Text.RegularExpressions; | 34 | using System.Text.RegularExpressions; |
35 | using System.Xml; | ||
34 | using log4net; | 36 | using log4net; |
35 | using Mono.Addins; | 37 | using Mono.Addins; |
36 | using NDesk.Options; | 38 | using NDesk.Options; |
@@ -41,6 +43,7 @@ using OpenSim.Framework.Console; | |||
41 | using OpenSim.Framework.Monitoring; | 43 | using OpenSim.Framework.Monitoring; |
42 | using OpenSim.Region.Framework.Interfaces; | 44 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.Framework.Scenes; | 45 | using OpenSim.Region.Framework.Scenes; |
46 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
44 | 47 | ||
45 | namespace OpenSim.Region.CoreModules.World.Objects.Commands | 48 | namespace OpenSim.Region.CoreModules.World.Objects.Commands |
46 | { | 49 | { |
@@ -96,9 +99,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
96 | HandleDeleteObject); | 99 | HandleDeleteObject); |
97 | 100 | ||
98 | m_console.Commands.AddCommand( | 101 | m_console.Commands.AddCommand( |
99 | "Objects", false, "delete object uuid", | 102 | "Objects", false, "delete object id", |
100 | "delete object uuid <UUID>", | 103 | "delete object id <UUID-or-localID>", |
101 | "Delete a scene object by uuid", | 104 | "Delete a scene object by uuid or localID", |
102 | HandleDeleteObject); | 105 | HandleDeleteObject); |
103 | 106 | ||
104 | m_console.Commands.AddCommand( | 107 | m_console.Commands.AddCommand( |
@@ -122,28 +125,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
122 | "delete object pos", | 125 | "delete object pos", |
123 | "delete object pos <start-coord> to <end-coord>", | 126 | "delete object pos <start-coord> to <end-coord>", |
124 | "Delete scene objects within the given area.", | 127 | "Delete scene objects within the given area.", |
125 | "Each component of the coord is comma separated. There must be no spaces between the commas.\n" | 128 | ConsoleUtil.CoordHelp, |
126 | + "If you don't care about the z component you can simply omit it.\n" | ||
127 | + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n" | ||
128 | + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" | ||
129 | + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n" | ||
130 | + "e.g.\n" | ||
131 | + "delete object pos 20,20,20 to 40,40,40\n" | ||
132 | + "delete object pos 20,20 to 40,40\n" | ||
133 | + "delete object pos ,20,20 to ,40,40\n" | ||
134 | + "delete object pos ,,30 to ,,~\n" | ||
135 | + "delete object pos ,,-~ to ,,30", | ||
136 | HandleDeleteObject); | 129 | HandleDeleteObject); |
137 | 130 | ||
138 | m_console.Commands.AddCommand( | 131 | m_console.Commands.AddCommand( |
139 | "Objects", | 132 | "Objects", |
140 | false, | 133 | false, |
141 | "show object uuid", | 134 | "show object id", |
142 | "show object uuid [--full] <UUID>", | 135 | "show object id [--full] <UUID-or-localID>", |
143 | "Show details of a scene object with the given UUID", | 136 | "Show details of a scene object with the given UUID or localID", |
144 | "The --full option will print out information on all the parts of the object.\n" | 137 | "The --full option will print out information on all the parts of the object.\n" |
145 | + "For yet more detailed part information, use the \"show part\" commands.", | 138 | + "For yet more detailed part information, use the \"show part\" commands.", |
146 | HandleShowObjectByUuid); | 139 | HandleShowObjectById); |
147 | 140 | ||
148 | m_console.Commands.AddCommand( | 141 | m_console.Commands.AddCommand( |
149 | "Objects", | 142 | "Objects", |
@@ -164,25 +157,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
164 | "Show details of scene objects within the given area.", | 157 | "Show details of scene objects within the given area.", |
165 | "The --full option will print out information on all the parts of the object.\n" | 158 | "The --full option will print out information on all the parts of the object.\n" |
166 | + "For yet more detailed part information, use the \"show part\" commands.\n" | 159 | + "For yet more detailed part information, use the \"show part\" commands.\n" |
167 | + "Each component of the coord is comma separated. There must be no spaces between the commas.\n" | 160 | + ConsoleUtil.CoordHelp, |
168 | + "If you don't care about the z component you can simply omit it.\n" | ||
169 | + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n" | ||
170 | + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" | ||
171 | + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n" | ||
172 | + "e.g.\n" | ||
173 | + "show object pos 20,20,20 to 40,40,40\n" | ||
174 | + "show object pos 20,20 to 40,40\n" | ||
175 | + "show object pos ,20,20 to ,40,40\n" | ||
176 | + "show object pos ,,30 to ,,~\n" | ||
177 | + "show object pos ,,-~ to ,,30", | ||
178 | HandleShowObjectByPos); | 161 | HandleShowObjectByPos); |
179 | 162 | ||
180 | m_console.Commands.AddCommand( | 163 | m_console.Commands.AddCommand( |
181 | "Objects", | 164 | "Objects", |
182 | false, | 165 | false, |
183 | "show part uuid", | 166 | "show part id", |
184 | "show part uuid <UUID>", | 167 | "show part id <UUID-or-localID>", |
185 | "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); | 168 | "Show details of a scene object part with the given UUID or localID", HandleShowPartById); |
186 | 169 | ||
187 | m_console.Commands.AddCommand( | 170 | m_console.Commands.AddCommand( |
188 | "Objects", | 171 | "Objects", |
@@ -190,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
190 | "show part name", | 173 | "show part name", |
191 | "show part name [--regex] <name>", | 174 | "show part name [--regex] <name>", |
192 | "Show details of scene object parts with the given name.", | 175 | "Show details of scene object parts with the given name.", |
193 | "If --regex is specified then the name is treatead as a regular expression", | 176 | "If --regex is specified then the name is treated as a regular expression", |
194 | HandleShowPartByName); | 177 | HandleShowPartByName); |
195 | 178 | ||
196 | m_console.Commands.AddCommand( | 179 | m_console.Commands.AddCommand( |
@@ -199,18 +182,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
199 | "show part pos", | 182 | "show part pos", |
200 | "show part pos <start-coord> to <end-coord>", | 183 | "show part pos <start-coord> to <end-coord>", |
201 | "Show details of scene object parts within the given area.", | 184 | "Show details of scene object parts within the given area.", |
202 | "Each component of the coord is comma separated. There must be no spaces between the commas.\n" | 185 | ConsoleUtil.CoordHelp, |
203 | + "If you don't care about the z component you can simply omit it.\n" | ||
204 | + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n" | ||
205 | + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n" | ||
206 | + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n" | ||
207 | + "e.g.\n" | ||
208 | + "show object pos 20,20,20 to 40,40,40\n" | ||
209 | + "show object pos 20,20 to 40,40\n" | ||
210 | + "show object pos ,20,20 to ,40,40\n" | ||
211 | + "show object pos ,,30 to ,,~\n" | ||
212 | + "show object pos ,,-~ to ,,30", | ||
213 | HandleShowPartByPos); | 186 | HandleShowPartByPos); |
187 | |||
188 | m_console.Commands.AddCommand( | ||
189 | "Objects", | ||
190 | false, | ||
191 | "dump object id", | ||
192 | "dump object id <UUID-or-localID>", | ||
193 | "Dump the formatted serialization of the given object to the file <UUID>.xml", | ||
194 | "e.g. dump object uuid c1ed6809-cc24-4061-a4c2-93082a2d1f1d will dump serialization to c1ed6809-cc24-4061-a4c2-93082a2d1f1d.xml\n" | ||
195 | + "To locate the UUID or localID in the first place, you need to use the other show object commands.\n" | ||
196 | + "If a local ID is given then the filename used is still that for the UUID", | ||
197 | HandleDumpObjectById); | ||
214 | } | 198 | } |
215 | 199 | ||
216 | public void RemoveRegion(Scene scene) | 200 | public void RemoveRegion(Scene scene) |
@@ -265,7 +249,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
265 | m_console.OutputFormat(sb.ToString()); | 249 | m_console.OutputFormat(sb.ToString()); |
266 | } | 250 | } |
267 | 251 | ||
268 | private void HandleShowObjectByUuid(string module, string[] cmdparams) | 252 | private void HandleShowObjectById(string module, string[] cmdparams) |
269 | { | 253 | { |
270 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 254 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
271 | return; | 255 | return; |
@@ -281,14 +265,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
281 | return; | 265 | return; |
282 | } | 266 | } |
283 | 267 | ||
284 | UUID objectUuid; | 268 | UUID uuid; |
285 | if (!UUID.TryParse(mainParams[3], out objectUuid)) | 269 | uint localId; |
286 | { | 270 | if (!ConsoleUtil.TryParseConsoleId(m_console, mainParams[3], out uuid, out localId)) |
287 | m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]); | ||
288 | return; | 271 | return; |
289 | } | ||
290 | 272 | ||
291 | SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid); | 273 | SceneObjectGroup so; |
274 | |||
275 | if (localId != ConsoleUtil.LocalIdNotFound) | ||
276 | so = m_scene.GetSceneObjectGroup(localId); | ||
277 | else | ||
278 | so = m_scene.GetSceneObjectGroup(uuid); | ||
292 | 279 | ||
293 | if (so == null) | 280 | if (so == null) |
294 | { | 281 | { |
@@ -365,7 +352,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
365 | OutputSogsToConsole(searchPredicate, showFull); | 352 | OutputSogsToConsole(searchPredicate, showFull); |
366 | } | 353 | } |
367 | 354 | ||
368 | private void HandleShowPartByUuid(string module, string[] cmdparams) | 355 | private void HandleShowPartById(string module, string[] cmdparams) |
369 | { | 356 | { |
370 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | 357 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) |
371 | return; | 358 | return; |
@@ -378,18 +365,20 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
378 | 365 | ||
379 | if (mainParams.Count < 4) | 366 | if (mainParams.Count < 4) |
380 | { | 367 | { |
381 | m_console.OutputFormat("Usage: show part uuid [--full] <uuid>"); | 368 | m_console.OutputFormat("Usage: show part id [--full] <UUID-or-localID>"); |
382 | return; | 369 | return; |
383 | } | 370 | } |
384 | 371 | ||
385 | UUID objectUuid; | 372 | UUID objectUuid; |
386 | if (!UUID.TryParse(mainParams[3], out objectUuid)) | 373 | uint localId; |
387 | { | 374 | if (!ConsoleUtil.TryParseConsoleId(m_console, mainParams[3], out objectUuid, out localId)) |
388 | m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]); | ||
389 | return; | 375 | return; |
390 | } | ||
391 | 376 | ||
392 | SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); | 377 | SceneObjectPart sop; |
378 | if (localId == ConsoleUtil.LocalIdNotFound) | ||
379 | sop = m_scene.GetSceneObjectPart(objectUuid); | ||
380 | else | ||
381 | sop = m_scene.GetSceneObjectPart(localId); | ||
393 | 382 | ||
394 | if (sop == null) | 383 | if (sop == null) |
395 | { | 384 | { |
@@ -477,6 +466,51 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
477 | OutputSopsToConsole(searchPredicate, true); | 466 | OutputSopsToConsole(searchPredicate, true); |
478 | } | 467 | } |
479 | 468 | ||
469 | private void HandleDumpObjectById(string module, string[] cmdparams) | ||
470 | { | ||
471 | if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) | ||
472 | return; | ||
473 | |||
474 | if (cmdparams.Length < 4) | ||
475 | { | ||
476 | m_console.OutputFormat("Usage: dump object id <UUID-or-localID>"); | ||
477 | return; | ||
478 | } | ||
479 | |||
480 | UUID objectUuid; | ||
481 | uint localId; | ||
482 | if (!ConsoleUtil.TryParseConsoleId(m_console, cmdparams[3], out objectUuid, out localId)) | ||
483 | return; | ||
484 | |||
485 | SceneObjectGroup so; | ||
486 | if (localId == ConsoleUtil.LocalIdNotFound) | ||
487 | so = m_scene.GetSceneObjectGroup(objectUuid); | ||
488 | else | ||
489 | so = m_scene.GetSceneObjectGroup(localId); | ||
490 | |||
491 | if (so == null) | ||
492 | { | ||
493 | // m_console.OutputFormat("No part found with uuid {0}", objectUuid); | ||
494 | return; | ||
495 | } | ||
496 | |||
497 | // In case we found it via local ID. | ||
498 | objectUuid = so.UUID; | ||
499 | |||
500 | string fileName = string.Format("{0}.xml", objectUuid); | ||
501 | |||
502 | if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName)) | ||
503 | return; | ||
504 | |||
505 | using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8)) | ||
506 | { | ||
507 | xtw.Formatting = Formatting.Indented; | ||
508 | SceneObjectSerializer.ToOriginalXmlFormat(so, xtw, true); | ||
509 | } | ||
510 | |||
511 | m_console.OutputFormat("Object dumped to file {0}", fileName); | ||
512 | } | ||
513 | |||
480 | /// <summary> | 514 | /// <summary> |
481 | /// Append a scene object report to an input StringBuilder | 515 | /// Append a scene object report to an input StringBuilder |
482 | /// </summary> | 516 | /// </summary> |
@@ -572,12 +606,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
572 | cdt.AddColumn("Asset UUID", 36); | 606 | cdt.AddColumn("Asset UUID", 36); |
573 | 607 | ||
574 | foreach (TaskInventoryItem item in inv.GetInventoryItems()) | 608 | foreach (TaskInventoryItem item in inv.GetInventoryItems()) |
609 | { | ||
610 | bool foundScriptInstance, scriptRunning; | ||
611 | foundScriptInstance | ||
612 | = SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, item, out scriptRunning); | ||
613 | |||
575 | cdt.AddRow( | 614 | cdt.AddRow( |
576 | item.Name, | 615 | item.Name, |
577 | ((InventoryType)item.InvType).ToString(), | 616 | ((InventoryType)item.InvType).ToString(), |
578 | (InventoryType)item.InvType == InventoryType.LSL ? item.ScriptRunning.ToString() : "n/a", | 617 | foundScriptInstance ? scriptRunning.ToString() : "n/a", |
579 | item.ItemID.ToString(), | 618 | item.ItemID.ToString(), |
580 | item.AssetID.ToString()); | 619 | item.AssetID.ToString()); |
620 | } | ||
581 | 621 | ||
582 | return sb.Append(cdt.ToString()); | 622 | return sb.Append(cdt.ToString()); |
583 | } | 623 | } |
@@ -641,19 +681,24 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands | |||
641 | 681 | ||
642 | break; | 682 | break; |
643 | 683 | ||
644 | case "uuid": | 684 | case "id": |
645 | if (!UUID.TryParse(o, out match)) | 685 | UUID uuid; |
686 | uint localId; | ||
687 | if (!ConsoleUtil.TryParseConsoleId(m_console, o, out uuid, out localId)) | ||
646 | return; | 688 | return; |
647 | 689 | ||
648 | requireConfirmation = false; | 690 | requireConfirmation = false; |
649 | deletes = new List<SceneObjectGroup>(); | 691 | deletes = new List<SceneObjectGroup>(); |
650 | 692 | ||
651 | m_scene.ForEachSOG(delegate (SceneObjectGroup g) | 693 | SceneObjectGroup so; |
652 | { | 694 | if (localId == ConsoleUtil.LocalIdNotFound) |
653 | if (g.UUID == match && !g.IsAttachment) | 695 | so = m_scene.GetSceneObjectGroup(uuid); |
654 | deletes.Add(g); | 696 | else |
655 | }); | 697 | so = m_scene.GetSceneObjectGroup(localId); |
656 | 698 | ||
699 | if (!so.IsAttachment) | ||
700 | deletes.Add(so); | ||
701 | |||
657 | // if (deletes.Count == 0) | 702 | // if (deletes.Count == 0) |
658 | // m_console.OutputFormat("No objects were found with uuid {0}", match); | 703 | // m_console.OutputFormat("No objects were found with uuid {0}", match); |
659 | 704 | ||
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 7a8a57c..ddaa227 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -37,13 +37,17 @@ using OpenSim.Region.Framework.Interfaces; | |||
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
39 | 39 | ||
40 | using Mono.Addins; | ||
41 | |||
40 | namespace OpenSim.Region.CoreModules.World.Permissions | 42 | namespace OpenSim.Region.CoreModules.World.Permissions |
41 | { | 43 | { |
42 | public class PermissionsModule : IRegionModule, IPermissionsModule | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PermissionsModule")] |
45 | public class PermissionsModule : INonSharedRegionModule, IPermissionsModule | ||
43 | { | 46 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 48 | ||
46 | protected Scene m_scene; | 49 | protected Scene m_scene; |
50 | protected bool m_Enabled; | ||
47 | 51 | ||
48 | private InventoryFolderImpl m_libraryRootFolder; | 52 | private InventoryFolderImpl m_libraryRootFolder; |
49 | protected InventoryFolderImpl LibraryRootFolder | 53 | protected InventoryFolderImpl LibraryRootFolder |
@@ -114,18 +118,44 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
114 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); | 118 | private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); |
115 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); | 119 | private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); |
116 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); | 120 | private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); |
121 | |||
117 | private IFriendsModule m_friendsModule; | 122 | private IFriendsModule m_friendsModule; |
123 | private IFriendsModule FriendsModule | ||
124 | { | ||
125 | get | ||
126 | { | ||
127 | if (m_friendsModule == null) | ||
128 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | ||
129 | return m_friendsModule; | ||
130 | } | ||
131 | } | ||
118 | private IGroupsModule m_groupsModule; | 132 | private IGroupsModule m_groupsModule; |
119 | private IMoapModule m_moapModule; | 133 | private IGroupsModule GroupsModule |
134 | { | ||
135 | get | ||
136 | { | ||
137 | if (m_groupsModule == null) | ||
138 | m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
139 | return m_groupsModule; | ||
140 | } | ||
141 | } | ||
120 | 142 | ||
143 | private IMoapModule m_moapModule; | ||
144 | private IMoapModule MoapModule | ||
145 | { | ||
146 | get | ||
147 | { | ||
148 | if (m_moapModule == null) | ||
149 | m_moapModule = m_scene.RequestModuleInterface<IMoapModule>(); | ||
150 | return m_moapModule; | ||
151 | } | ||
152 | } | ||
121 | #endregion | 153 | #endregion |
122 | 154 | ||
123 | #region IRegionModule Members | 155 | #region INonSharedRegionModule Members |
124 | 156 | ||
125 | public void Initialise(Scene scene, IConfigSource config) | 157 | public void Initialise(IConfigSource config) |
126 | { | 158 | { |
127 | m_scene = scene; | ||
128 | |||
129 | IConfig myConfig = config.Configs["Startup"]; | 159 | IConfig myConfig = config.Configs["Startup"]; |
130 | 160 | ||
131 | string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); | 161 | string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); |
@@ -135,6 +165,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
135 | if (!modules.Contains("DefaultPermissionsModule")) | 165 | if (!modules.Contains("DefaultPermissionsModule")) |
136 | return; | 166 | return; |
137 | 167 | ||
168 | m_Enabled = true; | ||
169 | |||
138 | m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false); | 170 | m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false); |
139 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); | 171 | m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); |
140 | m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); | 172 | m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); |
@@ -144,7 +176,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
144 | 176 | ||
145 | m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); | 177 | m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); |
146 | 178 | ||
147 | m_allowedScriptCreators | 179 | m_allowedScriptCreators |
148 | = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); | 180 | = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); |
149 | m_allowedScriptEditors | 181 | m_allowedScriptEditors |
150 | = ParseUserSetConfigSetting(myConfig, "allowed_script_editors", m_allowedScriptEditors); | 182 | = ParseUserSetConfigSetting(myConfig, "allowed_script_editors", m_allowedScriptEditors); |
@@ -154,6 +186,64 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
154 | else | 186 | else |
155 | m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); | 187 | m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); |
156 | 188 | ||
189 | string grant = myConfig.GetString("GrantLSL", ""); | ||
190 | if (grant.Length > 0) | ||
191 | { | ||
192 | foreach (string uuidl in grant.Split(',')) | ||
193 | { | ||
194 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
195 | GrantLSL.Add(uuid, true); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | grant = myConfig.GetString("GrantCS", ""); | ||
200 | if (grant.Length > 0) | ||
201 | { | ||
202 | foreach (string uuidl in grant.Split(',')) | ||
203 | { | ||
204 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
205 | GrantCS.Add(uuid, true); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | grant = myConfig.GetString("GrantVB", ""); | ||
210 | if (grant.Length > 0) | ||
211 | { | ||
212 | foreach (string uuidl in grant.Split(',')) | ||
213 | { | ||
214 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
215 | GrantVB.Add(uuid, true); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | grant = myConfig.GetString("GrantJS", ""); | ||
220 | if (grant.Length > 0) | ||
221 | { | ||
222 | foreach (string uuidl in grant.Split(',')) | ||
223 | { | ||
224 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
225 | GrantJS.Add(uuid, true); | ||
226 | } | ||
227 | } | ||
228 | |||
229 | grant = myConfig.GetString("GrantYP", ""); | ||
230 | if (grant.Length > 0) | ||
231 | { | ||
232 | foreach (string uuidl in grant.Split(',')) | ||
233 | { | ||
234 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
235 | GrantYP.Add(uuid, true); | ||
236 | } | ||
237 | } | ||
238 | } | ||
239 | |||
240 | public void AddRegion(Scene scene) | ||
241 | { | ||
242 | if (!m_Enabled) | ||
243 | return; | ||
244 | |||
245 | m_scene = scene; | ||
246 | |||
157 | scene.RegisterModuleInterface<IPermissionsModule>(this); | 247 | scene.RegisterModuleInterface<IPermissionsModule>(this); |
158 | 248 | ||
159 | //Register functions with Scene External Checks! | 249 | //Register functions with Scene External Checks! |
@@ -169,44 +259,44 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
169 | m_scene.Permissions.OnIsGridGod += IsGridGod; | 259 | m_scene.Permissions.OnIsGridGod += IsGridGod; |
170 | m_scene.Permissions.OnIsAdministrator += IsAdministrator; | 260 | m_scene.Permissions.OnIsAdministrator += IsAdministrator; |
171 | m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; | 261 | m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; |
172 | m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED | 262 | m_scene.Permissions.OnDeleteObject += CanDeleteObject; |
173 | m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED | 263 | m_scene.Permissions.OnEditObject += CanEditObject; |
174 | m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED | 264 | m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; |
175 | m_scene.Permissions.OnInstantMessage += CanInstantMessage; | 265 | m_scene.Permissions.OnInstantMessage += CanInstantMessage; |
176 | m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED | 266 | m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; |
177 | m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED | 267 | m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; |
178 | m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED | 268 | m_scene.Permissions.OnMoveObject += CanMoveObject; |
179 | m_scene.Permissions.OnObjectEntry += CanObjectEntry; | 269 | m_scene.Permissions.OnObjectEntry += CanObjectEntry; |
180 | m_scene.Permissions.OnReturnObjects += CanReturnObjects; //NOT YET IMPLEMENTED | 270 | m_scene.Permissions.OnReturnObjects += CanReturnObjects; |
181 | m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED | 271 | m_scene.Permissions.OnRezObject += CanRezObject; |
182 | m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; | 272 | m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; |
183 | m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED | 273 | m_scene.Permissions.OnRunScript += CanRunScript; |
184 | m_scene.Permissions.OnCompileScript += CanCompileScript; | 274 | m_scene.Permissions.OnCompileScript += CanCompileScript; |
185 | m_scene.Permissions.OnSellParcel += CanSellParcel; | 275 | m_scene.Permissions.OnSellParcel += CanSellParcel; |
186 | m_scene.Permissions.OnTakeObject += CanTakeObject; | 276 | m_scene.Permissions.OnTakeObject += CanTakeObject; |
187 | m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; | 277 | m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; |
188 | m_scene.Permissions.OnTerraformLand += CanTerraformLand; | 278 | m_scene.Permissions.OnTerraformLand += CanTerraformLand; |
189 | m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED | 279 | m_scene.Permissions.OnLinkObject += CanLinkObject; |
190 | m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED | 280 | m_scene.Permissions.OnDelinkObject += CanDelinkObject; |
191 | m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED | 281 | m_scene.Permissions.OnBuyLand += CanBuyLand; |
192 | 282 | ||
193 | m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED | 283 | m_scene.Permissions.OnViewNotecard += CanViewNotecard; |
194 | m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED | 284 | m_scene.Permissions.OnViewScript += CanViewScript; |
195 | m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED | 285 | m_scene.Permissions.OnEditNotecard += CanEditNotecard; |
196 | m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED | 286 | m_scene.Permissions.OnEditScript += CanEditScript; |
197 | 287 | ||
198 | m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; | 288 | m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; |
199 | m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED | 289 | m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory; |
200 | m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED | 290 | m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; |
201 | m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED | 291 | m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; |
202 | m_scene.Permissions.OnResetScript += CanResetScript; | 292 | m_scene.Permissions.OnResetScript += CanResetScript; |
203 | 293 | ||
204 | m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED | 294 | m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; |
205 | m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED | 295 | m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; |
206 | m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED | 296 | m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; |
207 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED | 297 | m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; |
208 | 298 | ||
209 | m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED | 299 | m_scene.Permissions.OnTeleport += CanTeleport; |
210 | 300 | ||
211 | m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; | 301 | m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; |
212 | m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; | 302 | m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; |
@@ -226,52 +316,38 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
226 | "Turn on permissions debugging", | 316 | "Turn on permissions debugging", |
227 | HandleDebugPermissions); | 317 | HandleDebugPermissions); |
228 | 318 | ||
229 | string grant = myConfig.GetString("GrantLSL",""); | 319 | } |
230 | if (grant.Length > 0) { | ||
231 | foreach (string uuidl in grant.Split(',')) { | ||
232 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
233 | GrantLSL.Add(uuid, true); | ||
234 | } | ||
235 | } | ||
236 | 320 | ||
237 | grant = myConfig.GetString("GrantCS",""); | 321 | public void RegionLoaded(Scene scene) |
238 | if (grant.Length > 0) { | 322 | { |
239 | foreach (string uuidl in grant.Split(',')) { | 323 | } |
240 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
241 | GrantCS.Add(uuid, true); | ||
242 | } | ||
243 | } | ||
244 | 324 | ||
245 | grant = myConfig.GetString("GrantVB",""); | 325 | public void RemoveRegion(Scene scene) |
246 | if (grant.Length > 0) { | 326 | { |
247 | foreach (string uuidl in grant.Split(',')) { | 327 | if (!m_Enabled) |
248 | string uuid = uuidl.Trim(" \t".ToCharArray()); | 328 | return; |
249 | GrantVB.Add(uuid, true); | ||
250 | } | ||
251 | } | ||
252 | 329 | ||
253 | grant = myConfig.GetString("GrantJS", ""); | 330 | m_scene.UnregisterModuleInterface<IPermissionsModule>(this); |
254 | if (grant.Length > 0) | 331 | } |
255 | { | ||
256 | foreach (string uuidl in grant.Split(',')) | ||
257 | { | ||
258 | string uuid = uuidl.Trim(" \t".ToCharArray()); | ||
259 | GrantJS.Add(uuid, true); | ||
260 | } | ||
261 | } | ||
262 | 332 | ||
263 | grant = myConfig.GetString("GrantYP", ""); | 333 | public void Close() |
264 | if (grant.Length > 0) | 334 | { |
265 | { | 335 | } |
266 | foreach (string uuidl in grant.Split(',')) | 336 | |
267 | { | 337 | public string Name |
268 | string uuid = uuidl.Trim(" \t".ToCharArray()); | 338 | { |
269 | GrantYP.Add(uuid, true); | 339 | get { return "PermissionsModule"; } |
270 | } | 340 | } |
271 | } | ||
272 | 341 | ||
342 | public Type ReplaceableInterface | ||
343 | { | ||
344 | get { return null; } | ||
273 | } | 345 | } |
274 | 346 | ||
347 | #endregion | ||
348 | |||
349 | #region Console command handlers | ||
350 | |||
275 | public void HandleBypassPermissions(string module, string[] args) | 351 | public void HandleBypassPermissions(string module, string[] args) |
276 | { | 352 | { |
277 | if (m_scene.ConsoleScene() != null && | 353 | if (m_scene.ConsoleScene() != null && |
@@ -290,7 +366,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
290 | m_bypassPermissions = val; | 366 | m_bypassPermissions = val; |
291 | 367 | ||
292 | m_log.InfoFormat( | 368 | m_log.InfoFormat( |
293 | "[PERMISSIONS]: Set permissions bypass to {0} for {1}", | 369 | "[PERMISSIONS]: Set permissions bypass to {0} for {1}", |
294 | m_bypassPermissions, m_scene.RegionInfo.RegionName); | 370 | m_bypassPermissions, m_scene.RegionInfo.RegionName); |
295 | } | 371 | } |
296 | } | 372 | } |
@@ -343,39 +419,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
343 | } | 419 | } |
344 | } | 420 | } |
345 | 421 | ||
346 | public void PostInitialise() | ||
347 | { | ||
348 | m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); | ||
349 | |||
350 | if (m_friendsModule == null) | ||
351 | m_log.Debug("[PERMISSIONS]: Friends module not found, friend permissions will not work"); | ||
352 | |||
353 | m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
354 | |||
355 | if (m_groupsModule == null) | ||
356 | m_log.Debug("[PERMISSIONS]: Groups module not found, group permissions will not work"); | ||
357 | |||
358 | m_moapModule = m_scene.RequestModuleInterface<IMoapModule>(); | ||
359 | |||
360 | // This log line will be commented out when no longer required for debugging | ||
361 | // if (m_moapModule == null) | ||
362 | // m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); | ||
363 | } | ||
364 | |||
365 | public void Close() | ||
366 | { | ||
367 | } | ||
368 | |||
369 | public string Name | ||
370 | { | ||
371 | get { return "PermissionsModule"; } | ||
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/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index fea4de0..249a40d 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Linq; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using System.Timers; | 31 | using System.Timers; |
31 | using System.Threading; | 32 | using System.Threading; |
@@ -264,7 +265,10 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
264 | for (int i = 4 ; i < args.Length ; i++) | 265 | for (int i = 4 ; i < args.Length ; i++) |
265 | times.Add(Convert.ToInt32(args[i])); | 266 | times.Add(Convert.ToInt32(args[i])); |
266 | 267 | ||
268 | MainConsole.Instance.OutputFormat( | ||
269 | "Region {0} scheduled for restart in {1} seconds", m_Scene.Name, times.Sum()); | ||
270 | |||
267 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); | 271 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); |
268 | } | 272 | } |
269 | } | 273 | } |
270 | } | 274 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index 0e861a1..e0247d9 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs | |||
@@ -32,6 +32,7 @@ using System.Reflection; | |||
32 | 32 | ||
33 | using log4net; | 33 | using log4net; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using Mono.Addins; | ||
35 | 36 | ||
36 | using OpenMetaverse; | 37 | using OpenMetaverse; |
37 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | 38 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
@@ -41,6 +42,7 @@ using OpenSim.Region.Framework.Scenes.Serialization; | |||
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.World.Serialiser | 43 | namespace OpenSim.Region.CoreModules.World.Serialiser |
43 | { | 44 | { |
45 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SerialiserModule")] | ||
44 | public class SerialiserModule : ISharedRegionModule, IRegionSerialiserModule | 46 | public class SerialiserModule : ISharedRegionModule, IRegionSerialiserModule |
45 | { | 47 | { |
46 | private static readonly ILog m_log = | 48 | private static readonly ILog m_log = |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index 7825e3e..bcb8e2f 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs | |||
@@ -39,7 +39,7 @@ using OpenSim.Tests.Common; | |||
39 | namespace OpenSim.Region.CoreModules.World.Serialiser.Tests | 39 | namespace OpenSim.Region.CoreModules.World.Serialiser.Tests |
40 | { | 40 | { |
41 | [TestFixture] | 41 | [TestFixture] |
42 | public class SerialiserTests | 42 | public class SerialiserTests : OpenSimTestCase |
43 | { | 43 | { |
44 | private string xml = @" | 44 | private string xml = @" |
45 | <SceneObjectGroup> | 45 | <SceneObjectGroup> |
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index a2f0950..089fcda 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -24,56 +24,110 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
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 | |||
28 | using System; | 27 | using System; |
28 | using System.IO; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | |||
29 | using Nini.Config; | 32 | using Nini.Config; |
30 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using log4net; | ||
35 | using Mono.Addins; | ||
36 | |||
31 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
32 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
33 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
34 | using System.Reflection; | ||
35 | using log4net; | ||
36 | 40 | ||
37 | namespace OpenSim.Region.CoreModules.World.Sound | 41 | namespace OpenSim.Region.CoreModules.World.Sound |
38 | { | 42 | { |
39 | public class SoundModule : IRegionModule, ISoundModule | 43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SoundModule")] |
44 | public class SoundModule : INonSharedRegionModule, ISoundModule | ||
40 | { | 45 | { |
41 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | // private static readonly ILog m_log = LogManager.GetLogger( |
42 | 47 | // MethodBase.GetCurrentMethod().DeclaringType); | |
43 | protected Scene m_scene; | 48 | |
44 | 49 | private Scene m_scene; | |
45 | public void Initialise(Scene scene, IConfigSource source) | 50 | |
51 | public bool Enabled { get; private set; } | ||
52 | |||
53 | public float MaxDistance { get; private set; } | ||
54 | |||
55 | #region INonSharedRegionModule | ||
56 | |||
57 | public void Initialise(IConfigSource configSource) | ||
58 | { | ||
59 | IConfig config = configSource.Configs["Sounds"]; | ||
60 | |||
61 | if (config == null) | ||
62 | { | ||
63 | Enabled = true; | ||
64 | MaxDistance = 100.0f; | ||
65 | } | ||
66 | else | ||
67 | { | ||
68 | Enabled = config.GetString("Module", "OpenSim.Region.CoreModules.dll:SoundModule") == | ||
69 | Path.GetFileName(Assembly.GetExecutingAssembly().Location) | ||
70 | + ":" + MethodBase.GetCurrentMethod().DeclaringType.Name; | ||
71 | MaxDistance = config.GetFloat("MaxDistance", 100.0f); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | public void AddRegion(Scene scene) { } | ||
76 | |||
77 | public void RemoveRegion(Scene scene) | ||
46 | { | 78 | { |
79 | m_scene.EventManager.OnClientLogin -= OnNewClient; | ||
80 | } | ||
81 | |||
82 | public void RegionLoaded(Scene scene) | ||
83 | { | ||
84 | if (!Enabled) | ||
85 | return; | ||
86 | |||
47 | m_scene = scene; | 87 | m_scene = scene; |
48 | 88 | m_scene.EventManager.OnClientLogin += OnNewClient; | |
49 | m_scene.EventManager.OnNewClient += OnNewClient; | 89 | |
50 | |||
51 | m_scene.RegisterModuleInterface<ISoundModule>(this); | 90 | m_scene.RegisterModuleInterface<ISoundModule>(this); |
52 | } | 91 | } |
53 | 92 | ||
54 | public void PostInitialise() {} | 93 | public void Close() { } |
55 | public void Close() {} | 94 | |
95 | public Type ReplaceableInterface | ||
96 | { | ||
97 | get { return typeof(ISoundModule); } | ||
98 | } | ||
99 | |||
56 | public string Name { get { return "Sound Module"; } } | 100 | public string Name { get { return "Sound Module"; } } |
57 | public bool IsSharedModule { get { return false; } } | 101 | |
58 | 102 | #endregion | |
103 | |||
104 | #region Event Handlers | ||
105 | |||
59 | private void OnNewClient(IClientAPI client) | 106 | private void OnNewClient(IClientAPI client) |
60 | { | 107 | { |
61 | client.OnSoundTrigger += TriggerSound; | 108 | client.OnSoundTrigger += TriggerSound; |
62 | } | 109 | } |
63 | 110 | ||
111 | #endregion | ||
112 | |||
113 | #region ISoundModule | ||
114 | |||
64 | public virtual void PlayAttachedSound( | 115 | public virtual void PlayAttachedSound( |
65 | UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) | 116 | UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) |
66 | { | 117 | { |
67 | SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); | 118 | SceneObjectPart part; |
68 | if (part == null) | 119 | if (!m_scene.TryGetSceneObjectPart(objectID, out part)) |
69 | return; | 120 | return; |
70 | 121 | ||
71 | SceneObjectGroup grp = part.ParentGroup; | 122 | SceneObjectGroup grp = part.ParentGroup; |
72 | 123 | ||
124 | if (radius == 0) | ||
125 | radius = MaxDistance; | ||
126 | |||
73 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | 127 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) |
74 | { | 128 | { |
75 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); | 129 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); |
76 | if (dis > 100.0) // Max audio distance | 130 | if (dis > MaxDistance) // Max audio distance |
77 | return; | 131 | return; |
78 | 132 | ||
79 | if (grp.IsAttachment) | 133 | if (grp.IsAttachment) |
@@ -85,26 +139,22 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
85 | dis = 0; | 139 | dis = 0; |
86 | } | 140 | } |
87 | 141 | ||
88 | float thisSpGain; | ||
89 | |||
90 | // Scale by distance | 142 | // Scale by distance |
91 | if (radius == 0) | 143 | double thisSpGain = gain * ((radius - dis) / radius); |
92 | thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); | ||
93 | else | ||
94 | thisSpGain = (float)((double)gain * ((radius - dis) / radius)); | ||
95 | 144 | ||
96 | sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags); | 145 | sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, |
146 | ownerID, (float)thisSpGain, flags); | ||
97 | }); | 147 | }); |
98 | } | 148 | } |
99 | 149 | ||
100 | public virtual void TriggerSound( | 150 | public virtual void TriggerSound( |
101 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) | 151 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) |
102 | { | 152 | { |
103 | SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); | 153 | SceneObjectPart part; |
104 | if (part == null) | 154 | if (!m_scene.TryGetSceneObjectPart(objectID, out part)) |
105 | { | 155 | { |
106 | ScenePresence sp; | 156 | ScenePresence sp; |
107 | if (!m_scene.TryGetScenePresence(objectID, out sp)) | 157 | if (!m_scene.TryGetScenePresence(ownerID, out sp)) |
108 | return; | 158 | return; |
109 | } | 159 | } |
110 | else | 160 | else |
@@ -118,24 +168,207 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
118 | } | 168 | } |
119 | } | 169 | } |
120 | 170 | ||
171 | if (radius == 0) | ||
172 | radius = MaxDistance; | ||
173 | |||
121 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | 174 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) |
122 | { | 175 | { |
123 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); | 176 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); |
124 | 177 | ||
125 | if (dis > 100.0) // Max audio distance | 178 | if (dis > MaxDistance) // Max audio distance |
126 | return; | 179 | return; |
127 | 180 | ||
128 | float thisSpGain; | ||
129 | |||
130 | // Scale by distance | 181 | // Scale by distance |
131 | if (radius == 0) | 182 | double thisSpGain = gain * ((radius - dis) / radius); |
132 | thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); | 183 | |
184 | sp.ControllingClient.SendTriggeredSound(soundId, ownerID, | ||
185 | objectID, parentID, handle, position, | ||
186 | (float)thisSpGain); | ||
187 | }); | ||
188 | } | ||
189 | |||
190 | public virtual void StopSound(UUID objectID) | ||
191 | { | ||
192 | SceneObjectPart m_host; | ||
193 | if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) | ||
194 | return; | ||
195 | |||
196 | StopSound(m_host); | ||
197 | } | ||
198 | |||
199 | private static void StopSound(SceneObjectPart m_host) | ||
200 | { | ||
201 | m_host.AdjustSoundGain(0); | ||
202 | // Xantor 20080528: Clear prim data of sound instead | ||
203 | if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) | ||
204 | { | ||
205 | if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) | ||
206 | { | ||
207 | foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) | ||
208 | { | ||
209 | part.Sound = UUID.Zero; | ||
210 | part.SoundFlags = 1 << 5; | ||
211 | part.SoundRadius = 0; | ||
212 | part.ScheduleFullUpdate(); | ||
213 | part.SendFullUpdateToAllClients(); | ||
214 | } | ||
215 | m_host.ParentGroup.LoopSoundMasterPrim = null; | ||
216 | m_host.ParentGroup.LoopSoundSlavePrims.Clear(); | ||
217 | } | ||
133 | else | 218 | else |
134 | thisSpGain = (float)((double)gain * ((radius - dis) / radius)); | 219 | { |
220 | m_host.Sound = UUID.Zero; | ||
221 | m_host.SoundFlags = 1 << 5; | ||
222 | m_host.SoundRadius = 0; | ||
223 | m_host.ScheduleFullUpdate(); | ||
224 | m_host.SendFullUpdateToAllClients(); | ||
225 | } | ||
226 | } | ||
227 | else | ||
228 | { | ||
229 | m_host.Sound = UUID.Zero; | ||
230 | m_host.SoundFlags = 1 << 5; | ||
231 | m_host.SoundRadius = 0; | ||
232 | m_host.ScheduleFullUpdate(); | ||
233 | m_host.SendFullUpdateToAllClients(); | ||
234 | } | ||
235 | } | ||
135 | 236 | ||
136 | sp.ControllingClient.SendTriggeredSound( | 237 | public virtual void PreloadSound(UUID objectID, UUID soundID, float radius) |
137 | soundId, ownerID, objectID, parentID, handle, position, thisSpGain); | 238 | { |
239 | SceneObjectPart part; | ||
240 | if (soundID == UUID.Zero | ||
241 | || !m_scene.TryGetSceneObjectPart(objectID, out part)) | ||
242 | { | ||
243 | return; | ||
244 | } | ||
245 | |||
246 | if (radius == 0) | ||
247 | radius = MaxDistance; | ||
248 | |||
249 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | ||
250 | { | ||
251 | if (!(Util.GetDistanceTo(sp.AbsolutePosition, part.AbsolutePosition) >= MaxDistance)) | ||
252 | sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | ||
138 | }); | 253 | }); |
139 | } | 254 | } |
255 | |||
256 | // Xantor 20080528 we should do this differently. | ||
257 | // 1) apply the sound to the object | ||
258 | // 2) schedule full update | ||
259 | // just sending the sound out once doesn't work so well when other avatars come in view later on | ||
260 | // or when the prim gets moved, changed, sat on, whatever | ||
261 | // see large number of mantises (mantes?) | ||
262 | // 20080530 Updated to remove code duplication | ||
263 | // 20080530 Stop sound if there is one, otherwise volume only changes don't work | ||
264 | public void LoopSound(UUID objectID, UUID soundID, | ||
265 | double volume, double radius, bool isMaster) | ||
266 | { | ||
267 | SceneObjectPart m_host; | ||
268 | if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) | ||
269 | return; | ||
270 | |||
271 | if (isMaster) | ||
272 | m_host.ParentGroup.LoopSoundMasterPrim = m_host; | ||
273 | |||
274 | if (m_host.Sound != UUID.Zero) | ||
275 | StopSound(m_host); | ||
276 | |||
277 | m_host.Sound = soundID; | ||
278 | m_host.SoundGain = volume; | ||
279 | m_host.SoundFlags = 1; // looping | ||
280 | m_host.SoundRadius = radius; | ||
281 | |||
282 | m_host.ScheduleFullUpdate(); | ||
283 | m_host.SendFullUpdateToAllClients(); | ||
284 | } | ||
285 | |||
286 | public void SendSound(UUID objectID, UUID soundID, double volume, | ||
287 | bool triggered, byte flags, float radius, bool useMaster, | ||
288 | bool isMaster) | ||
289 | { | ||
290 | if (soundID == UUID.Zero) | ||
291 | return; | ||
292 | |||
293 | SceneObjectPart part; | ||
294 | if (!m_scene.TryGetSceneObjectPart(objectID, out part)) | ||
295 | return; | ||
296 | |||
297 | volume = Util.Clip((float)volume, 0, 1); | ||
298 | |||
299 | UUID parentID = part.ParentGroup.UUID; | ||
300 | |||
301 | Vector3 position = part.AbsolutePosition; // region local | ||
302 | ulong regionHandle = m_scene.RegionInfo.RegionHandle; | ||
303 | |||
304 | if (useMaster) | ||
305 | { | ||
306 | if (isMaster) | ||
307 | { | ||
308 | if (triggered) | ||
309 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
310 | else | ||
311 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
312 | part.ParentGroup.PlaySoundMasterPrim = part; | ||
313 | if (triggered) | ||
314 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
315 | else | ||
316 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
317 | foreach (SceneObjectPart prim in part.ParentGroup.PlaySoundSlavePrims) | ||
318 | { | ||
319 | position = prim.AbsolutePosition; // region local | ||
320 | if (triggered) | ||
321 | TriggerSound(soundID, part.OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius); | ||
322 | else | ||
323 | PlayAttachedSound(soundID, part.OwnerID, prim.UUID, volume, position, flags, radius); | ||
324 | } | ||
325 | part.ParentGroup.PlaySoundSlavePrims.Clear(); | ||
326 | part.ParentGroup.PlaySoundMasterPrim = null; | ||
327 | } | ||
328 | else | ||
329 | { | ||
330 | part.ParentGroup.PlaySoundSlavePrims.Add(part); | ||
331 | } | ||
332 | } | ||
333 | else | ||
334 | { | ||
335 | if (triggered) | ||
336 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
337 | else | ||
338 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
339 | } | ||
340 | } | ||
341 | |||
342 | public void TriggerSoundLimited(UUID objectID, UUID sound, | ||
343 | double volume, Vector3 min, Vector3 max) | ||
344 | { | ||
345 | if (sound == UUID.Zero) | ||
346 | return; | ||
347 | |||
348 | SceneObjectPart part; | ||
349 | if (!m_scene.TryGetSceneObjectPart(objectID, out part)) | ||
350 | return; | ||
351 | |||
352 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | ||
353 | { | ||
354 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, | ||
355 | part.AbsolutePosition); | ||
356 | |||
357 | if (dis > MaxDistance) // Max audio distance | ||
358 | return; | ||
359 | else if (!Util.IsInsideBox(sp.AbsolutePosition, min, max)) | ||
360 | return; | ||
361 | |||
362 | // Scale by distance | ||
363 | double thisSpGain = volume * ((MaxDistance - dis) / MaxDistance); | ||
364 | |||
365 | sp.ControllingClient.SendTriggeredSound(sound, part.OwnerID, | ||
366 | part.UUID, part.ParentGroup.UUID, | ||
367 | m_scene.RegionInfo.RegionHandle, | ||
368 | part.AbsolutePosition, (float)thisSpGain); | ||
369 | }); | ||
370 | } | ||
371 | |||
372 | #endregion | ||
140 | } | 373 | } |
141 | } | 374 | } |
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index 9a954b8..a321c09 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using log4net; | 31 | using log4net; |
32 | using Mono.Addins; | ||
32 | using Nini.Config; | 33 | using Nini.Config; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
@@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; | |||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules | 39 | namespace OpenSim.Region.CoreModules |
39 | { | 40 | { |
41 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SunModule")] | ||
40 | public class SunModule : ISunModule | 42 | public class SunModule : ISunModule |
41 | { | 43 | { |
42 | /// <summary> | 44 | /// <summary> |
@@ -267,26 +269,17 @@ namespace OpenSim.Region.CoreModules | |||
267 | return GetCurrentSunHour() + 6.0f; | 269 | return GetCurrentSunHour() + 6.0f; |
268 | } | 270 | } |
269 | 271 | ||
270 | #region IRegion Methods | 272 | #region INonSharedRegion Methods |
271 | 273 | ||
272 | // Called immediately after the module is loaded for a given region | 274 | // Called immediately after the module is loaded for a given region |
273 | // i.e. Immediately after instance creation. | 275 | // i.e. Immediately after instance creation. |
274 | public void Initialise(Scene scene, IConfigSource config) | 276 | public void Initialise(IConfigSource config) |
275 | { | 277 | { |
276 | m_scene = scene; | ||
277 | m_frame = 0; | 278 | m_frame = 0; |
278 | 279 | ||
279 | // This one puts an entry in the main help screen | 280 | // This one puts an entry in the main help screen |
280 | // m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); | 281 | // m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); |
281 | 282 | ||
282 | // This one enables the ability to type just "sun" without any parameters | ||
283 | // m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand); | ||
284 | foreach (KeyValuePair<string, string> kvp in GetParamList()) | ||
285 | { | ||
286 | string sunCommand = string.Format("sun {0}", kvp.Key); | ||
287 | m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand); | ||
288 | } | ||
289 | |||
290 | TimeZone local = TimeZone.CurrentTimeZone; | 283 | TimeZone local = TimeZone.CurrentTimeZone; |
291 | TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; | 284 | TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; |
292 | m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset); | 285 | m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset); |
@@ -358,15 +351,6 @@ namespace OpenSim.Region.CoreModules | |||
358 | HorizonShift = m_HorizonShift; // Z axis translation | 351 | HorizonShift = m_HorizonShift; // Z axis translation |
359 | // HoursToRadians = (SunCycle/24)*VWTimeRatio; | 352 | // HoursToRadians = (SunCycle/24)*VWTimeRatio; |
360 | 353 | ||
361 | // Insert our event handling hooks | ||
362 | |||
363 | scene.EventManager.OnFrame += SunUpdate; | ||
364 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | ||
365 | scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; | ||
366 | scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; | ||
367 | |||
368 | ready = true; | ||
369 | |||
370 | m_log.Debug("[SUN]: Mode is " + m_RegionMode); | 354 | m_log.Debug("[SUN]: Mode is " + m_RegionMode); |
371 | m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); | 355 | m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); |
372 | m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); | 356 | m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); |
@@ -376,14 +360,37 @@ namespace OpenSim.Region.CoreModules | |||
376 | break; | 360 | break; |
377 | } | 361 | } |
378 | 362 | ||
379 | scene.RegisterModuleInterface<ISunModule>(this); | ||
380 | } | 363 | } |
381 | 364 | ||
382 | public void PostInitialise() | 365 | public Type ReplaceableInterface |
383 | { | 366 | { |
367 | get { return null; } | ||
384 | } | 368 | } |
385 | 369 | ||
386 | public void Close() | 370 | public void AddRegion(Scene scene) |
371 | { | ||
372 | m_scene = scene; | ||
373 | // Insert our event handling hooks | ||
374 | |||
375 | scene.EventManager.OnFrame += SunUpdate; | ||
376 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | ||
377 | scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; | ||
378 | scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; | ||
379 | |||
380 | scene.RegisterModuleInterface<ISunModule>(this); | ||
381 | |||
382 | // This one enables the ability to type just "sun" without any parameters | ||
383 | // m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand); | ||
384 | foreach (KeyValuePair<string, string> kvp in GetParamList()) | ||
385 | { | ||
386 | string sunCommand = string.Format("sun {0}", kvp.Key); | ||
387 | m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand); | ||
388 | } | ||
389 | |||
390 | ready = true; | ||
391 | } | ||
392 | |||
393 | public void RemoveRegion(Scene scene) | ||
387 | { | 394 | { |
388 | ready = false; | 395 | ready = false; |
389 | 396 | ||
@@ -394,14 +401,17 @@ namespace OpenSim.Region.CoreModules | |||
394 | m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; | 401 | m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; |
395 | } | 402 | } |
396 | 403 | ||
397 | public string Name | 404 | public void RegionLoaded(Scene scene) |
398 | { | 405 | { |
399 | get { return "SunModule"; } | ||
400 | } | 406 | } |
401 | 407 | ||
402 | public bool IsSharedModule | 408 | public void Close() |
403 | { | 409 | { |
404 | get { return false; } | 410 | } |
411 | |||
412 | public string Name | ||
413 | { | ||
414 | get { return "SunModule"; } | ||
405 | } | 415 | } |
406 | 416 | ||
407 | #endregion | 417 | #endregion |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 4694b14..52b4313 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -33,6 +33,7 @@ using System.Net; | |||
33 | using log4net; | 33 | using log4net; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using Mono.Addins; | ||
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | 38 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
38 | using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; | 39 | using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; |
@@ -43,6 +44,7 @@ using OpenSim.Region.Framework.Scenes; | |||
43 | 44 | ||
44 | namespace OpenSim.Region.CoreModules.World.Terrain | 45 | namespace OpenSim.Region.CoreModules.World.Terrain |
45 | { | 46 | { |
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TerrainModule")] | ||
46 | public class TerrainModule : INonSharedRegionModule, ICommandableModule, ITerrainModule | 48 | public class TerrainModule : INonSharedRegionModule, ICommandableModule, ITerrainModule |
47 | { | 49 | { |
48 | #region StandardTerrainEffects enum | 50 | #region StandardTerrainEffects enum |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index 3d4f762..be719ea 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs | |||
@@ -30,11 +30,12 @@ using NUnit.Framework; | |||
30 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
31 | using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; | 31 | using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; |
32 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Tests.Common; | ||
33 | 34 | ||
34 | namespace OpenSim.Region.CoreModules.World.Terrain.Tests | 35 | namespace OpenSim.Region.CoreModules.World.Terrain.Tests |
35 | { | 36 | { |
36 | [TestFixture] | 37 | [TestFixture] |
37 | public class TerrainTest | 38 | public class TerrainTest : OpenSimTestCase |
38 | { | 39 | { |
39 | [Test] | 40 | [Test] |
40 | public void BrushTest() | 41 | public void BrushTest() |
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs index f5f35bb..3f5d375 100644 --- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs +++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs | |||
@@ -28,15 +28,17 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using log4net; | 30 | using log4net; |
31 | using Mono.Addins; | ||
31 | using Nini.Config; | 32 | using Nini.Config; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
36 | 37 | ||
37 | namespace OpenSim.Region.CoreModules.Avatar.Vegetation | 38 | namespace OpenSim.Region.CoreModules.World.Vegetation |
38 | { | 39 | { |
39 | public class VegetationModule : IRegionModule, IVegetationModule | 40 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VegetationModule")] |
41 | public class VegetationModule : INonSharedRegionModule, IVegetationModule | ||
40 | { | 42 | { |
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 44 | ||
@@ -45,16 +47,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation | |||
45 | protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree }; | 47 | protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree }; |
46 | public PCode[] CreationCapabilities { get { return creationCapabilities; } } | 48 | public PCode[] CreationCapabilities { get { return creationCapabilities; } } |
47 | 49 | ||
48 | public void Initialise(Scene scene, IConfigSource source) | 50 | public void Initialise(IConfigSource source) |
51 | { | ||
52 | } | ||
53 | |||
54 | public void AddRegion(Scene scene) | ||
49 | { | 55 | { |
50 | m_scene = scene; | 56 | m_scene = scene; |
51 | m_scene.RegisterModuleInterface<IVegetationModule>(this); | 57 | m_scene.RegisterModuleInterface<IVegetationModule>(this); |
52 | } | 58 | } |
53 | 59 | ||
54 | public void PostInitialise() {} | 60 | public void RemoveRegion(Scene scene) |
61 | { | ||
62 | m_scene.UnregisterModuleInterface<IVegetationModule>(this); | ||
63 | } | ||
64 | |||
55 | public void Close() {} | 65 | public void Close() {} |
56 | public string Name { get { return "Vegetation Module"; } } | 66 | public string Name { get { return "Vegetation Module"; } } |
57 | public bool IsSharedModule { get { return false; } } | 67 | |
68 | public Type ReplaceableInterface | ||
69 | { | ||
70 | get { return null; } | ||
71 | } | ||
72 | |||
73 | public void RegionLoaded(Scene scene) | ||
74 | { | ||
75 | } | ||
58 | 76 | ||
59 | public SceneObjectGroup AddTree( | 77 | public SceneObjectGroup AddTree( |
60 | UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree) | 78 | UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree) |
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 2d762fb..5e0dfa7 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | |||
@@ -35,6 +35,7 @@ using CSJ2K; | |||
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using log4net; | 36 | using log4net; |
37 | using Rednettle.Warp3D; | 37 | using Rednettle.Warp3D; |
38 | using Mono.Addins; | ||
38 | using OpenMetaverse; | 39 | using OpenMetaverse; |
39 | using OpenMetaverse.Imaging; | 40 | using OpenMetaverse.Imaging; |
40 | using OpenMetaverse.Rendering; | 41 | using OpenMetaverse.Rendering; |
@@ -49,6 +50,7 @@ using WarpRenderer = global::Warp3D.Warp3D; | |||
49 | 50 | ||
50 | namespace OpenSim.Region.CoreModules.World.Warp3DMap | 51 | namespace OpenSim.Region.CoreModules.World.Warp3DMap |
51 | { | 52 | { |
53 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Warp3DImageModule")] | ||
52 | public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule | 54 | public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule |
53 | { | 55 | { |
54 | private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3"); | 56 | private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3"); |
@@ -63,7 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
63 | private bool m_useAntiAliasing = false; // TODO: Make this a config option | 65 | private bool m_useAntiAliasing = false; // TODO: Make this a config option |
64 | private bool m_Enabled = false; | 66 | private bool m_Enabled = false; |
65 | 67 | ||
66 | #region IRegionModule Members | 68 | #region Region Module interface |
67 | 69 | ||
68 | public void Initialise(IConfigSource source) | 70 | public void Initialise(IConfigSource source) |
69 | { | 71 | { |
diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs index 9d47e19..6af4050 100644 --- a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs +++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs | |||
@@ -31,12 +31,14 @@ using System.Reflection; | |||
31 | 31 | ||
32 | using log4net; | 32 | using log4net; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using Mono.Addins; | ||
34 | 35 | ||
35 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.CoreModules.World.Wind; | 37 | using OpenSim.Region.CoreModules.World.Wind; |
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.World.Wind.Plugins | 39 | namespace OpenSim.Region.CoreModules.World.Wind.Plugins |
39 | { | 40 | { |
41 | [Extension(Path = "/OpenSim/WindModule", NodeName = "WindModel", Id = "ConfigurableWind")] | ||
40 | class ConfigurableWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin | 42 | class ConfigurableWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin |
41 | { | 43 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs index 071e20b..fcb0c10 100644 --- a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs +++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs | |||
@@ -29,11 +29,13 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | 30 | ||
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using Mono.Addins; | ||
32 | 33 | ||
33 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
34 | 35 | ||
35 | namespace OpenSim.Region.CoreModules.World.Wind.Plugins | 36 | namespace OpenSim.Region.CoreModules.World.Wind.Plugins |
36 | { | 37 | { |
38 | [Extension(Path = "/OpenSim/WindModule", NodeName = "WindModel", Id = "SimpleRandomWind")] | ||
37 | class SimpleRandomWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin | 39 | class SimpleRandomWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin |
38 | { | 40 | { |
39 | private Vector2[] m_windSpeeds = new Vector2[16 * 16]; | 41 | private Vector2[] m_windSpeeds = new Vector2[16 * 16]; |
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 7b6fbda..9de588c 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs | |||
@@ -40,6 +40,7 @@ using OpenSim.Region.CoreModules.World.Wind; | |||
40 | 40 | ||
41 | namespace OpenSim.Region.CoreModules | 41 | namespace OpenSim.Region.CoreModules |
42 | { | 42 | { |
43 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WindModule")] | ||
43 | public class WindModule : IWindModule | 44 | public class WindModule : IWindModule |
44 | { | 45 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -52,31 +53,31 @@ namespace OpenSim.Region.CoreModules | |||
52 | private bool m_ready = false; | 53 | private bool m_ready = false; |
53 | 54 | ||
54 | private bool m_enabled = false; | 55 | private bool m_enabled = false; |
55 | 56 | private IConfig m_windConfig; | |
56 | private IWindModelPlugin m_activeWindPlugin = null; | 57 | private IWindModelPlugin m_activeWindPlugin = null; |
57 | private const string m_dWindPluginName = "SimpleRandomWind"; | 58 | private string m_dWindPluginName = "SimpleRandomWind"; |
58 | private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>(); | 59 | private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>(); |
59 | 60 | ||
60 | // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m | 61 | // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m |
61 | private Vector2[] windSpeeds = new Vector2[16 * 16]; | 62 | private Vector2[] windSpeeds = new Vector2[16 * 16]; |
62 | 63 | ||
63 | #region IRegion Methods | 64 | #region INonSharedRegionModule Methods |
64 | 65 | ||
65 | public void Initialise(Scene scene, IConfigSource config) | 66 | public void Initialise(IConfigSource config) |
66 | { | 67 | { |
67 | IConfig windConfig = config.Configs["Wind"]; | 68 | m_windConfig = config.Configs["Wind"]; |
68 | string desiredWindPlugin = m_dWindPluginName; | 69 | // string desiredWindPlugin = m_dWindPluginName; |
69 | 70 | ||
70 | if (windConfig != null) | 71 | if (m_windConfig != null) |
71 | { | 72 | { |
72 | m_enabled = windConfig.GetBoolean("enabled", true); | 73 | m_enabled = m_windConfig.GetBoolean("enabled", true); |
73 | 74 | ||
74 | m_frameUpdateRate = windConfig.GetInt("wind_update_rate", 150); | 75 | m_frameUpdateRate = m_windConfig.GetInt("wind_update_rate", 150); |
75 | 76 | ||
76 | // Determine which wind model plugin is desired | 77 | // Determine which wind model plugin is desired |
77 | if (windConfig.Contains("wind_plugin")) | 78 | if (m_windConfig.Contains("wind_plugin")) |
78 | { | 79 | { |
79 | desiredWindPlugin = windConfig.GetString("wind_plugin"); | 80 | m_dWindPluginName = m_windConfig.GetString("wind_plugin", m_dWindPluginName); |
80 | } | 81 | } |
81 | } | 82 | } |
82 | 83 | ||
@@ -84,104 +85,111 @@ namespace OpenSim.Region.CoreModules | |||
84 | { | 85 | { |
85 | m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); | 86 | m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); |
86 | 87 | ||
87 | m_scene = scene; | 88 | } |
88 | m_frame = 0; | ||
89 | |||
90 | // Register all the Wind Model Plug-ins | ||
91 | foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false)) | ||
92 | { | ||
93 | m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name); | ||
94 | m_availableWindPlugins.Add(windPlugin.Name, windPlugin); | ||
95 | } | ||
96 | 89 | ||
97 | // Check for desired plugin | 90 | } |
98 | if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) | ||
99 | { | ||
100 | m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; | ||
101 | 91 | ||
102 | m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); | 92 | public void AddRegion(Scene scene) |
93 | { | ||
94 | if (!m_enabled) | ||
95 | return; | ||
103 | 96 | ||
104 | if (windConfig != null) | 97 | m_scene = scene; |
105 | { | 98 | m_frame = 0; |
106 | m_activeWindPlugin.Initialise(); | ||
107 | m_activeWindPlugin.WindConfig(m_scene, windConfig); | ||
108 | } | ||
109 | } | ||
110 | 99 | ||
100 | // Register all the Wind Model Plug-ins | ||
101 | foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false)) | ||
102 | { | ||
103 | m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name); | ||
104 | m_availableWindPlugins.Add(windPlugin.Name, windPlugin); | ||
105 | } | ||
111 | 106 | ||
112 | // if the plug-in wasn't found, default to no wind. | 107 | // Check for desired plugin |
113 | if (m_activeWindPlugin == null) | 108 | if (m_availableWindPlugins.ContainsKey(m_dWindPluginName)) |
114 | { | 109 | { |
115 | m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); | 110 | m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName]; |
116 | m_log.ErrorFormat("[WIND] Defaulting to no wind."); | ||
117 | } | ||
118 | 111 | ||
119 | // This one puts an entry in the main help screen | 112 | m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName); |
120 | // m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); | ||
121 | |||
122 | // This one enables the ability to type just the base command without any parameters | ||
123 | // m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand); | ||
124 | 113 | ||
125 | // Get a list of the parameters for each plugin | 114 | if (m_windConfig != null) |
126 | foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) | ||
127 | { | 115 | { |
128 | // m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); | 116 | m_activeWindPlugin.Initialise(); |
129 | m_scene.AddCommand( | 117 | m_activeWindPlugin.WindConfig(m_scene, m_windConfig); |
130 | "Regions", | ||
131 | this, | ||
132 | "wind base wind_update_rate", | ||
133 | "wind base wind_update_rate [<value>]", | ||
134 | "Get or set the wind update rate.", | ||
135 | "", | ||
136 | HandleConsoleBaseCommand); | ||
137 | |||
138 | foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) | ||
139 | { | ||
140 | string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key); | ||
141 | m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand); | ||
142 | } | ||
143 | } | 118 | } |
119 | } | ||
144 | 120 | ||
145 | // Register event handlers for when Avatars enter the region, and frame ticks | ||
146 | m_scene.EventManager.OnFrame += WindUpdate; | ||
147 | m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; | ||
148 | 121 | ||
149 | // Register the wind module | 122 | // if the plug-in wasn't found, default to no wind. |
150 | m_scene.RegisterModuleInterface<IWindModule>(this); | 123 | if (m_activeWindPlugin == null) |
124 | { | ||
125 | m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_dWindPluginName); | ||
126 | m_log.ErrorFormat("[WIND] Defaulting to no wind."); | ||
127 | } | ||
151 | 128 | ||
152 | // Generate initial wind values | 129 | // This one puts an entry in the main help screen |
153 | GenWindPos(); | 130 | // m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); |
154 | 131 | ||
155 | // Mark Module Ready for duty | 132 | // This one enables the ability to type just the base command without any parameters |
156 | m_ready = true; | 133 | // m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand); |
157 | 134 | ||
135 | // Get a list of the parameters for each plugin | ||
136 | foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) | ||
137 | { | ||
138 | // m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); | ||
139 | m_scene.AddCommand( | ||
140 | "Regions", | ||
141 | this, | ||
142 | "wind base wind_update_rate", | ||
143 | "wind base wind_update_rate [<value>]", | ||
144 | "Get or set the wind update rate.", | ||
145 | "", | ||
146 | HandleConsoleBaseCommand); | ||
147 | |||
148 | foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) | ||
149 | { | ||
150 | string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key); | ||
151 | m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand); | ||
152 | } | ||
158 | } | 153 | } |
159 | 154 | ||
160 | } | 155 | // Register event handlers for when Avatars enter the region, and frame ticks |
156 | m_scene.EventManager.OnFrame += WindUpdate; | ||
157 | m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion; | ||
161 | 158 | ||
162 | public void PostInitialise() | 159 | // Register the wind module |
163 | { | 160 | m_scene.RegisterModuleInterface<IWindModule>(this); |
161 | |||
162 | // Generate initial wind values | ||
163 | GenWindPos(); | ||
164 | |||
165 | // Mark Module Ready for duty | ||
166 | m_ready = true; | ||
164 | } | 167 | } |
165 | 168 | ||
166 | public void Close() | 169 | public void RemoveRegion(Scene scene) |
167 | { | 170 | { |
168 | if (m_enabled) | 171 | if (!m_enabled) |
172 | return; | ||
173 | |||
174 | m_ready = false; | ||
175 | |||
176 | // REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ?? | ||
177 | m_activeWindPlugin = null; | ||
178 | foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) | ||
169 | { | 179 | { |
170 | m_ready = false; | 180 | windPlugin.Dispose(); |
181 | } | ||
171 | 182 | ||
172 | // REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ?? | 183 | m_availableWindPlugins.Clear(); |
173 | m_activeWindPlugin = null; | ||
174 | foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values) | ||
175 | { | ||
176 | windPlugin.Dispose(); | ||
177 | } | ||
178 | 184 | ||
179 | m_availableWindPlugins.Clear(); | 185 | // Remove our hooks |
186 | m_scene.EventManager.OnFrame -= WindUpdate; | ||
187 | m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; | ||
180 | 188 | ||
181 | // Remove our hooks | 189 | } |
182 | m_scene.EventManager.OnFrame -= WindUpdate; | 190 | |
183 | m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; | 191 | public void Close() |
184 | } | 192 | { |
185 | } | 193 | } |
186 | 194 | ||
187 | public string Name | 195 | public string Name |
@@ -189,11 +197,14 @@ namespace OpenSim.Region.CoreModules | |||
189 | get { return "WindModule"; } | 197 | get { return "WindModule"; } |
190 | } | 198 | } |
191 | 199 | ||
192 | public bool IsSharedModule | 200 | public Type ReplaceableInterface |
193 | { | 201 | { |
194 | get { return false; } | 202 | get { return null; } |
195 | } | 203 | } |
196 | 204 | ||
205 | public void RegionLoaded(Scene scene) | ||
206 | { | ||
207 | } | ||
197 | 208 | ||
198 | #endregion | 209 | #endregion |
199 | 210 | ||
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index f37dd94..708a9a2 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -24,11 +24,13 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
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 | using System; | ||
27 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
28 | using System.Reflection; | 29 | using System.Reflection; |
29 | using log4net; | 30 | using log4net; |
30 | using Nini.Config; | 31 | using Nini.Config; |
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using Mono.Addins; | ||
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
33 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
@@ -37,16 +39,22 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
37 | 39 | ||
38 | namespace OpenSim.Region.CoreModules.World.WorldMap | 40 | namespace OpenSim.Region.CoreModules.World.WorldMap |
39 | { | 41 | { |
40 | public class MapSearchModule : IRegionModule | 42 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapSearchModule")] |
43 | public class MapSearchModule : ISharedRegionModule | ||
41 | { | 44 | { |
42 | private static readonly ILog m_log = | 45 | private static readonly ILog m_log = |
43 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 47 | ||
45 | Scene m_scene = null; // only need one for communication with GridService | 48 | Scene m_scene = null; // only need one for communication with GridService |
46 | List<Scene> m_scenes = new List<Scene>(); | 49 | List<Scene> m_scenes = new List<Scene>(); |
50 | List<UUID> m_Clients; | ||
47 | 51 | ||
48 | #region IRegionModule Members | 52 | #region ISharedRegionModule Members |
49 | public void Initialise(Scene scene, IConfigSource source) | 53 | public void Initialise(IConfigSource source) |
54 | { | ||
55 | } | ||
56 | |||
57 | public void AddRegion(Scene scene) | ||
50 | { | 58 | { |
51 | if (m_scene == null) | 59 | if (m_scene == null) |
52 | { | 60 | { |
@@ -55,6 +63,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
55 | 63 | ||
56 | m_scenes.Add(scene); | 64 | m_scenes.Add(scene); |
57 | scene.EventManager.OnNewClient += OnNewClient; | 65 | scene.EventManager.OnNewClient += OnNewClient; |
66 | m_Clients = new List<UUID>(); | ||
67 | } | ||
68 | |||
69 | public void RemoveRegion(Scene scene) | ||
70 | { | ||
71 | m_scenes.Remove(scene); | ||
72 | if (m_scene == scene && m_scenes.Count > 0) | ||
73 | m_scene = m_scenes[0]; | ||
74 | |||
75 | scene.EventManager.OnNewClient -= OnNewClient; | ||
58 | } | 76 | } |
59 | 77 | ||
60 | public void PostInitialise() | 78 | public void PostInitialise() |
@@ -72,26 +90,59 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
72 | get { return "MapSearchModule"; } | 90 | get { return "MapSearchModule"; } |
73 | } | 91 | } |
74 | 92 | ||
75 | public bool IsSharedModule | 93 | public Type ReplaceableInterface |
76 | { | 94 | { |
77 | get { return true; } | 95 | get { return null; } |
78 | } | 96 | } |
79 | 97 | ||
98 | public void RegionLoaded(Scene scene) | ||
99 | { | ||
100 | } | ||
80 | #endregion | 101 | #endregion |
81 | 102 | ||
82 | private void OnNewClient(IClientAPI client) | 103 | private void OnNewClient(IClientAPI client) |
83 | { | 104 | { |
84 | client.OnMapNameRequest += OnMapNameRequest; | 105 | client.OnMapNameRequest += OnMapNameRequestHandler; |
106 | } | ||
107 | |||
108 | private void OnMapNameRequestHandler(IClientAPI remoteClient, string mapName, uint flags) | ||
109 | { | ||
110 | lock (m_Clients) | ||
111 | { | ||
112 | if (m_Clients.Contains(remoteClient.AgentId)) | ||
113 | return; | ||
114 | |||
115 | m_Clients.Add(remoteClient.AgentId); | ||
116 | } | ||
117 | |||
118 | try | ||
119 | { | ||
120 | OnMapNameRequest(remoteClient, mapName, flags); | ||
121 | } | ||
122 | finally | ||
123 | { | ||
124 | lock (m_Clients) | ||
125 | m_Clients.Remove(remoteClient.AgentId); | ||
126 | } | ||
85 | } | 127 | } |
86 | 128 | ||
87 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) | 129 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) |
88 | { | 130 | { |
89 | if (mapName.Length < 3) | 131 | List<MapBlockData> blocks = new List<MapBlockData>(); |
132 | MapBlockData data; | ||
133 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) | ||
90 | { | 134 | { |
135 | // final block, closing the search result | ||
136 | AddFinalBlock(blocks); | ||
137 | |||
138 | // flags are agent flags sent from the viewer. | ||
139 | // they have different values depending on different viewers, apparently | ||
140 | remoteClient.SendMapBlock(blocks, flags); | ||
91 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); | 141 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); |
92 | return; | 142 | return; |
93 | } | 143 | } |
94 | 144 | ||
145 | |||
95 | //m_log.DebugFormat("MAP NAME=({0})", mapName); | 146 | //m_log.DebugFormat("MAP NAME=({0})", mapName); |
96 | 147 | ||
97 | // Hack to get around the fact that ll V3 now drops the port from the | 148 | // Hack to get around the fact that ll V3 now drops the port from the |
@@ -112,13 +163,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
112 | 163 | ||
113 | // try to fetch from GridServer | 164 | // try to fetch from GridServer |
114 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | 165 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); |
115 | if (regionInfos.Count == 0) | ||
116 | remoteClient.SendAlertMessage("Hyperlink could not be established."); | ||
117 | 166 | ||
118 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); | 167 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); |
119 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
120 | |||
121 | MapBlockData data; | ||
122 | if (regionInfos.Count > 0) | 168 | if (regionInfos.Count > 0) |
123 | { | 169 | { |
124 | foreach (GridRegion info in regionInfos) | 170 | foreach (GridRegion info in regionInfos) |
@@ -145,16 +191,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
145 | } | 191 | } |
146 | 192 | ||
147 | // final block, closing the search result | 193 | // final block, closing the search result |
148 | data = new MapBlockData(); | 194 | AddFinalBlock(blocks); |
149 | data.Agents = 0; | ||
150 | data.Access = 255; | ||
151 | data.MapImageId = UUID.Zero; | ||
152 | data.Name = ""; // mapName; | ||
153 | data.RegionFlags = 0; | ||
154 | data.WaterHeight = 0; // not used | ||
155 | data.X = 0; | ||
156 | data.Y = 0; | ||
157 | blocks.Add(data); | ||
158 | 195 | ||
159 | // flags are agent flags sent from the viewer. | 196 | // flags are agent flags sent from the viewer. |
160 | // they have different values depending on different viewers, apparently | 197 | // they have different values depending on different viewers, apparently |
@@ -166,12 +203,26 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
166 | if (flags == 2) | 203 | if (flags == 2) |
167 | { | 204 | { |
168 | if (regionInfos.Count == 0) | 205 | if (regionInfos.Count == 0) |
169 | remoteClient.SendAgentAlertMessage("No regions found with that name.", true); | 206 | remoteClient.SendAlertMessage("No regions found with that name."); |
170 | else if (regionInfos.Count == 1) | 207 | else if (regionInfos.Count == 1) |
171 | remoteClient.SendAgentAlertMessage("Region found!", false); | 208 | remoteClient.SendAlertMessage("Region found!"); |
172 | } | 209 | } |
173 | } | 210 | } |
174 | 211 | ||
212 | private void AddFinalBlock(List<MapBlockData> blocks) | ||
213 | { | ||
214 | // final block, closing the search result | ||
215 | MapBlockData data = new MapBlockData(); | ||
216 | data.Agents = 0; | ||
217 | data.Access = 255; | ||
218 | data.MapImageId = UUID.Zero; | ||
219 | data.Name = ""; | ||
220 | data.RegionFlags = 0; | ||
221 | data.WaterHeight = 0; // not used | ||
222 | data.X = 0; | ||
223 | data.Y = 0; | ||
224 | blocks.Add(data); | ||
225 | } | ||
175 | // private Scene GetClientScene(IClientAPI client) | 226 | // private Scene GetClientScene(IClientAPI client) |
176 | // { | 227 | // { |
177 | // foreach (Scene s in m_scenes) | 228 | // foreach (Scene s in m_scenes) |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index dfba3ff..e2f525c 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -40,6 +40,7 @@ using Nini.Config; | |||
40 | using OpenMetaverse; | 40 | using OpenMetaverse; |
41 | using OpenMetaverse.Imaging; | 41 | using OpenMetaverse.Imaging; |
42 | using OpenMetaverse.StructuredData; | 42 | using OpenMetaverse.StructuredData; |
43 | using Mono.Addins; | ||
43 | using OpenSim.Framework; | 44 | using OpenSim.Framework; |
44 | using OpenSim.Framework.Capabilities; | 45 | using OpenSim.Framework.Capabilities; |
45 | using OpenSim.Framework.Monitoring; | 46 | using OpenSim.Framework.Monitoring; |
@@ -55,6 +56,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
55 | 56 | ||
56 | namespace OpenSim.Region.CoreModules.World.WorldMap | 57 | namespace OpenSim.Region.CoreModules.World.WorldMap |
57 | { | 58 | { |
59 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldMapModule")] | ||
58 | public class WorldMapModule : INonSharedRegionModule, IWorldMapModule | 60 | public class WorldMapModule : INonSharedRegionModule, IWorldMapModule |
59 | { | 61 | { |
60 | private static readonly ILog m_log = | 62 | private static readonly ILog m_log = |