aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs29
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs54
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs53
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs54
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs48
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs41
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs61
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs63
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs61
-rw-r--r--OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs55
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs40
-rw-r--r--OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs103
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs83
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs31
-rw-r--r--OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs100
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs60
-rw-r--r--OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs36
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs37
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs41
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs51
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs4
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs58
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs212
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs96
-rw-r--r--OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs45
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs35
-rw-r--r--OpenSim/Region/DataSnapshot/DataSnapshotManager.cs55
-rw-r--r--OpenSim/Region/Framework/Interfaces/ICloudModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEmailModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISunModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWindModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs32
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs72
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs47
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs64
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs28
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs30
-rw-r--r--OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs28
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs28
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs41
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs33
73 files changed, 861 insertions, 1780 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index 7012037..1077f4a 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -27,7 +27,6 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Mono.Addins;
31using Nini.Config; 30using Nini.Config;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
@@ -36,8 +35,7 @@ using OpenSim.Region.Framework.Scenes;
36 35
37namespace OpenSim.Region.CoreModules.Agent.AssetTransaction 36namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
38{ 37{
39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 38 public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions
40 public class AssetTransactionModule : ISharedRegionModule, IAgentAssetTransactions
41 { 39 {
42 private readonly Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>(); 40 private readonly Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>();
43 private bool m_dumpAssetsToFile = false; 41 private bool m_dumpAssetsToFile = false;
@@ -61,14 +59,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
61 //m_log.Debug("creating AgentAssetTransactionModule"); 59 //m_log.Debug("creating AgentAssetTransactionModule");
62 } 60 }
63 61
64 #region ISharedRegionModule Members 62 #region IRegionModule Members
65 63
66 public void Initialise(IConfigSource config) 64 public void Initialise(Scene scene, IConfigSource config)
67 {
68
69 }
70
71 public void AddRegion(Scene scene)
72 { 65 {
73 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) 66 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
74 { 67 {
@@ -86,23 +79,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
86 m_scene = scene; 79 m_scene = scene;
87 } 80 }
88 81
89 public Type ReplaceableInterface
90 {
91 get { return null; }
92 }
93
94 public void RegionLoaded(Scene scene)
95 {
96 }
97
98 public void RemoveRegion(Scene scene)
99 {
100 if (RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
101 RegisteredScenes.Remove(scene.RegionInfo.RegionID);
102 scene.UnregisterModuleInterface<IAgentAssetTransactions>(this);
103 scene.EventManager.OnNewClient -= NewClient;
104 }
105
106 public void PostInitialise() 82 public void PostInitialise()
107 { 83 {
108 } 84 }
@@ -116,6 +92,11 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
116 get { return "AgentTransactionModule"; } 92 get { return "AgentTransactionModule"; }
117 } 93 }
118 94
95 public bool IsSharedModule
96 {
97 get { return true; }
98 }
99
119 #endregion 100 #endregion
120 101
121 public void NewClient(IClientAPI client) 102 public void NewClient(IClientAPI client)
diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
index 886173f..2a1355b 100644
--- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
69 69
70 public void RemoveRegion(Scene scene) 70 public void RemoveRegion(Scene scene)
71 { 71 {
72 scene.UnregisterModuleInterface<ICapabilitiesModule>(this); 72 m_scene.UnregisterModuleInterface<ICapabilitiesModule>(this);
73 } 73 }
74 74
75 public void PostInitialise() {} 75 public void PostInitialise() {}
diff --git a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs
index f7f2eff..bfe2a71 100644
--- a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Text; 31using System.Text;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
@@ -37,27 +36,21 @@ using OpenSim.Region.Framework.Scenes;
37 36
38namespace OpenSim.Region.CoreModules.Agent.IPBan 37namespace OpenSim.Region.CoreModules.Agent.IPBan
39{ 38{
40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 39 public class IPBanModule : IRegionModule
41 public class IPBanModule : ISharedRegionModule
42 { 40 {
43 #region Implementation of ISharedRegionModule 41 #region Implementation of IRegionModule
44 42
45 private List<string> m_bans = new List<string>(); 43 private List<string> m_bans = new List<string>();
46 private Dictionary<Scene, SceneBanner> SceneBanners = new Dictionary<Scene, SceneBanner>();
47 44
48 public void Initialise(IConfigSource source) 45 public void Initialise(Scene scene, IConfigSource source)
49 { 46 {
50 } 47 new SceneBanner(scene, m_bans);
51
52 public void AddRegion(Scene scene)
53 {
54 SceneBanners.Add(scene, new SceneBanner(scene, m_bans));
55 48
56 lock (m_bans) 49 lock (m_bans)
57 { 50 {
58 foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans) 51 foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans)
59 { 52 {
60 if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) 53 if (!String.IsNullOrEmpty(ban.BannedHostIPMask))
61 m_bans.Add(ban.BannedHostIPMask); 54 m_bans.Add(ban.BannedHostIPMask);
62 if (!String.IsNullOrEmpty(ban.BannedHostNameMask)) 55 if (!String.IsNullOrEmpty(ban.BannedHostNameMask))
63 m_bans.Add(ban.BannedHostNameMask); 56 m_bans.Add(ban.BannedHostNameMask);
@@ -65,12 +58,7 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
65 } 58 }
66 } 59 }
67 60
68 public Type ReplaceableInterface 61 public void PostInitialise()
69 {
70 get { return null; }
71 }
72
73 public void RegionLoaded(Scene scene)
74 { 62 {
75 if (File.Exists("bans.txt")) 63 if (File.Exists("bans.txt"))
76 { 64 {
@@ -82,18 +70,9 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
82 } 70 }
83 } 71 }
84 72
85 public void RemoveRegion(Scene scene)
86 {
87 if(SceneBanners.ContainsKey(scene))
88 SceneBanners.Remove(scene);
89 }
90
91 public void PostInitialise()
92 {
93 }
94
95 public void Close() 73 public void Close()
96 { 74 {
75
97 } 76 }
98 77
99 public string Name 78 public string Name
@@ -101,6 +80,11 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan
101 get { return "IPBanModule"; } 80 get { return "IPBanModule"; }
102 } 81 }
103 82
83 public bool IsSharedModule
84 {
85 get { return true; }
86 }
87
104 #endregion 88 #endregion
105 89
106 /// <summary> 90 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs
index c4d84cb..71ff28c 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Threading; 31using System.Threading;
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenSim.Framework; 35using OpenSim.Framework;
@@ -42,8 +41,7 @@ using OpenSim.Services.Interfaces;
42 41
43namespace OpenSim.Region.CoreModules.Agent.TextureDownload 42namespace OpenSim.Region.CoreModules.Agent.TextureDownload
44{ 43{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 44 public class TextureDownloadModule : IRegionModule
46 public class TextureDownloadModule : INonSharedRegionModule
47 { 45 {
48 private static readonly ILog m_log 46 private static readonly ILog m_log
49 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -67,14 +65,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
67 { 65 {
68 } 66 }
69 67
70 #region INonSharedRegionModule Members 68 #region IRegionModule Members
71 69
72 public void Initialise(IConfigSource config) 70 public void Initialise(Scene scene, IConfigSource config)
73 {
74 }
75
76 public void AddRegion(Scene scene)
77 { 71 {
72
78 if (m_scene == null) 73 if (m_scene == null)
79 { 74 {
80 //m_log.Debug("Creating Texture download module"); 75 //m_log.Debug("Creating Texture download module");
@@ -95,23 +90,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
95 } 90 }
96 } 91 }
97 92
98 public Type ReplaceableInterface 93 public void PostInitialise()
99 {
100 get { return null; }
101 }
102
103 public void RegionLoaded(Scene scene)
104 { 94 {
105 } 95 }
106 96
107 public void RemoveRegion(Scene scene)
108 {
109 if(m_scenes.Contains(scene))
110 m_scenes.Remove(scene);
111 scene.EventManager.OnNewClient -= NewClient;
112 scene.EventManager.OnRemovePresence -= EventManager_OnRemovePresence;
113 }
114
115 public void Close() 97 public void Close()
116 { 98 {
117 } 99 }
@@ -121,6 +103,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
121 get { return "TextureDownloadModule"; } 103 get { return "TextureDownloadModule"; }
122 } 104 }
123 105
106 public bool IsSharedModule
107 {
108 get { return false; }
109 }
110
124 #endregion 111 #endregion
125 112
126 /// <summary> 113 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index ff87493..7ac8bed 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -32,7 +32,6 @@ using System.Reflection;
32using System.Text; 32using System.Text;
33using System.Threading; 33using System.Threading;
34using log4net; 34using log4net;
35using Mono.Addins;
36using Nini.Config; 35using Nini.Config;
37using OpenMetaverse; 36using OpenMetaverse;
38using OpenMetaverse.Imaging; 37using OpenMetaverse.Imaging;
@@ -46,8 +45,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
46{ 45{
47 public delegate void J2KDecodeDelegate(UUID assetID); 46 public delegate void J2KDecodeDelegate(UUID assetID);
48 47
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 public class J2KDecoderModule : IRegionModule, IJ2KDecoder
50 public class J2KDecoderModule : ISharedRegionModule, IJ2KDecoder
51 { 49 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 51
@@ -60,19 +58,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
60 /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary> 58 /// <summary>Reference to a scene (doesn't matter which one as long as it can load the cache module)</summary>
61 private Scene m_scene; 59 private Scene m_scene;
62 60
63 #region ISharedRegionModule 61 #region IRegionModule
64 62
65 public string Name { get { return "J2KDecoderModule"; } } 63 public string Name { get { return "J2KDecoderModule"; } }
66 64 public bool IsSharedModule { get { return true; } }
67 public J2KDecoderModule()
68 {
69 }
70 65
71 public void Initialise(IConfigSource source) 66 public J2KDecoderModule()
72 { 67 {
73 } 68 }
74 69
75 public void AddRegion(Scene scene) 70 public void Initialise(Scene scene, IConfigSource source)
76 { 71 {
77 if (m_scene == null) 72 if (m_scene == null)
78 m_scene = scene; 73 m_scene = scene;
@@ -80,30 +75,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
80 scene.RegisterModuleInterface<IJ2KDecoder>(this); 75 scene.RegisterModuleInterface<IJ2KDecoder>(this);
81 } 76 }
82 77
83 public Type ReplaceableInterface
84 {
85 get { return null; }
86 }
87
88 public void RegionLoaded(Scene scene)
89 {
90 m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
91 }
92
93 public void RemoveRegion(Scene scene)
94 {
95 scene.UnregisterModuleInterface<IJ2KDecoder>(this);
96 }
97
98 public void PostInitialise() 78 public void PostInitialise()
99 { 79 {
80 m_cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
100 } 81 }
101 82
102 public void Close() 83 public void Close()
103 { 84 {
104 } 85 }
105 86
106 #endregion 87 #endregion IRegionModule
107 88
108 #region IJ2KDecoder 89 #region IJ2KDecoder
109 90
diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
index d062361..ef7dce8 100644
--- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs
@@ -27,7 +27,6 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Mono.Addins;
31using Nini.Config; 30using Nini.Config;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
@@ -36,8 +35,7 @@ using OpenSim.Region.Framework.Scenes;
36 35
37namespace OpenSim.Region.CoreModules.Agent.Xfer 36namespace OpenSim.Region.CoreModules.Agent.Xfer
38{ 37{
39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 38 public class XferModule : IRegionModule, IXfer
40 public class XferModule : INonSharedRegionModule, IXfer
41 { 39 {
42 private Scene m_scene; 40 private Scene m_scene;
43 private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>(); 41 private Dictionary<string, XferRequest> Requests = new Dictionary<string, XferRequest>();
@@ -54,13 +52,9 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
54 public DateTime timeStamp; 52 public DateTime timeStamp;
55 } 53 }
56 54
57 #region INonSharedRegionModule Members 55 #region IRegionModule Members
58 56
59 public void Initialise(IConfigSource config) 57 public void Initialise(Scene scene, IConfigSource config)
60 {
61 }
62
63 public void AddRegion(Scene scene)
64 { 58 {
65 m_scene = scene; 59 m_scene = scene;
66 m_scene.EventManager.OnNewClient += NewClient; 60 m_scene.EventManager.OnNewClient += NewClient;
@@ -68,21 +62,10 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
68 m_scene.RegisterModuleInterface<IXfer>(this); 62 m_scene.RegisterModuleInterface<IXfer>(this);
69 } 63 }
70 64
71 public Type ReplaceableInterface 65 public void PostInitialise()
72 {
73 get { return null; }
74 }
75
76 public void RegionLoaded(Scene scene)
77 { 66 {
78 } 67 }
79 68
80 public void RemoveRegion(Scene scene)
81 {
82 scene.EventManager.OnNewClient -= NewClient;
83 scene.UnregisterModuleInterface<IXfer>(this);
84 }
85
86 public void Close() 69 public void Close()
87 { 70 {
88 } 71 }
@@ -92,6 +75,11 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
92 get { return "XferModule"; } 75 get { return "XferModule"; }
93 } 76 }
94 77
78 public bool IsSharedModule
79 {
80 get { return false; }
81 }
82
95 #endregion 83 #endregion
96 84
97 #region IXfer Members 85 #region IXfer Members
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 6bbbd56..35c59aa 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using log4net; 30using log4net;
31using Mono.Addins;
32using Nini.Config; 31using Nini.Config;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenSim.Framework; 33using OpenSim.Framework;
@@ -39,8 +38,7 @@ using OpenSim.Services.Interfaces;
39 38
40namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory 39namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
41{ 40{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 41 public class AvatarFactoryModule : IAvatarFactory, IRegionModule
43 public class AvatarFactoryModule : IAvatarFactory, ISharedRegionModule
44 { 42 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 private Scene m_scene = null; 44 private Scene m_scene = null;
@@ -77,16 +75,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
77 return appearance; 75 return appearance;
78 } 76 }
79 77
80 public void Initialise(IConfigSource source) 78 public void Initialise(Scene scene, IConfigSource source)
81 {
82 }
83
84 public Type ReplaceableInterface
85 {
86 get { return null; }
87 }
88
89 public void AddRegion(Scene scene)
90 { 79 {
91 scene.RegisterModuleInterface<IAvatarFactory>(this); 80 scene.RegisterModuleInterface<IAvatarFactory>(this);
92 scene.EventManager.OnNewClient += NewClient; 81 scene.EventManager.OnNewClient += NewClient;
@@ -95,18 +84,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
95 { 84 {
96 m_scene = scene; 85 m_scene = scene;
97 } 86 }
98 }
99 87
100 public void RegionLoaded(Scene scene)
101 {
102 } 88 }
103 89
104 public void RemoveRegion(Scene scene)
105 {
106 scene.UnregisterModuleInterface<IAvatarFactory>(this);
107 scene.EventManager.OnNewClient -= NewClient;
108 }
109
110 public void PostInitialise() 90 public void PostInitialise()
111 { 91 {
112 } 92 }
@@ -120,6 +100,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
120 get { return "Default Avatar Factory"; } 100 get { return "Default Avatar Factory"; }
121 } 101 }
122 102
103 public bool IsSharedModule
104 {
105 get { return false; }
106 }
107
123 public void NewClient(IClientAPI client) 108 public void NewClient(IClientAPI client)
124 { 109 {
125 client.OnAvatarNowWearing += AvatarIsWearing; 110 client.OnAvatarNowWearing += AvatarIsWearing;
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index b7d12aa..61b6d65 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -27,7 +27,6 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Mono.Addins;
31using Nini.Config; 30using Nini.Config;
32using OpenSim.Region.Framework.Interfaces; 31using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
@@ -35,8 +34,7 @@ using OpenMetaverse;
35 34
36namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule 35namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
37{ 36{
38 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 37 public class CombatModule : IRegionModule
39 public class CombatModule : ISharedRegionModule
40 { 38 {
41 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 40
@@ -55,17 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
55 /// </summary> 53 /// </summary>
56 /// <param name="scene"></param> 54 /// <param name="scene"></param>
57 /// <param name="config"></param> 55 /// <param name="config"></param>
58 public void Initialise(IConfigSource config) 56 public void Initialise(Scene scene, IConfigSource config)
59 {
60
61 }
62
63 public Type ReplaceableInterface
64 {
65 get { return null; }
66 }
67
68 public void AddRegion(Scene scene)
69 { 57 {
70 lock (m_scenel) 58 lock (m_scenel)
71 { 59 {
@@ -83,17 +71,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
83 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 71 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
84 } 72 }
85 73
86 public void RegionLoaded(Scene scene)
87 {
88 }
89
90 public void RemoveRegion(Scene scene)
91 {
92 scene.EventManager.OnAvatarKilled -= KillAvatar;
93 scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
94 m_scenel.Remove(scene.RegionInfo.RegionHandle);
95 }
96
97 public void PostInitialise() 74 public void PostInitialise()
98 { 75 {
99 } 76 }
@@ -107,6 +84,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
107 get { return "CombatModule"; } 84 get { return "CombatModule"; }
108 } 85 }
109 86
87 public bool IsSharedModule
88 {
89 get { return true; }
90 }
91
110 private void KillAvatar(uint killerObjectLocalID, ScenePresence DeadAvatar) 92 private void KillAvatar(uint killerObjectLocalID, ScenePresence DeadAvatar)
111 { 93 {
112 if (killerObjectLocalID == 0) 94 if (killerObjectLocalID == 0)
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index ecffc7a..72ec869 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -25,11 +25,9 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using System.Reflection; 29using System.Reflection;
31using log4net; 30using log4net;
32using Mono.Addins;
33using Nini.Config; 31using Nini.Config;
34using OpenMetaverse; 32using OpenMetaverse;
35using OpenSim.Framework; 33using OpenSim.Framework;
@@ -39,46 +37,28 @@ using OpenSim.Region.Framework.Scenes;
39 37
40namespace OpenSim.Region.CoreModules.Avatar.Dialog 38namespace OpenSim.Region.CoreModules.Avatar.Dialog
41{ 39{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 40 public class DialogModule : IRegionModule, IDialogModule
43 public class DialogModule : ISharedRegionModule, IDialogModule
44 { 41 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 43
47 protected Scene m_scene; 44 protected Scene m_scene;
48 45
49 public void Initialise(IConfigSource source) 46 public void Initialise(Scene scene, IConfigSource source)
50 {
51 }
52
53 public Type ReplaceableInterface
54 {
55 get { return null; }
56 }
57
58 public void AddRegion(Scene scene)
59 { 47 {
60 m_scene = scene; 48 m_scene = scene;
61 m_scene.RegisterModuleInterface<IDialogModule>(this); 49 m_scene.RegisterModuleInterface<IDialogModule>(this);
62 50
63 m_scene.AddCommand( 51 m_scene.AddCommand(
64 this, "alert", "alert <first> <last> <message>", "Send an alert to a user", HandleAlertConsoleCommand); 52 this, "alert", "alert <first> <last> <message>", "Send an alert to a user", HandleAlertConsoleCommand);
65 53
66 m_scene.AddCommand( 54 m_scene.AddCommand(
67 this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand); 55 this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand);
68 } 56 }
69 57
70 public void RegionLoaded(Scene scene) 58 public void PostInitialise() {}
71 {
72 }
73
74 public void RemoveRegion(Scene scene)
75 {
76 scene.UnregisterModuleInterface<IDialogModule>(this);
77 }
78
79 public void PostInitialise() { }
80 public void Close() {} 59 public void Close() {}
81 public string Name { get { return "Dialog Module"; } } 60 public string Name { get { return "Dialog Module"; } }
61 public bool IsSharedModule { get { return false; } }
82 62
83 public void SendAlertToUser(IClientAPI client, string message) 63 public void SendAlertToUser(IClientAPI client, string message)
84 { 64 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 7254180..086d4fe 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using log4net; 33using log4net;
34using Mono.Addins;
35using Nini.Config; 34using Nini.Config;
36using Nwc.XmlRpc; 35using Nwc.XmlRpc;
37using OpenMetaverse; 36using OpenMetaverse;
@@ -82,8 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
82 - Terminate Friendship messages (single) 81 - Terminate Friendship messages (single)
83 */ 82 */
84 83
85 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 84 public class FriendsModule : IRegionModule, IFriendsModule
86 public class FriendsModule : ISharedRegionModule, IFriendsModule
87 { 85 {
88 private class Transaction 86 private class Transaction
89 { 87 {
@@ -113,23 +111,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
113 111
114 private IGridService m_gridServices = null; 112 private IGridService m_gridServices = null;
115 113
116 #region ISharedRegionModule Members 114 #region IRegionModule Members
117 115
118 public void Initialise(IConfigSource config) 116 public void Initialise(Scene scene, IConfigSource config)
119 {
120
121 }
122
123 public void PostInitialise()
124 {
125 }
126
127 public Type ReplaceableInterface
128 {
129 get { return null; }
130 }
131
132 public void AddRegion(Scene scene)
133 { 117 {
134 lock (m_scenes) 118 lock (m_scenes)
135 { 119 {
@@ -144,9 +128,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
144 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) 128 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle))
145 m_scenes[scene.RegionInfo.RegionHandle] = scene; 129 m_scenes[scene.RegionInfo.RegionHandle] = scene;
146 } 130 }
147 131
148 scene.RegisterModuleInterface<IFriendsModule>(this); 132 scene.RegisterModuleInterface<IFriendsModule>(this);
149 133
150 scene.EventManager.OnNewClient += OnNewClient; 134 scene.EventManager.OnNewClient += OnNewClient;
151 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 135 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
152 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 136 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
@@ -154,34 +138,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
154 scene.EventManager.OnClientClosed += ClientClosed; 138 scene.EventManager.OnClientClosed += ClientClosed;
155 } 139 }
156 140
157 public void RegionLoaded(Scene scene) 141 public void PostInitialise()
158 { 142 {
159 if (m_scenes.Count > 0) 143 if (m_scenes.Count > 0)
160 { 144 {
161 m_TransferModule = scene.RequestModuleInterface<IMessageTransferModule>(); 145 m_TransferModule = m_initialScene.RequestModuleInterface<IMessageTransferModule>();
162 m_gridServices = scene.GridService; 146 m_gridServices = m_initialScene.GridService;
163 } 147 }
164 if (m_TransferModule == null) 148 if (m_TransferModule == null)
165 m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work"); 149 m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work");
166 } 150 }
167 151
168 public void RemoveRegion(Scene scene)
169 {
170 MainServer.Instance.RemoveXmlRPCHandler("presence_update_bulk");
171 MainServer.Instance.RemoveXmlRPCHandler("terminate_friend");
172
173 if (m_scenes.ContainsKey(scene.RegionInfo.RegionHandle))
174 m_scenes.Remove(scene.RegionInfo.RegionHandle);
175
176 scene.UnregisterModuleInterface<IFriendsModule>(this);
177
178 scene.EventManager.OnNewClient -= OnNewClient;
179 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
180 scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
181 scene.EventManager.OnMakeChildAgent -= MakeChildAgent;
182 scene.EventManager.OnClientClosed -= ClientClosed;
183 }
184
185 public void Close() 152 public void Close()
186 { 153 {
187 } 154 }
@@ -191,6 +158,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
191 get { return "FriendsModule"; } 158 get { return "FriendsModule"; }
192 } 159 }
193 160
161 public bool IsSharedModule
162 {
163 get { return true; }
164 }
165
194 #endregion 166 #endregion
195 167
196 #region IInterregionFriendsComms 168 #region IInterregionFriendsComms
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
index c306f94..8ce5092 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
@@ -25,10 +25,8 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Reflection; 28using System.Reflection;
30using log4net; 29using log4net;
31using Mono.Addins;
32using Nini.Config; 30using Nini.Config;
33using OpenMetaverse; 31using OpenMetaverse;
34using OpenSim.Framework; 32using OpenSim.Framework;
@@ -39,41 +37,23 @@ using OpenSim.Services.Interfaces;
39 37
40namespace OpenSim.Region.CoreModules.Avatar.Gestures 38namespace OpenSim.Region.CoreModules.Avatar.Gestures
41{ 39{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 40 public class GesturesModule : IRegionModule
43 public class GesturesModule : INonSharedRegionModule
44 { 41 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 43
47 protected Scene m_scene; 44 protected Scene m_scene;
48 45
49 public void Initialise(IConfigSource source) 46 public void Initialise(Scene scene, IConfigSource source)
50 {
51 }
52
53 public Type ReplaceableInterface
54 {
55 get { return null; }
56 }
57
58 public void AddRegion(Scene scene)
59 { 47 {
60 m_scene = scene; 48 m_scene = scene;
49
61 m_scene.EventManager.OnNewClient += OnNewClient; 50 m_scene.EventManager.OnNewClient += OnNewClient;
62 } 51 }
63
64 public void RegionLoaded(Scene scene)
65 {
66 }
67
68 public void RemoveRegion(Scene scene)
69 {
70 if(m_scene == scene)
71 m_scene = null;
72 scene.EventManager.OnNewClient -= OnNewClient;
73 }
74 52
53 public void PostInitialise() {}
75 public void Close() {} 54 public void Close() {}
76 public string Name { get { return "Gestures Module"; } } 55 public string Name { get { return "Gestures Module"; } }
56 public bool IsSharedModule { get { return false; } }
77 57
78 private void OnNewClient(IClientAPI client) 58 private void OnNewClient(IClientAPI client)
79 { 59 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 3914f2e..50171a3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -25,9 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using Mono.Addins;
31using Nini.Config; 29using Nini.Config;
32using OpenMetaverse; 30using OpenMetaverse;
33using OpenSim.Framework; 31using OpenSim.Framework;
@@ -36,8 +34,7 @@ using OpenSim.Region.Framework.Interfaces;
36 34
37namespace OpenSim.Region.CoreModules.Avatar.Gods 35namespace OpenSim.Region.CoreModules.Avatar.Gods
38{ 36{
39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 37 public class GodsModule : IRegionModule, IGodsModule
40 public class GodsModule : INonSharedRegionModule, IGodsModule
41 { 38 {
42 /// <summary>Special UUID for actions that apply to all agents</summary> 39 /// <summary>Special UUID for actions that apply to all agents</summary>
43 private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); 40 private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb");
@@ -45,34 +42,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
45 protected Scene m_scene; 42 protected Scene m_scene;
46 protected IDialogModule m_dialogModule; 43 protected IDialogModule m_dialogModule;
47 44
48 public void Initialise(IConfigSource source) 45 public void Initialise(Scene scene, IConfigSource source)
49 {
50
51 }
52
53 public Type ReplaceableInterface
54 {
55 get { return null; }
56 }
57
58 public void AddRegion(Scene scene)
59 { 46 {
60 m_scene = scene; 47 m_scene = scene;
61 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); 48 m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>();
62 m_scene.RegisterModuleInterface<IGodsModule>(this); 49 m_scene.RegisterModuleInterface<IGodsModule>(this);
63 } 50 }
64
65 public void RegionLoaded(Scene scene)
66 {
67 }
68
69 public void RemoveRegion(Scene scene)
70 {
71 scene.UnregisterModuleInterface<IGodsModule>(this);
72 }
73 51
52 public void PostInitialise() {}
74 public void Close() {} 53 public void Close() {}
75 public string Name { get { return "Gods Module"; } } 54 public string Name { get { return "Gods Module"; } }
55 public bool IsSharedModule { get { return false; } }
76 56
77 public void RequestGodlikePowers( 57 public void RequestGodlikePowers(
78 UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) 58 UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
index 7ff8d30..31363e5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs
@@ -25,11 +25,9 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using System.Reflection; 29using System.Reflection;
31using log4net; 30using log4net;
32using Mono.Addins;
33using Nini.Config; 31using Nini.Config;
34using OpenMetaverse; 32using OpenMetaverse;
35using OpenSim.Framework; 33using OpenSim.Framework;
@@ -38,8 +36,7 @@ using OpenSim.Region.Framework.Scenes;
38 36
39namespace OpenSim.Region.CoreModules.Avatar.Groups 37namespace OpenSim.Region.CoreModules.Avatar.Groups
40{ 38{
41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 39 public class GroupsModule : IRegionModule
42 public class GroupsModule : ISharedRegionModule
43 { 40 {
44 private static readonly ILog m_log = 41 private static readonly ILog m_log =
45 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -58,9 +55,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
58 private static GroupMembershipData osGroup = 55 private static GroupMembershipData osGroup =
59 new GroupMembershipData(); 56 new GroupMembershipData();
60 57
61 #region ISharedRegionModule Members 58 #region IRegionModule Members
62 59
63 public void Initialise(IConfigSource config) 60 public void Initialise(Scene scene, IConfigSource config)
64 { 61 {
65 IConfig groupsConfig = config.Configs["Groups"]; 62 IConfig groupsConfig = config.Configs["Groups"];
66 63
@@ -79,15 +76,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
79 if (groupsConfig.GetString("Module", "Default") != "Default") 76 if (groupsConfig.GetString("Module", "Default") != "Default")
80 return; 77 return;
81 } 78 }
82 }
83
84 public Type ReplaceableInterface
85 {
86 get { return null; }
87 }
88 79
89 public void AddRegion(Scene scene)
90 {
91 lock (m_SceneList) 80 lock (m_SceneList)
92 { 81 {
93 if (!m_SceneList.Contains(scene)) 82 if (!m_SceneList.Contains(scene))
@@ -110,19 +99,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
110 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 99 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
111 } 100 }
112 101
113 public void RegionLoaded(Scene scene)
114 {
115 }
116
117 public void RemoveRegion(Scene scene)
118 {
119 if (m_SceneList.Contains(scene))
120 m_SceneList.Remove(scene);
121 scene.EventManager.OnNewClient -= OnNewClient;
122 scene.EventManager.OnClientClosed -= OnClientClosed;
123 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
124 }
125
126 public void PostInitialise() 102 public void PostInitialise()
127 { 103 {
128 } 104 }
@@ -147,6 +123,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups
147 get { return "GroupsModule"; } 123 get { return "GroupsModule"; }
148 } 124 }
149 125
126 public bool IsSharedModule
127 {
128 get { return true; }
129 }
130
150 #endregion 131 #endregion
151 132
152 private void OnNewClient(IClientAPI client) 133 private void OnNewClient(IClientAPI client)
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
index e1bde4b..9a68749 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -24,12 +24,9 @@
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
28using System;
29using System.Collections.Generic; 27using System.Collections.Generic;
30using System.Reflection; 28using System.Reflection;
31using log4net; 29using log4net;
32using Mono.Addins;
33using Nini.Config; 30using Nini.Config;
34using OpenMetaverse; 31using OpenMetaverse;
35using OpenSim.Framework; 32using OpenSim.Framework;
@@ -39,8 +36,7 @@ using OpenSim.Region.Framework.Scenes;
39 36
40namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 37namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
41{ 38{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 39 public class InstantMessageModule : IRegionModule
43 public class InstantMessageModule : ISharedRegionModule
44 { 40 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 42
@@ -51,11 +47,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
51 47
52 private readonly List<Scene> m_scenes = new List<Scene>(); 48 private readonly List<Scene> m_scenes = new List<Scene>();
53 49
54 #region ISharedRegionModule Members 50 #region IRegionModule Members
55 51
56 private IMessageTransferModule m_TransferModule = null; 52 private IMessageTransferModule m_TransferModule = null;
57 53
58 public void Initialise(IConfigSource config) 54 public void Initialise(Scene scene, IConfigSource config)
59 { 55 {
60 if (config.Configs["Messaging"] != null) 56 if (config.Configs["Messaging"] != null)
61 { 57 {
@@ -66,15 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
66 } 62 }
67 63
68 m_enabled = true; 64 m_enabled = true;
69 }
70
71 public Type ReplaceableInterface
72 {
73 get { return null; }
74 }
75 65
76 public void AddRegion(Scene scene)
77 {
78 lock (m_scenes) 66 lock (m_scenes)
79 { 67 {
80 if (!m_scenes.Contains(scene)) 68 if (!m_scenes.Contains(scene))
@@ -86,27 +74,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
86 } 74 }
87 } 75 }
88 76
89 public void RegionLoaded(Scene scene)
90 {
91 if (!m_enabled)
92 return;
93
94 m_TransferModule =
95 m_scenes[0].RequestModuleInterface<IMessageTransferModule>();
96
97 if (m_TransferModule == null)
98 m_log.Error("[INSTANT MESSAGE]: No message transfer module, " +
99 "IM will not work!");
100 }
101
102 public void RemoveRegion(Scene scene)
103 {
104 if (m_scenes.Contains(scene))
105 m_scenes.Remove(scene);
106 scene.EventManager.OnClientConnect -= OnClientConnect;
107 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
108 }
109
110 void OnClientConnect(IClientCore client) 77 void OnClientConnect(IClientCore client)
111 { 78 {
112 IClientIM clientIM; 79 IClientIM clientIM;
@@ -118,6 +85,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
118 85
119 public void PostInitialise() 86 public void PostInitialise()
120 { 87 {
88 if (!m_enabled)
89 return;
90
91 m_TransferModule =
92 m_scenes[0].RequestModuleInterface<IMessageTransferModule>();
93
94 if (m_TransferModule == null)
95 m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+
96 "IM will not work!");
121 } 97 }
122 98
123 public void Close() 99 public void Close()
@@ -129,6 +105,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
129 get { return "InstantMessageModule"; } 105 get { return "InstantMessageModule"; }
130 } 106 }
131 107
108 public bool IsSharedModule
109 {
110 get { return true; }
111 }
112
132 #endregion 113 #endregion
133 114
134 public void OnInstantMessage(IClientAPI client, GridInstantMessage im) 115 public void OnInstantMessage(IClientAPI client, GridInstantMessage im)
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 16bdfdd..e5159b3 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using Nwc.XmlRpc; 34using Nwc.XmlRpc;
36using OpenMetaverse; 35using OpenMetaverse;
@@ -41,8 +40,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41 40
42namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
43{ 42{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 43 public class MessageTransferModule : IRegionModule, IMessageTransferModule
45 public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule
46 { 44 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 46
@@ -52,9 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
52 protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>(); 50 protected Dictionary<UUID, ulong> m_UserRegionMap = new Dictionary<UUID, ulong>();
53 51
54 public event UndeliveredMessage OnUndeliveredMessage; 52 public event UndeliveredMessage OnUndeliveredMessage;
55 private bool m_enabled = true;
56 53
57 public virtual void Initialise(IConfigSource config) 54 public virtual void Initialise(Scene scene, IConfigSource config)
58 { 55 {
59 IConfig cnf = config.Configs["Messaging"]; 56 IConfig cnf = config.Configs["Messaging"];
60 if (cnf != null && cnf.GetString( 57 if (cnf != null && cnf.GetString(
@@ -62,49 +59,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
62 "MessageTransferModule") 59 "MessageTransferModule")
63 { 60 {
64 m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); 61 m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration");
65 m_enabled = false; 62 return;
66 } 63 }
67 64
68 cnf = config.Configs["Startup"]; 65 cnf = config.Configs["Startup"];
69 if (cnf != null) 66 if (cnf != null)
70 m_Gridmode = cnf.GetBoolean("gridmode", false); 67 m_Gridmode = cnf.GetBoolean("gridmode", false);
71 }
72 68
73 public Type ReplaceableInterface 69 // m_Enabled = true;
74 {
75 get { return null; }
76 }
77 70
78 public void AddRegion(Scene scene) 71 lock (m_Scenes)
79 {
80 if (m_enabled)
81 { 72 {
82 lock (m_Scenes) 73 if (m_Scenes.Count == 0)
83 { 74 {
84 if (m_Scenes.Count == 0) 75 MainServer.Instance.AddXmlRPCHandler(
85 { 76 "grid_instant_message", processXMLRPCGridInstantMessage);
86 MainServer.Instance.AddXmlRPCHandler(
87 "grid_instant_message", processXMLRPCGridInstantMessage);
88 }
89
90 m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active");
91 scene.RegisterModuleInterface<IMessageTransferModule>(this);
92 m_Scenes.Add(scene);
93 } 77 }
94 }
95 }
96 78
97 public void RegionLoaded(Scene scene) 79 m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active");
98 { 80 scene.RegisterModuleInterface<IMessageTransferModule>(this);
99 } 81 m_Scenes.Add(scene);
100 82 }
101 public void RemoveRegion(Scene scene)
102 {
103 if (m_Scenes.Contains(scene))
104 m_Scenes.Remove(scene);
105 MainServer.Instance.RemoveXmlRPCHandler(
106 "grid_instant_message");
107 scene.UnregisterModuleInterface<IMessageTransferModule>(this);
108 } 83 }
109 84
110 public virtual void PostInitialise() 85 public virtual void PostInitialise()
@@ -120,6 +95,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
120 get { return "MessageTransferModule"; } 95 get { return "MessageTransferModule"; }
121 } 96 }
122 97
98 public virtual bool IsSharedModule
99 {
100 get { return true; }
101 }
102
123 public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) 103 public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result)
124 { 104 {
125 UUID toAgentID = new UUID(im.toAgentID); 105 UUID toAgentID = new UUID(im.toAgentID);
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs
index 3570495..2d4a635 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs
@@ -28,7 +28,6 @@ using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection; 29using System.Reflection;
30using log4net; 30using log4net;
31using Mono.Addins;
32using Nini.Config; 31using Nini.Config;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenSim.Framework; 33using OpenSim.Framework;
@@ -40,8 +39,7 @@ using OpenSim.Region.Framework.Scenes;
40 39
41namespace OpenSim.Region.CoreModules.Avatar.MuteList 40namespace OpenSim.Region.CoreModules.Avatar.MuteList
42{ 41{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 42 public class MuteListModule : IRegionModule
44 public class MuteListModule : ISharedRegionModule
45 { 43 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 45
@@ -49,7 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
49 private List<Scene> m_SceneList = new List<Scene>(); 47 private List<Scene> m_SceneList = new List<Scene>();
50 private string m_RestURL = String.Empty; 48 private string m_RestURL = String.Empty;
51 49
52 public void Initialise(IConfigSource config) 50 public void Initialise(Scene scene, IConfigSource config)
53 { 51 {
54 if (!enabled) 52 if (!enabled)
55 return; 53 return;
@@ -68,24 +66,19 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
68 enabled = false; 66 enabled = false;
69 return; 67 return;
70 } 68 }
71 m_RestURL = cnf.GetString("MuteListURL", "");
72 if (m_RestURL == "")
73 {
74 m_log.Error("[MUTE LIST] Module was enabled, but no URL is given, disabling");
75 enabled = false;
76 return;
77 }
78 }
79 69
80 public Type ReplaceableInterface
81 {
82 get { return null; }
83 }
84
85 public void AddRegion(Scene scene)
86 {
87 lock (m_SceneList) 70 lock (m_SceneList)
88 { 71 {
72 if (m_SceneList.Count == 0)
73 {
74 m_RestURL = cnf.GetString("MuteListURL", "");
75 if (m_RestURL == "")
76 {
77 m_log.Error("[MUTE LIST] Module was enabled, but no URL is given, disabling");
78 enabled = false;
79 return;
80 }
81 }
89 if (!m_SceneList.Contains(scene)) 82 if (!m_SceneList.Contains(scene))
90 m_SceneList.Add(scene); 83 m_SceneList.Add(scene);
91 84
@@ -93,18 +86,6 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
93 } 86 }
94 } 87 }
95 88
96 public void RegionLoaded(Scene scene)
97 {
98 }
99
100 public void RemoveRegion(Scene scene)
101 {
102 if (m_SceneList.Contains(scene))
103 m_SceneList.Remove(scene);
104
105 scene.EventManager.OnNewClient -= OnNewClient;
106 }
107
108 public void PostInitialise() 89 public void PostInitialise()
109 { 90 {
110 if (!enabled) 91 if (!enabled)
@@ -121,6 +102,11 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList
121 get { return "MuteListModule"; } 102 get { return "MuteListModule"; }
122 } 103 }
123 104
105 public bool IsSharedModule
106 {
107 get { return true; }
108 }
109
124 public void Close() 110 public void Close()
125 { 111 {
126 } 112 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 6c4d0bf..ff38b6f 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -28,7 +28,6 @@ using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection; 29using System.Reflection;
30using log4net; 30using log4net;
31using Mono.Addins;
32using Nini.Config; 31using Nini.Config;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenSim.Framework; 33using OpenSim.Framework;
@@ -41,8 +40,7 @@ using OpenSim.Region.Framework.Scenes;
41 40
42namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 41namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
43{ 42{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 43 public class OfflineMessageModule : IRegionModule
45 public class OfflineMessageModule : ISharedRegionModule
46 { 44 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 46
@@ -51,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
51 private string m_RestURL = String.Empty; 49 private string m_RestURL = String.Empty;
52 private bool m_ForwardOfflineGroupMessages = true; 50 private bool m_ForwardOfflineGroupMessages = true;
53 51
54 public void Initialise(IConfigSource config) 52 public void Initialise(Scene scene, IConfigSource config)
55 { 53 {
56 if (!enabled) 54 if (!enabled)
57 return; 55 return;
@@ -85,23 +83,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
85 return; 83 return;
86 } 84 }
87 } 85 }
88 } 86 if (!m_SceneList.Contains(scene))
89 } 87 m_SceneList.Add(scene);
90
91 public Type ReplaceableInterface
92 {
93 get { return null; }
94 }
95 88
96 public void AddRegion(Scene scene) 89 scene.EventManager.OnNewClient += OnNewClient;
97 { 90 }
98 if (!m_SceneList.Contains(scene))
99 m_SceneList.Add(scene);
100
101 scene.EventManager.OnNewClient += OnNewClient;
102 } 91 }
103 92
104 public void RegionLoaded(Scene scene) 93 public void PostInitialise()
105 { 94 {
106 if (!enabled) 95 if (!enabled)
107 return; 96 return;
@@ -131,22 +120,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
131 m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled"); 120 m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled");
132 } 121 }
133 122
134 public void RemoveRegion(Scene scene)
135 {
136 if (m_SceneList.Contains(scene))
137 m_SceneList.Remove(scene);
138 scene.EventManager.OnNewClient -= OnNewClient;
139 }
140
141 public void PostInitialise()
142 {
143 }
144
145 public string Name 123 public string Name
146 { 124 {
147 get { return "OfflineMessageModule"; } 125 get { return "OfflineMessageModule"; }
148 } 126 }
149 127
128 public bool IsSharedModule
129 {
130 get { return true; }
131 }
132
150 public void Close() 133 public void Close()
151 { 134 {
152 } 135 }
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
index f5498f4..f5ab454 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs
@@ -24,14 +24,11 @@
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
28using System;
29using System.Collections; 27using System.Collections;
30using System.Collections.Generic; 28using System.Collections.Generic;
31using System.Net; 29using System.Net;
32using System.Reflection; 30using System.Reflection;
33using log4net; 31using log4net;
34using Mono.Addins;
35using Nini.Config; 32using Nini.Config;
36using Nwc.XmlRpc; 33using Nwc.XmlRpc;
37using OpenMetaverse; 34using OpenMetaverse;
@@ -42,8 +39,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
42 39
43namespace OpenSim.Region.CoreModules.Avatar.InstantMessage 40namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
44{ 41{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 42 public class PresenceModule : IRegionModule, IPresenceModule
46 public class PresenceModule : ISharedRegionModule, IPresenceModule
47 { 43 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 45
@@ -63,7 +59,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
63 public event PresenceChange OnPresenceChange; 59 public event PresenceChange OnPresenceChange;
64 public event BulkPresenceData OnBulkPresenceData; 60 public event BulkPresenceData OnBulkPresenceData;
65 61
66 public void Initialise(IConfigSource config) 62 public void Initialise(Scene scene, IConfigSource config)
67 { 63 {
68 lock (m_Scenes) 64 lock (m_Scenes)
69 { 65 {
@@ -82,38 +78,28 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
82 m_Gridmode = cnf.GetBoolean("gridmode", false); 78 m_Gridmode = cnf.GetBoolean("gridmode", false);
83 79
84 m_Enabled = true; 80 m_Enabled = true;
85 }
86 }
87 }
88 81
89 public Type ReplaceableInterface 82 m_initialScene = scene;
90 { 83 }
91 get { return null; }
92 }
93 84
94 public void AddRegion(Scene scene)
95 {
96 if (m_Enabled)
97 {
98 m_initialScene = scene;
99 if (m_Gridmode) 85 if (m_Gridmode)
100 NotifyMessageServerOfStartup(scene); 86 NotifyMessageServerOfStartup(scene);
101 87
102 m_Scenes.Add(scene); 88 m_Scenes.Add(scene);
89 }
103 90
104 scene.RegisterModuleInterface<IPresenceModule>(this); 91 scene.RegisterModuleInterface<IPresenceModule>(this);
105 92
106 scene.EventManager.OnNewClient += OnNewClient; 93 scene.EventManager.OnNewClient += OnNewClient;
107 scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; 94 scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene;
108 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; 95 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
109 }
110 } 96 }
111 97
112 public void RegionLoaded(Scene scene) 98 public void PostInitialise()
113 { 99 {
114 } 100 }
115 101
116 public void RemoveRegion(Scene scene) 102 public void Close()
117 { 103 {
118 if (!m_Gridmode || !m_Enabled) 104 if (!m_Gridmode || !m_Enabled)
119 return; 105 return;
@@ -130,28 +116,21 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
130 } 116 }
131 } 117 }
132 118
133 NotifyMessageServerOfShutdown(scene); 119 lock (m_Scenes)
134 if(m_Scenes.Contains(scene)) 120 {
135 m_Scenes.Remove(scene); 121 foreach (Scene scene in m_Scenes)
136 122 NotifyMessageServerOfShutdown(scene);
137 scene.UnregisterModuleInterface<IPresenceModule>(this); 123 }
138
139 scene.EventManager.OnNewClient -= OnNewClient;
140 scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene;
141 scene.EventManager.OnMakeChildAgent -= OnMakeChildAgent;
142 }
143
144 public void PostInitialise()
145 {
146 } 124 }
147 125
148 public void Close() 126 public string Name
149 { 127 {
128 get { return "PresenceModule"; }
150 } 129 }
151 130
152 public string Name 131 public bool IsSharedModule
153 { 132 {
154 get { return "PresenceModule"; } 133 get { return true; }
155 } 134 }
156 135
157 public void RequestBulkPresenceData(UUID[] users) 136 public void RequestBulkPresenceData(UUID[] users)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index a04ab22..ecd60bd 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenSim.Framework; 35using OpenSim.Framework;
@@ -42,11 +41,10 @@ using OpenSim.Services.Interfaces;
42 41
43namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver 42namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
44{ 43{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
46 /// <summary> 44 /// <summary>
47 /// This module loads and saves OpenSimulator inventory archives 45 /// This module loads and saves OpenSimulator inventory archives
48 /// </summary> 46 /// </summary>
49 public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule 47 public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule
50 { 48 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 50
@@ -84,28 +82,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
84 DisablePresenceChecks = disablePresenceChecks; 82 DisablePresenceChecks = disablePresenceChecks;
85 } 83 }
86 84
87 public void Initialise(IConfigSource source) 85 public void Initialise(Scene scene, IConfigSource source)
88 {
89
90 }
91
92 public Type ReplaceableInterface
93 {
94 get { return null; }
95 }
96
97 public void AddRegion(Scene scene)
98 { 86 {
99 if (m_scenes.Count == 0) 87 if (m_scenes.Count == 0)
100 { 88 {
101 scene.RegisterModuleInterface<IInventoryArchiverModule>(this); 89 scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
102 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; 90 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
103 91
104 scene.AddCommand( 92 scene.AddCommand(
105 this, "load iar", 93 this, "load iar",
106 "load iar <first> <last> <inventory path> <password> [<archive path>]", 94 "load iar <first> <last> <inventory path> <password> [<archive path>]",
107 "Load user inventory archive.", HandleLoadInvConsoleCommand); 95 "Load user inventory archive.", HandleLoadInvConsoleCommand);
108 96
109 scene.AddCommand( 97 scene.AddCommand(
110 this, "save iar", 98 this, "save iar",
111 "save iar <first> <last> <inventory path> <password> [<archive path>]", 99 "save iar <first> <last> <inventory path> <password> [<archive path>]",
@@ -113,21 +101,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
113 101
114 m_aScene = scene; 102 m_aScene = scene;
115 } 103 }
116 104
117 m_scenes[scene.RegionInfo.RegionID] = scene; 105 m_scenes[scene.RegionInfo.RegionID] = scene;
118 } 106 }
119 107
120 public void RegionLoaded(Scene scene)
121 {
122 }
123
124 public void RemoveRegion(Scene scene)
125 {
126 scene.UnregisterModuleInterface<IInventoryArchiverModule>(this);
127 if(m_scenes.ContainsKey(scene.RegionInfo.RegionID))
128 m_scenes.Remove(scene.RegionInfo.RegionID);
129 }
130
131 public void PostInitialise() {} 108 public void PostInitialise() {}
132 109
133 public void Close() {} 110 public void Close() {}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 44906b4..d9a021f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
@@ -40,8 +39,7 @@ using OpenSim.Services.Interfaces;
40 39
41namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer 40namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
42{ 41{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 42 public class InventoryTransferModule : IInventoryTransferModule, IRegionModule
44 public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule
45 { 43 {
46 private static readonly ILog m_log 44 private static readonly ILog m_log
47 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -52,11 +50,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
52 new Dictionary<UUID, Scene>(); 50 new Dictionary<UUID, Scene>();
53 51
54 private IMessageTransferModule m_TransferModule = null; 52 private IMessageTransferModule m_TransferModule = null;
55 private bool m_enabled = true;
56 53
57 #region ISharedRegionModule Members 54 #region IRegionModule Members
58 55
59 public void Initialise(IConfigSource config) 56 public void Initialise(Scene scene, IConfigSource config)
60 { 57 {
61 if (config.Configs["Messaging"] != null) 58 if (config.Configs["Messaging"] != null)
62 { 59 {
@@ -65,61 +62,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
65 if (config.Configs["Messaging"].GetString( 62 if (config.Configs["Messaging"].GetString(
66 "InventoryTransferModule", "InventoryTransferModule") != 63 "InventoryTransferModule", "InventoryTransferModule") !=
67 "InventoryTransferModule") 64 "InventoryTransferModule")
68 m_enabled = false; 65 return;
69 } 66 }
70 }
71
72 public Type ReplaceableInterface
73 {
74 get { return null; }
75 }
76 67
77 public void AddRegion(Scene scene) 68 if (!m_Scenelist.Contains(scene))
78 {
79 if (m_enabled)
80 { 69 {
81 if (!m_Scenelist.Contains(scene)) 70 m_Scenelist.Add(scene);
82 {
83 m_Scenelist.Add(scene);
84 71
85 scene.RegisterModuleInterface<IInventoryTransferModule>(this); 72 scene.RegisterModuleInterface<IInventoryTransferModule>(this);
86 73
87 scene.EventManager.OnNewClient += OnNewClient; 74 scene.EventManager.OnNewClient += OnNewClient;
88 scene.EventManager.OnClientClosed += ClientLoggedOut; 75 scene.EventManager.OnClientClosed += ClientLoggedOut;
89 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 76 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
90 }
91 } 77 }
92 } 78 }
93 79
94 public void RegionLoaded(Scene scene) 80 public void PostInitialise()
95 { 81 {
96 if (m_enabled) 82 if (m_Scenelist.Count > 0)
97 { 83 {
98 if (m_Scenelist.Count > 0) 84 m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
99 { 85 if (m_TransferModule == null)
100 m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>(); 86 m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only");
101 if (m_TransferModule == null)
102 m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only");
103 }
104 } 87 }
105 } 88 }
106 89
107 public void RemoveRegion(Scene scene)
108 {
109 if (m_Scenelist.Contains(scene))
110 m_Scenelist.Remove(scene);
111
112 scene.UnregisterModuleInterface<IInventoryTransferModule>(this);
113
114 scene.EventManager.OnNewClient -= OnNewClient;
115 scene.EventManager.OnClientClosed -= ClientLoggedOut;
116 scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage;
117 }
118
119 public void PostInitialise()
120 {
121 }
122
123 public void Close() 90 public void Close()
124 { 91 {
125 } 92 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
index 973d27f..261bd6c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
@@ -38,72 +37,36 @@ using OpenSim.Region.Framework.Scenes;
38 37
39namespace OpenSim.Region.CoreModules.Avatar.Lure 38namespace OpenSim.Region.CoreModules.Avatar.Lure
40{ 39{
41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 40 public class LureModule : IRegionModule
42 public class LureModule : ISharedRegionModule
43 { 41 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 43
46 private readonly List<Scene> m_scenes = new List<Scene>(); 44 private readonly List<Scene> m_scenes = new List<Scene>();
47 45
48 private bool m_enabled = true;
49
50 private IMessageTransferModule m_TransferModule = null; 46 private IMessageTransferModule m_TransferModule = null;
51 47
52 public void Initialise(IConfigSource config) 48 public void Initialise(Scene scene, IConfigSource config)
53 { 49 {
54 if (config.Configs["Messaging"] != null) 50 if (config.Configs["Messaging"] != null)
55 { 51 {
56 if (config.Configs["Messaging"].GetString( 52 if (config.Configs["Messaging"].GetString(
57 "LureModule", "LureModule") != 53 "LureModule", "LureModule") !=
58 "LureModule") 54 "LureModule")
59 m_enabled = false; 55 return;
60 } 56 }
61 }
62
63 public Type ReplaceableInterface
64 {
65 get { return null; }
66 }
67 57
68 public void AddRegion(Scene scene) 58 lock (m_scenes)
69 {
70 if (m_enabled)
71 { 59 {
72 lock (m_scenes) 60 if (!m_scenes.Contains(scene))
73 { 61 {
74 if (!m_scenes.Contains(scene)) 62 m_scenes.Add(scene);
75 { 63 scene.EventManager.OnNewClient += OnNewClient;
76 m_scenes.Add(scene); 64 scene.EventManager.OnIncomingInstantMessage +=
77 scene.EventManager.OnNewClient += OnNewClient; 65 OnGridInstantMessage;
78 scene.EventManager.OnIncomingInstantMessage +=
79 OnGridInstantMessage;
80 }
81 } 66 }
82 } 67 }
83 } 68 }
84 69
85 public void RegionLoaded(Scene scene)
86 {
87 if (m_enabled)
88 {
89 m_TransferModule =
90 m_scenes[0].RequestModuleInterface<IMessageTransferModule>();
91
92 if (m_TransferModule == null)
93 m_log.Error("[INSTANT MESSAGE]: No message transfer module, " +
94 "lures will not work!");
95 }
96 }
97
98 public void RemoveRegion(Scene scene)
99 {
100 if (m_scenes.Contains(scene))
101 m_scenes.Remove(scene);
102 scene.EventManager.OnNewClient -= OnNewClient;
103 scene.EventManager.OnIncomingInstantMessage -=
104 OnGridInstantMessage;
105 }
106
107 void OnNewClient(IClientAPI client) 70 void OnNewClient(IClientAPI client)
108 { 71 {
109 client.OnInstantMessage += OnInstantMessage; 72 client.OnInstantMessage += OnInstantMessage;
@@ -113,6 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
113 76
114 public void PostInitialise() 77 public void PostInitialise()
115 { 78 {
79 m_TransferModule =
80 m_scenes[0].RequestModuleInterface<IMessageTransferModule>();
81
82 if (m_TransferModule == null)
83 m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+
84 "lures will not work!");
116 } 85 }
117 86
118 public void Close() 87 public void Close()
diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
index 748b42c..63a93aa 100644
--- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
+++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenMetaverse.StructuredData; 34using OpenMetaverse.StructuredData;
@@ -42,54 +41,24 @@ using Caps=OpenSim.Framework.Capabilities.Caps;
42 41
43namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps 42namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
44{ 43{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 44 public class ObjectAdd : IRegionModule
46 public class ObjectAdd : ISharedRegionModule
47 { 45 {
48 private static readonly ILog m_log = 46 private static readonly ILog m_log =
49 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private Scene m_scene; 48 private Scene m_scene;
51 #region ISharedRegionModule Members 49 #region IRegionModule Members
52 50
53 public void Initialise(IConfigSource pSource) 51 public void Initialise(Scene pScene, IConfigSource pSource)
54 { 52 {
55 53 m_scene = pScene;
56 }
57
58 public Type ReplaceableInterface
59 {
60 get { return null; }
61 }
62
63 public void AddRegion(Scene scene)
64 {
65 m_scene = scene;
66 m_scene.EventManager.OnRegisterCaps += RegisterCaps; 54 m_scene.EventManager.OnRegisterCaps += RegisterCaps;
67 } 55 }
68 56
69 public void RegionLoaded(Scene scene)
70 {
71 }
72
73 public void RemoveRegion(Scene scene)
74 {
75 scene.EventManager.OnRegisterCaps -= RegisterCaps;
76 }
77
78 public void PostInitialise() 57 public void PostInitialise()
79 { 58 {
80 59
81 } 60 }
82 61
83 public void Close()
84 {
85
86 }
87
88 public string Name
89 {
90 get { return "ObjectAddModule"; }
91 }
92
93 public void RegisterCaps(UUID agentID, Caps caps) 62 public void RegisterCaps(UUID agentID, Caps caps)
94 { 63 {
95 UUID capuuid = UUID.Random(); 64 UUID capuuid = UUID.Random();
@@ -379,6 +348,22 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
379 Array.Reverse(resultbytes); 348 Array.Reverse(resultbytes);
380 return String.Format("<binary encoding=\"base64\">{0}</binary>",Convert.ToBase64String(resultbytes)); 349 return String.Format("<binary encoding=\"base64\">{0}</binary>",Convert.ToBase64String(resultbytes));
381 } 350 }
351
352 public void Close()
353 {
354
355 }
356
357 public string Name
358 {
359 get { return "ObjectAddModule"; }
360 }
361
362 public bool IsSharedModule
363 {
364 get { return false; }
365 }
366
382 #endregion 367 #endregion
383 } 368 }
384} 369}
diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
index 7fcb0e1..8cf58c6 100644
--- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs
@@ -30,7 +30,6 @@ using System.Collections;
30using System.Globalization; 30using System.Globalization;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenSim.Framework; 35using OpenSim.Framework;
@@ -39,17 +38,20 @@ using OpenSim.Region.Framework.Scenes;
39 38
40namespace OpenSim.Region.CoreModules.Avatar.Profiles 39namespace OpenSim.Region.CoreModules.Avatar.Profiles
41{ 40{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 41 public class AvatarProfilesModule : IRegionModule
43 public class AvatarProfilesModule : INonSharedRegionModule
44 { 42 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 private Scene m_scene; 44 private Scene m_scene;
47 private IProfileModule m_profileModule = null; 45 private IProfileModule m_profileModule = null;
48 private bool m_enabled = true; 46 private bool m_enabled = true;
49 47
50 #region INonSharedRegionModule Members 48 public AvatarProfilesModule()
49 {
50 }
51 51
52 public void Initialise(IConfigSource config) 52 #region IRegionModule Members
53
54 public void Initialise(Scene scene, IConfigSource config)
53 { 55 {
54 IConfig profileConfig = config.Configs["Profile"]; 56 IConfig profileConfig = config.Configs["Profile"];
55 if (profileConfig != null) 57 if (profileConfig != null)
@@ -60,31 +62,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles
60 return; 62 return;
61 } 63 }
62 } 64 }
63 }
64
65 public Type ReplaceableInterface
66 {
67 get { return null; }
68 }
69 65
70 public void AddRegion(Scene scene)
71 {
72 m_scene = scene; 66 m_scene = scene;
73 m_scene.EventManager.OnNewClient += NewClient; 67 m_scene.EventManager.OnNewClient += NewClient;
74 } 68 }
75 69
76 public void RegionLoaded(Scene scene) 70 public void PostInitialise()
77 { 71 {
78 if (!m_enabled) 72 if (!m_enabled)
79 return; 73 return;
80 m_profileModule = m_scene.RequestModuleInterface<IProfileModule>(); 74 m_profileModule = m_scene.RequestModuleInterface<IProfileModule>();
81 } 75 }
82 76
83 public void RemoveRegion(Scene scene)
84 {
85 scene.EventManager.OnNewClient -= NewClient;
86 }
87
88 public void Close() 77 public void Close()
89 { 78 {
90 } 79 }
@@ -94,6 +83,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles
94 get { return "AvatarProfilesModule"; } 83 get { return "AvatarProfilesModule"; }
95 } 84 }
96 85
86 public bool IsSharedModule
87 {
88 get { return false; }
89 }
90
97 #endregion 91 #endregion
98 92
99 public void NewClient(IClientAPI client) 93 public void NewClient(IClientAPI client)
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 1ee6f0d..0c6cb1b 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -32,7 +32,6 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using log4net; 34using log4net;
35using Mono.Addins;
36using Nini.Config; 35using Nini.Config;
37using OpenMetaverse; 36using OpenMetaverse;
38using OpenMetaverse.Packets; 37using OpenMetaverse.Packets;
@@ -53,13 +52,11 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
53 public OSDMap body; 52 public OSDMap body;
54 } 53 }
55 54
56 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 55 public class EventQueueGetModule : IEventQueue, IRegionModule
57 public class EventQueueGetModule : IEventQueue, INonSharedRegionModule
58 { 56 {
59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 57 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60 protected Scene m_scene = null; 58 protected Scene m_scene = null;
61 private IConfigSource m_gConfig; 59 private IConfigSource m_gConfig;
62 private IConfig m_startupConfig;
63 bool enabledYN = false; 60 bool enabledYN = false;
64 61
65 private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>(); 62 private Dictionary<UUID, int> m_ids = new Dictionary<UUID, int>();
@@ -68,31 +65,23 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
68 private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>(); 65 private Dictionary<UUID, UUID> m_QueueUUIDAvatarMapping = new Dictionary<UUID, UUID>();
69 private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>(); 66 private Dictionary<UUID, UUID> m_AvatarQueueUUIDMapping = new Dictionary<UUID, UUID>();
70 67
71 #region INonSharedRegionModule methods 68 #region IRegionModule methods
72 public virtual void Initialise(IConfigSource config) 69 public virtual void Initialise(Scene scene, IConfigSource config)
73 { 70 {
74 m_gConfig = config; 71 m_gConfig = config;
75 72
76 m_startupConfig = m_gConfig.Configs["Startup"]; 73 IConfig startupConfig = m_gConfig.Configs["Startup"];
77 }
78 74
79 public Type ReplaceableInterface 75 ReadConfigAndPopulate(scene, startupConfig, "Startup");
80 {
81 get { return null; }
82 }
83
84 public void AddRegion(Scene scene)
85 {
86 ReadConfigAndPopulate(scene, m_startupConfig, "Startup");
87 76
88 if (enabledYN) 77 if (enabledYN)
89 { 78 {
90 m_scene = scene; 79 m_scene = scene;
91 scene.RegisterModuleInterface<IEventQueue>(this); 80 scene.RegisterModuleInterface<IEventQueue>(this);
92 81
93 // Register fallback handler 82 // Register fallback handler
94 // Why does EQG Fail on region crossings! 83 // Why does EQG Fail on region crossings!
95 84
96 //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack); 85 //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack);
97 86
98 scene.EventManager.OnNewClient += OnNewClient; 87 scene.EventManager.OnNewClient += OnNewClient;
@@ -110,19 +99,16 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
110 { 99 {
111 m_gConfig = null; 100 m_gConfig = null;
112 } 101 }
102
113 } 103 }
114 104
115 public void RegionLoaded(Scene scene) 105 private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p)
116 {
117 }
118
119 public void RemoveRegion(Scene scene)
120 { 106 {
107 enabledYN = startupConfig.GetBoolean("EventQueue", true);
121 } 108 }
122 109
123 private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p) 110 public void PostInitialise()
124 { 111 {
125 enabledYN = startupConfig.GetBoolean("EventQueue", true);
126 } 112 }
127 113
128 public virtual void Close() 114 public virtual void Close()
@@ -134,6 +120,10 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
134 get { return "EventQueueGetModule"; } 120 get { return "EventQueueGetModule"; }
135 } 121 }
136 122
123 public bool IsSharedModule
124 {
125 get { return false; }
126 }
137 #endregion 127 #endregion
138 128
139 /// <summary> 129 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
index 0135d33..f15f8f6 100644
--- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
@@ -25,12 +25,10 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections; 28using System.Collections;
30using System.Collections.Generic; 29using System.Collections.Generic;
31using System.Reflection; 30using System.Reflection;
32using log4net; 31using log4net;
33using Mono.Addins;
34using Nini.Config; 32using Nini.Config;
35using OpenMetaverse; 33using OpenMetaverse;
36using OpenSim.Framework; 34using OpenSim.Framework;
@@ -41,8 +39,7 @@ using OpenSim.Region.Framework.Scenes;
41 39
42namespace OpenSim.Region.CoreModules.Framework.Monitoring 40namespace OpenSim.Region.CoreModules.Framework.Monitoring
43{ 41{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 42 public class MonitorModule : IRegionModule
45 public class MonitorModule : INonSharedRegionModule
46 { 43 {
47 private Scene m_scene; 44 private Scene m_scene;
48 private readonly List<IMonitor> m_monitors = new List<IMonitor>(); 45 private readonly List<IMonitor> m_monitors = new List<IMonitor>();
@@ -65,19 +62,9 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
65 } 62 }
66 } 63 }
67 64
68 #region Implementation of INonSharedRegionModule 65 #region Implementation of IRegionModule
69 66
70 public void Initialise(IConfigSource source) 67 public void Initialise(Scene scene, IConfigSource source)
71 {
72
73 }
74
75 public Type ReplaceableInterface
76 {
77 get { return null; }
78 }
79
80 public void AddRegion(Scene scene)
81 { 68 {
82 m_scene = scene; 69 m_scene = scene;
83 70
@@ -90,51 +77,6 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
90 MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage); 77 MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage);
91 } 78 }
92 79
93 public void RegionLoaded(Scene scene)
94 {
95 m_monitors.Add(new AgentCountMonitor(m_scene));
96 m_monitors.Add(new ChildAgentCountMonitor(m_scene));
97 m_monitors.Add(new GCMemoryMonitor());
98 m_monitors.Add(new ObjectCountMonitor(m_scene));
99 m_monitors.Add(new PhysicsFrameMonitor(m_scene));
100 m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene));
101 m_monitors.Add(new PWSMemoryMonitor());
102 m_monitors.Add(new ThreadCountMonitor());
103 m_monitors.Add(new TotalFrameMonitor(m_scene));
104 m_monitors.Add(new EventFrameMonitor(m_scene));
105 m_monitors.Add(new LandFrameMonitor(m_scene));
106 m_monitors.Add(new LastFrameTimeMonitor(m_scene));
107
108 m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor));
109
110 foreach (IAlert alert in m_alerts)
111 {
112 alert.OnTriggerAlert += OnTriggerAlert;
113 }
114 }
115
116 public void RemoveRegion(Scene scene)
117 {
118 MainServer.Instance.RemoveHTTPHandler("", "/monitorstats/" + m_scene.RegionInfo.RegionID + "/");
119 m_monitors.Clear();
120
121 foreach (IAlert alert in m_alerts)
122 {
123 alert.OnTriggerAlert -= OnTriggerAlert;
124 }
125 m_alerts.Clear();
126 }
127
128 public void Close()
129 {
130
131 }
132
133 public string Name
134 {
135 get { return "Region Health Monitoring Module"; }
136 }
137
138 public Hashtable StatsPage(Hashtable request) 80 public Hashtable StatsPage(Hashtable request)
139 { 81 {
140 // If request was for a specific monitor 82 // If request was for a specific monitor
@@ -190,10 +132,49 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
190 return ereply; 132 return ereply;
191 } 133 }
192 134
135 public void PostInitialise()
136 {
137 m_monitors.Add(new AgentCountMonitor(m_scene));
138 m_monitors.Add(new ChildAgentCountMonitor(m_scene));
139 m_monitors.Add(new GCMemoryMonitor());
140 m_monitors.Add(new ObjectCountMonitor(m_scene));
141 m_monitors.Add(new PhysicsFrameMonitor(m_scene));
142 m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene));
143 m_monitors.Add(new PWSMemoryMonitor());
144 m_monitors.Add(new ThreadCountMonitor());
145 m_monitors.Add(new TotalFrameMonitor(m_scene));
146 m_monitors.Add(new EventFrameMonitor(m_scene));
147 m_monitors.Add(new LandFrameMonitor(m_scene));
148 m_monitors.Add(new LastFrameTimeMonitor(m_scene));
149
150 m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor));
151
152 foreach (IAlert alert in m_alerts)
153 {
154 alert.OnTriggerAlert += OnTriggerAlert;
155 }
156 }
157
193 void OnTriggerAlert(System.Type reporter, string reason, bool fatal) 158 void OnTriggerAlert(System.Type reporter, string reason, bool fatal)
194 { 159 {
195 m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); 160 m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")");
196 } 161 }
162
163 public void Close()
164 {
165
166 }
167
168 public string Name
169 {
170 get { return "Region Health Monitoring Module"; }
171 }
172
173 public bool IsSharedModule
174 {
175 get { return false; }
176 }
177
197 #endregion 178 #endregion
198 } 179 }
199} 180}
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
index f9c594b..0b54746 100644
--- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs
+++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.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 *
@@ -32,7 +32,6 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Text.RegularExpressions; 33using System.Text.RegularExpressions;
34using log4net; 34using log4net;
35using Mono.Addins;
36using Nini.Config; 35using Nini.Config;
37using OpenMetaverse; 36using OpenMetaverse;
38using Nwc.XmlRpc; 37using Nwc.XmlRpc;
@@ -47,8 +46,7 @@ using OpenSim.Region.Framework.Interfaces;
47 46
48namespace OpenSim.Region.CoreModules.Hypergrid 47namespace OpenSim.Region.CoreModules.Hypergrid
49{ 48{
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 49 public class HGStandaloneLoginModule : IRegionModule, ILoginServiceToRegionsConnector
51 public class HGStandaloneLoginModule : ISharedRegionModule, ILoginServiceToRegionsConnector
52 { 50 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 52
@@ -58,58 +56,47 @@ namespace OpenSim.Region.CoreModules.Hypergrid
58 protected bool m_enabled = false; // Module is only enabled if running in standalone mode 56 protected bool m_enabled = false; // Module is only enabled if running in standalone mode
59 57
60 protected HGLoginAuthService m_loginService; 58 protected HGLoginAuthService m_loginService;
61 private bool authenticate = true;
62 private string welcomeMessage = "Welcome to OpenSim";
63 private IConfig startupConfig;
64 private IConfig standaloneConfig;
65
66 #region ISharedRegionModule Members
67
68 public void Initialise(IConfigSource source)
69 {
70 startupConfig = source.Configs["Startup"];
71 standaloneConfig = source.Configs["StandAlone"];
72 if (standaloneConfig != null)
73 {
74 authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true);
75 welcomeMessage = standaloneConfig.GetString("welcome_message");
76 }
77 m_enabled = !startupConfig.GetBoolean("gridmode", false);
78 }
79
80 public Type ReplaceableInterface
81 {
82 get { return null; }
83 }
84 59
85 public void AddRegion(Scene scene) 60 #region IRegionModule Members
86 {
87 }
88 61
89 public void RegionLoaded(Scene scene) 62 public void Initialise(Scene scene, IConfigSource source)
90 { 63 {
91 if (m_firstScene == null) 64 if (m_firstScene == null)
92 { 65 {
93 m_firstScene = scene; 66 m_firstScene = scene;
94 67
68 IConfig startupConfig = source.Configs["Startup"];
69 if (startupConfig != null)
70 {
71 m_enabled = !startupConfig.GetBoolean("gridmode", false);
72 }
73
95 if (m_enabled) 74 if (m_enabled)
96 { 75 {
97 m_log.Debug("[HGLogin]: HGlogin module enabled"); 76 m_log.Debug("[HGLogin]: HGlogin module enabled");
77 bool authenticate = true;
78 string welcomeMessage = "Welcome to OpenSim";
79 IConfig standaloneConfig = source.Configs["StandAlone"];
80 if (standaloneConfig != null)
81 {
82 authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true);
83 welcomeMessage = standaloneConfig.GetString("welcome_message");
84 }
98 85
99 //TODO: fix casting. 86 //TODO: fix casting.
100 LibraryRootFolder rootFolder = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder; 87 LibraryRootFolder rootFolder = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder;
101 88
102 IHttpServer httpServer = MainServer.Instance; 89 IHttpServer httpServer = MainServer.Instance;
103 90
104 //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference 91 //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
105 m_loginService 92 m_loginService
106 = new HGLoginAuthService( 93 = new HGLoginAuthService(
107 (UserManagerBase)m_firstScene.CommsManager.UserAdminService, 94 (UserManagerBase)m_firstScene.CommsManager.UserAdminService,
108 welcomeMessage, 95 welcomeMessage,
109 m_firstScene.CommsManager.InterServiceInventoryService, 96 m_firstScene.CommsManager.InterServiceInventoryService,
110 m_firstScene.CommsManager.NetworkServersInfo, 97 m_firstScene.CommsManager.NetworkServersInfo,
111 authenticate, 98 authenticate,
112 rootFolder, 99 rootFolder,
113 this); 100 this);
114 101
115 httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); 102 httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod);
@@ -126,19 +113,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid
126 } 113 }
127 } 114 }
128 115
129 public void RemoveRegion(Scene scene)
130 {
131 if (scene == m_firstScene)
132 {
133 IHttpServer httpServer = MainServer.Instance;
134 httpServer.RemoveXmlRPCHandler("hg_login");
135 httpServer.RemoveXmlRPCHandler("check_auth_session");
136 httpServer.RemoveXmlRPCHandler("get_avatar_appearance");
137 httpServer.RemoveXmlRPCHandler("update_avatar_appearance");
138 }
139 m_scenes.Remove(scene);
140 }
141
142 public void PostInitialise() 116 public void PostInitialise()
143 { 117 {
144 118
@@ -154,6 +128,11 @@ namespace OpenSim.Region.CoreModules.Hypergrid
154 get { return "HGStandaloneLoginModule"; } 128 get { return "HGStandaloneLoginModule"; }
155 } 129 }
156 130
131 public bool IsSharedModule
132 {
133 get { return true; }
134 }
135
157 #endregion 136 #endregion
158 137
159 protected void AddScene(Scene scene) 138 protected void AddScene(Scene scene)
diff --git a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs
index 4534024..0f2ba32 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs
@@ -32,7 +32,6 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Text; 33using System.Text;
34using log4net; 34using log4net;
35using Mono.Addins;
36using Nini.Config; 35using Nini.Config;
37using Nwc.XmlRpc; 36using Nwc.XmlRpc;
38using OpenMetaverse; 37using OpenMetaverse;
@@ -43,8 +42,7 @@ using OpenSim.Region.Framework.Scenes;
43 42
44namespace OpenSim.Region.CoreModules.InterGrid 43namespace OpenSim.Region.CoreModules.InterGrid
45{ 44{
46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 45 public class OGSRadmin : IRegionModule
47 public class OGSRadmin : ISharedRegionModule
48 { 46 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 private readonly List<Scene> m_scenes = new List<Scene>(); 48 private readonly List<Scene> m_scenes = new List<Scene>();
@@ -58,6 +56,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
58 get { return "OGS Supporting RAdmin"; } 56 get { return "OGS Supporting RAdmin"; }
59 } 57 }
60 58
59
61 public void Initialise(IConfigSource source) 60 public void Initialise(IConfigSource source)
62 { 61 {
63 m_settings = source; 62 m_settings = source;
@@ -68,11 +67,6 @@ namespace OpenSim.Region.CoreModules.InterGrid
68 67
69 } 68 }
70 69
71 public Type ReplaceableInterface
72 {
73 get { return null; }
74 }
75
76 public void AddRegion(Scene scene) 70 public void AddRegion(Scene scene)
77 { 71 {
78 lock (m_scenes) 72 lock (m_scenes)
@@ -83,11 +77,15 @@ namespace OpenSim.Region.CoreModules.InterGrid
83 { 77 {
84 lock (m_scenes) 78 lock (m_scenes)
85 m_scenes.Remove(scene); 79 m_scenes.Remove(scene);
86 MainServer.Instance.RemoveXmlRPCHandler("grid_message");
87 } 80 }
88 81
89 public void RegionLoaded(Scene scene) 82 public void RegionLoaded(Scene scene)
90 { 83 {
84
85 }
86
87 public void PostInitialise()
88 {
91 if (m_settings.Configs["Startup"].GetBoolean("gridmode", false)) 89 if (m_settings.Configs["Startup"].GetBoolean("gridmode", false))
92 { 90 {
93 m_com = m_scenes[0].CommsManager; 91 m_com = m_scenes[0].CommsManager;
@@ -95,8 +93,21 @@ namespace OpenSim.Region.CoreModules.InterGrid
95 } 93 }
96 } 94 }
97 95
98 public void PostInitialise() 96 #endregion
97
98 #region IRegionModule
99
100 public void Initialise(Scene scene, IConfigSource source)
101 {
102 m_settings = source;
103
104 lock (m_scenes)
105 m_scenes.Add(scene);
106 }
107
108 public bool IsSharedModule
99 { 109 {
110 get { return true; }
100 } 111 }
101 112
102 #endregion 113 #endregion
diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
index 8bb0fa9..10a3232 100644
--- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs
@@ -35,7 +35,6 @@ using System.Security.Cryptography.X509Certificates;
35using System.Threading; 35using System.Threading;
36using System.Web; 36using System.Web;
37using log4net; 37using log4net;
38using Mono.Addins;
39using Nini.Config; 38using Nini.Config;
40using OpenMetaverse; 39using OpenMetaverse;
41using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
@@ -76,9 +75,8 @@ namespace OpenSim.Region.CoreModules.InterGrid
76 public bool visible_to_parent; 75 public bool visible_to_parent;
77 public string teleported_into_region; 76 public string teleported_into_region;
78 } 77 }
79 78
80 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 79 public class OpenGridProtocolModule : IRegionModule
81 public class OpenGridProtocolModule : ISharedRegionModule
82 { 80 {
83 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 81 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
84 private List<Scene> m_scene = new List<Scene>(); 82 private List<Scene> m_scene = new List<Scene>();
@@ -94,22 +92,21 @@ namespace OpenSim.Region.CoreModules.InterGrid
94 private bool httpSSL = false; 92 private bool httpSSL = false;
95 private uint httpsslport = 0; 93 private uint httpsslport = 0;
96 private bool GridMode = false; 94 private bool GridMode = false;
97 private bool m_enabled = false;
98 private IConfig cfg = null;
99 private IConfig httpcfg = null;
100 private IConfig startupcfg = null;
101
102 #region ISharedRegionModule Members
103 95
104 public void Initialise(IConfigSource config) 96 #region IRegionModule Members
97
98 public void Initialise(Scene scene, IConfigSource config)
105 { 99 {
100 bool enabled = false;
101 IConfig cfg = null;
102 IConfig httpcfg = null;
103 IConfig startupcfg = null;
106 try 104 try
107 { 105 {
108 cfg = config.Configs["OpenGridProtocol"]; 106 cfg = config.Configs["OpenGridProtocol"];
109 } 107 } catch (NullReferenceException)
110 catch (NullReferenceException)
111 { 108 {
112 m_enabled = false; 109 enabled = false;
113 } 110 }
114 111
115 try 112 try
@@ -131,15 +128,15 @@ namespace OpenSim.Region.CoreModules.InterGrid
131 128
132 if (startupcfg != null) 129 if (startupcfg != null)
133 { 130 {
134 GridMode = m_enabled = startupcfg.GetBoolean("gridmode", false); 131 GridMode = enabled = startupcfg.GetBoolean("gridmode", false);
135 } 132 }
136 133
137 if (cfg != null) 134 if (cfg != null)
138 { 135 {
139 m_enabled = cfg.GetBoolean("ogp_enabled", false); 136 enabled = cfg.GetBoolean("ogp_enabled", false);
140 LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); 137 LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL");
141 FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); 138 FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", "");
142 if (m_enabled) 139 if (enabled)
143 { 140 {
144 m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); 141 m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/");
145 lock (m_scene) 142 lock (m_scene)
@@ -168,61 +165,35 @@ namespace OpenSim.Region.CoreModules.InterGrid
168 } 165 }
169 166
170 } 167 }
168 // can't pick the region 'agent' because it would conflict with our agent domain handler
169 // a zero length region name would conflict with are base region seed cap
170 if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0)
171 {
172 MainServer.Instance.AddLLSDHandler(
173 "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()),
174 ProcessRegionDomainSeed);
175 }
176
177 if (!m_scene.Contains(scene))
178 m_scene.Add(scene);
171 } 179 }
172 } 180 }
173 } 181 }
174 } 182 lock (m_scene)
175
176 public Type ReplaceableInterface
177 {
178 get { return null; }
179 }
180
181 public void AddRegion(Scene scene)
182 {
183 if (m_enabled)
184 { 183 {
185 lock (m_scene) 184 if (m_scene.Count == 1)
186 { 185 {
187 if (m_scene.Count == 1) 186 if (httpcfg != null)
188 { 187 {
189 if (httpcfg != null) 188 httpSSL = httpcfg.GetBoolean("http_listener_ssl", false);
190 { 189 httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName);
191 httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); 190 if (httpsCN.Length == 0)
192 httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); 191 httpsCN = scene.RegionInfo.ExternalHostName;
193 if (httpsCN.Length == 0) 192 httpsslport = (uint)httpcfg.GetInt("http_listener_sslport",((int)scene.RegionInfo.HttpPort + 1));
194 httpsCN = scene.RegionInfo.ExternalHostName;
195 httpsslport = (uint)httpcfg.GetInt("http_listener_sslport", ((int)scene.RegionInfo.HttpPort + 1));
196 }
197 } 193 }
198 } 194 }
199 // can't pick the region 'agent' because it would conflict with our agent domain handler
200 // a zero length region name would conflict with are base region seed cap
201 if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0)
202 {
203 MainServer.Instance.AddLLSDHandler(
204 "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()),
205 ProcessRegionDomainSeed);
206 }
207
208 if (!m_scene.Contains(scene))
209 m_scene.Add(scene);
210 } 195 }
211 } 196 }
212
213 public void RegionLoaded(Scene scene)
214 {
215 }
216
217 public void RemoveRegion(Scene scene)
218 {
219 MainServer.Instance.RemoveLLSDHandler(
220 "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()),
221 ProcessRegionDomainSeed);
222
223 if (m_scene.Contains(scene))
224 m_scene.Remove(scene);
225 }
226 197
227 public void PostInitialise() 198 public void PostInitialise()
228 { 199 {
@@ -238,6 +209,11 @@ namespace OpenSim.Region.CoreModules.InterGrid
238 get { return "OpenGridProtocolModule"; } 209 get { return "OpenGridProtocolModule"; }
239 } 210 }
240 211
212 public bool IsSharedModule
213 {
214 get { return true; }
215 }
216
241 #endregion 217 #endregion
242 218
243 public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) 219 public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint)
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 40b7159..679c871 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.Drawing.Imaging; 31using System.Drawing.Imaging;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenMetaverse.Imaging; 34using OpenMetaverse.Imaging;
@@ -41,8 +40,7 @@ using System.Reflection;
41 40
42namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture 41namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
43{ 42{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 43 public class DynamicTextureModule : IRegionModule, IDynamicTextureManager
45 public class DynamicTextureModule : ISharedRegionModule, IDynamicTextureManager
46 { 44 {
47 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 46
@@ -212,14 +210,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
212 210
213 #endregion 211 #endregion
214 212
215 #region ISharedRegionModule Members 213 #region IRegionModule Members
216 214
217 public void Initialise(IConfigSource config) 215 public void Initialise(Scene scene, IConfigSource config)
218 {
219
220 }
221
222 public void AddRegion(Scene scene)
223 { 216 {
224 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) 217 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
225 { 218 {
@@ -228,24 +221,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
228 } 221 }
229 } 222 }
230 223
231 public Type ReplaceableInterface
232 {
233 get { return null; }
234 }
235
236 public void RegionLoaded(Scene scene)
237 {
238 }
239
240 public void RemoveRegion(Scene scene)
241 {
242 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
243 {
244 RegisteredScenes.Remove(scene.RegionInfo.RegionID);
245 scene.UnregisterModuleInterface<IDynamicTextureManager>(this);
246 }
247 }
248
249 public void PostInitialise() 224 public void PostInitialise()
250 { 225 {
251 } 226 }
@@ -259,6 +234,11 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
259 get { return "DynamicTextureModule"; } 234 get { return "DynamicTextureModule"; }
260 } 235 }
261 236
237 public bool IsSharedModule
238 {
239 get { return true; }
240 }
241
262 #endregion 242 #endregion
263 243
264 #region Nested type: DynamicTextureUpdater 244 #region Nested type: DynamicTextureUpdater
@@ -378,18 +358,18 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
378 // tmptex.DefaultTexture.Fullbright = true; 358 // tmptex.DefaultTexture.Fullbright = true;
379 359
380 part.UpdateTexture(tmptex); 360 part.UpdateTexture(tmptex);
381 } 361 }
382 362
383 if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0)) 363 if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0))
384 { 364 {
385 if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString()); 365 if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString());
386 if (oldAsset != null) 366 if (oldAsset != null)
387 { 367 {
388 if (oldAsset.Temporary == true) 368 if (oldAsset.Temporary == true)
389 { 369 {
390 scene.AssetService.Delete(oldID.ToString()); 370 scene.AssetService.Delete(oldID.ToString());
391 } 371 }
392 } 372 }
393 } 373 }
394 } 374 }
395 375
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
index d6ed468..83f004d 100644
--- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs
@@ -32,7 +32,6 @@ using System.Text.RegularExpressions;
32using DotNetOpenMail; 32using DotNetOpenMail;
33using DotNetOpenMail.SmtpAuth; 33using DotNetOpenMail.SmtpAuth;
34using log4net; 34using log4net;
35using Mono.Addins;
36using Nini.Config; 35using Nini.Config;
37using OpenMetaverse; 36using OpenMetaverse;
38using OpenSim.Framework; 37using OpenSim.Framework;
@@ -41,7 +40,6 @@ using OpenSim.Region.Framework.Scenes;
41 40
42namespace OpenSim.Region.CoreModules.Scripting.EmailModules 41namespace OpenSim.Region.CoreModules.Scripting.EmailModules
43{ 42{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class EmailModule : IEmailModule 43 public class EmailModule : IEmailModule
46 { 44 {
47 // 45 //
@@ -96,7 +94,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
96 } 94 }
97 } 95 }
98 96
99 public void Initialise(IConfigSource config) 97 public void Initialise(Scene scene, IConfigSource config)
100 { 98 {
101 m_Config = config; 99 m_Config = config;
102 IConfig SMTPConfig; 100 IConfig SMTPConfig;
@@ -138,16 +136,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
138 m_Enabled = false; 136 m_Enabled = false;
139 return; 137 return;
140 } 138 }
141 m_log.Info("[EMAIL] Activated DefaultEmailModule");
142 }
143
144 public Type ReplaceableInterface
145 {
146 get { return null; }
147 }
148 139
149 public void AddRegion(Scene scene)
150 {
151 // It's a go! 140 // It's a go!
152 if (m_Enabled) 141 if (m_Enabled)
153 { 142 {
@@ -166,20 +155,8 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
166 m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); 155 m_Scenes.Add(scene.RegionInfo.RegionHandle, scene);
167 } 156 }
168 } 157 }
169 }
170 }
171
172 public void RegionLoaded(Scene scene)
173 {
174 }
175 158
176 public void RemoveRegion(Scene scene) 159 m_log.Info("[EMAIL] Activated DefaultEmailModule");
177 {
178 scene.UnregisterModuleInterface<IEmailModule>(this);
179
180 if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle))
181 {
182 m_Scenes.Remove(scene.RegionInfo.RegionHandle);
183 } 160 }
184 } 161 }
185 162
@@ -196,6 +173,11 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
196 get { return "DefaultEmailModule"; } 173 get { return "DefaultEmailModule"; }
197 } 174 }
198 175
176 public bool IsSharedModule
177 {
178 get { return true; }
179 }
180
199 /// <summary> 181 /// <summary>
200 /// Delay function using thread in seconds 182 /// Delay function using thread in seconds
201 /// </summary> 183 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index e331b8d..d78931a 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -31,7 +31,6 @@ using System.IO;
31using System.Net; 31using System.Net;
32using System.Text; 32using System.Text;
33using System.Threading; 33using System.Threading;
34using Mono.Addins;
35using Nini.Config; 34using Nini.Config;
36using OpenMetaverse; 35using OpenMetaverse;
37using OpenSim.Framework; 36using OpenSim.Framework;
@@ -85,8 +84,7 @@ using OpenSim.Region.Framework.Scenes;
85 84
86namespace OpenSim.Region.CoreModules.Scripting.HttpRequest 85namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
87{ 86{
88 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 87 public class HttpRequestModule : IRegionModule, IHttpRequestModule
89 public class HttpRequestModule : ISharedRegionModule, IHttpRequestModule
90 { 88 {
91 private object HttpListLock = new object(); 89 private object HttpListLock = new object();
92 private int httpTimeout = 30000; 90 private int httpTimeout = 30000;
@@ -231,35 +229,18 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
231 229
232 #endregion 230 #endregion
233 231
234 #region ISharedRegionModule Members 232 #region IRegionModule Members
235 233
236 public void Initialise(IConfigSource config) 234 public void Initialise(Scene scene, IConfigSource config)
237 {
238 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
239 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
240
241 m_pendingRequests = new Dictionary<UUID, HttpRequestClass>();
242 }
243
244 public void AddRegion(Scene scene)
245 { 235 {
246 m_scene = scene; 236 m_scene = scene;
247 237
248 m_scene.RegisterModuleInterface<IHttpRequestModule>(this); 238 m_scene.RegisterModuleInterface<IHttpRequestModule>(this);
249 }
250
251 public Type ReplaceableInterface
252 {
253 get { return null; }
254 }
255 239
256 public void RegionLoaded(Scene scene) 240 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
257 { 241 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
258 }
259 242
260 public void RemoveRegion(Scene scene) 243 m_pendingRequests = new Dictionary<UUID, HttpRequestClass>();
261 {
262 scene.UnregisterModuleInterface<IHttpRequestModule>(this);
263 } 244 }
264 245
265 public void PostInitialise() 246 public void PostInitialise()
@@ -275,6 +256,11 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
275 get { return m_name; } 256 get { return m_name; }
276 } 257 }
277 258
259 public bool IsSharedModule
260 {
261 get { return true; }
262 }
263
278 #endregion 264 #endregion
279 } 265 }
280 266
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index 6ce55a9..9b565ed 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -126,8 +126,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
126 126
127 public void RemoveRegion(Scene scene) 127 public void RemoveRegion(Scene scene)
128 { 128 {
129 scene.UnregisterModuleInterface<IUrlModule>(this);
130 scene.EventManager.OnScriptReset -= OnScriptReset;
131 } 129 }
132 130
133 public void Close() 131 public void Close()
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
index 35ce2cb..c23cea5 100644
--- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Drawing; 29using System.Drawing;
30using System.IO; 30using System.IO;
31using System.Net; 31using System.Net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenMetaverse.Imaging; 34using OpenMetaverse.Imaging;
@@ -40,8 +39,7 @@ using System.Reflection;
40 39
41namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL 40namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
42{ 41{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 42 public class LoadImageURLModule : IRegionModule, IDynamicTextureRender
44 public class LoadImageURLModule : ISharedRegionModule, IDynamicTextureRender
45 { 43 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 45
@@ -99,28 +97,20 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
99 97
100 #endregion 98 #endregion
101 99
102 #region ISharedRegionModule Members 100 #region IRegionModule Members
103 101
104 public void Initialise(IConfigSource config) 102 public void Initialise(Scene scene, IConfigSource config)
105 {
106 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
107 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
108 }
109
110 public void AddRegion(Scene scene)
111 { 103 {
112 if (m_scene == null) 104 if (m_scene == null)
113 { 105 {
114 m_scene = scene; 106 m_scene = scene;
115 } 107 }
108
109 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
110 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
116 } 111 }
117 112
118 public Type ReplaceableInterface 113 public void PostInitialise()
119 {
120 get { return null; }
121 }
122
123 public void RegionLoaded(Scene scene)
124 { 114 {
125 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); 115 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
126 if (m_textureManager != null) 116 if (m_textureManager != null)
@@ -129,14 +119,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
129 } 119 }
130 } 120 }
131 121
132 public void RemoveRegion(Scene scene)
133 {
134 }
135
136 public void PostInitialise()
137 {
138 }
139
140 public void Close() 122 public void Close()
141 { 123 {
142 } 124 }
@@ -146,6 +128,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
146 get { return m_name; } 128 get { return m_name; }
147 } 129 }
148 130
131 public bool IsSharedModule
132 {
133 get { return true; }
134 }
135
149 #endregion 136 #endregion
150 137
151 private void MakeHttpRequest(string url, UUID requestID) 138 private void MakeHttpRequest(string url, UUID requestID)
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 71b01a1..d57a8e5 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -31,7 +31,6 @@ using System.Drawing.Imaging;
31using System.Globalization; 31using System.Globalization;
32using System.IO; 32using System.IO;
33using System.Net; 33using System.Net;
34using Mono.Addins;
35using Nini.Config; 34using Nini.Config;
36using OpenMetaverse; 35using OpenMetaverse;
37using OpenMetaverse.Imaging; 36using OpenMetaverse.Imaging;
@@ -44,8 +43,7 @@ using System.Reflection;
44 43
45namespace OpenSim.Region.CoreModules.Scripting.VectorRender 44namespace OpenSim.Region.CoreModules.Scripting.VectorRender
46{ 45{
47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 46 public class VectorRenderModule : IRegionModule, IDynamicTextureRender
48 public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender
49 { 47 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 49
@@ -112,10 +110,15 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
112 110
113 #endregion 111 #endregion
114 112
115 #region ISharedRegionModule Members 113 #region IRegionModule Members
116 114
117 public void Initialise(IConfigSource config) 115 public void Initialise(Scene scene, IConfigSource config)
118 { 116 {
117 if (m_scene == null)
118 {
119 m_scene = scene;
120 }
121
119 if (m_graph == null) 122 if (m_graph == null)
120 { 123 {
121 Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); 124 Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
@@ -130,20 +133,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
130 m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); 133 m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName);
131 } 134 }
132 135
133 public void AddRegion(Scene scene) 136 public void PostInitialise()
134 {
135 if (m_scene == null)
136 {
137 m_scene = scene;
138 }
139 }
140
141 public Type ReplaceableInterface
142 {
143 get { return null; }
144 }
145
146 public void RegionLoaded(Scene scene)
147 { 137 {
148 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>(); 138 m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
149 if (m_textureManager != null) 139 if (m_textureManager != null)
@@ -152,14 +142,6 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
152 } 142 }
153 } 143 }
154 144
155 public void RemoveRegion(Scene scene)
156 {
157 }
158
159 public void PostInitialise()
160 {
161 }
162
163 public void Close() 145 public void Close()
164 { 146 {
165 } 147 }
@@ -169,6 +151,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
169 get { return m_name; } 151 get { return m_name; }
170 } 152 }
171 153
154 public bool IsSharedModule
155 {
156 get { return true; }
157 }
158
172 #endregion 159 #endregion
173 160
174 private void Draw(string data, UUID id, string extraParams) 161 private void Draw(string data, UUID id, string extraParams)
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index d935c56..93aa88c 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using Mono.Addins;
32using Nini.Config; 31using Nini.Config;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenSim.Framework; 33using OpenSim.Framework;
@@ -86,8 +85,7 @@ using OpenSim.Region.Framework.Scenes;
86 85
87namespace OpenSim.Region.CoreModules.Scripting.WorldComm 86namespace OpenSim.Region.CoreModules.Scripting.WorldComm
88{ 87{
89 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 88 public class WorldCommModule : IRegionModule, IWorldComm
90 public class WorldCommModule : ISharedRegionModule, IWorldComm
91 { 89 {
92 // private static readonly ILog m_log = 90 // private static readonly ILog m_log =
93 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 91 // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -100,9 +98,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
100 private int m_saydistance = 30; 98 private int m_saydistance = 30;
101 private int m_shoutdistance = 100; 99 private int m_shoutdistance = 100;
102 100
103 #region ISharedRegionModule Members 101 #region IRegionModule Members
104 102
105 public void Initialise(IConfigSource config) 103 public void Initialise(Scene scene, IConfigSource config)
106 { 104 {
107 // wrap this in a try block so that defaults will work if 105 // wrap this in a try block so that defaults will work if
108 // the config file doesn't specify otherwise. 106 // the config file doesn't specify otherwise.
@@ -122,6 +120,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
122 if (maxlisteners < 1) maxlisteners = int.MaxValue; 120 if (maxlisteners < 1) maxlisteners = int.MaxValue;
123 if (maxhandles < 1) maxhandles = int.MaxValue; 121 if (maxhandles < 1) maxhandles = int.MaxValue;
124 122
123<<<<<<< HEAD:OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
125 m_listenerManager = new ListenerManager(maxlisteners, maxhandles); 124 m_listenerManager = new ListenerManager(maxlisteners, maxhandles);
126 m_pendingQ = new Queue(); 125 m_pendingQ = new Queue();
127 m_pending = Queue.Synchronized(m_pendingQ); 126 m_pending = Queue.Synchronized(m_pendingQ);
@@ -133,26 +132,19 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
133 132
134 public void AddRegion(Scene scene) 133 public void AddRegion(Scene scene)
135 { 134 {
135=======
136>>>>>>> ec3c31e... Updates all IRegionModules to the new style region modules.:OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
136 m_scene = scene; 137 m_scene = scene;
137 m_scene.RegisterModuleInterface<IWorldComm>(this); 138 m_scene.RegisterModuleInterface<IWorldComm>(this);
139 m_listenerManager = new ListenerManager(maxlisteners, maxhandles);
138 m_scene.EventManager.OnChatFromClient += DeliverClientMessage; 140 m_scene.EventManager.OnChatFromClient += DeliverClientMessage;
139 m_scene.EventManager.OnChatBroadcast += DeliverClientMessage; 141 m_scene.EventManager.OnChatBroadcast += DeliverClientMessage;
142 m_pendingQ = new Queue();
143 m_pending = Queue.Synchronized(m_pendingQ);
140 } 144 }
141 145
142 public Type ReplaceableInterface 146 public void PostInitialise()
143 {
144 get { return null; }
145 }
146
147 public void RegionLoaded(Scene scene)
148 {
149 }
150
151 public void RemoveRegion(Scene scene)
152 { 147 {
153 scene.UnregisterModuleInterface<IWorldComm>(this);
154 scene.EventManager.OnChatFromClient -= DeliverClientMessage;
155 scene.EventManager.OnChatBroadcast -= DeliverClientMessage;
156 } 148 }
157 149
158 public void Close() 150 public void Close()
@@ -164,6 +156,11 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
164 get { return "WorldCommModule"; } 156 get { return "WorldCommModule"; }
165 } 157 }
166 158
159 public bool IsSharedModule
160 {
161 get { return false; }
162 }
163
167 #endregion 164 #endregion
168 165
169 #region IWorldComm Members 166 #region IWorldComm Members
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index a9147fb6..27b64bf 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -32,7 +32,6 @@ using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using log4net; 34using log4net;
35using Mono.Addins;
36using Nini.Config; 35using Nini.Config;
37using Nwc.XmlRpc; 36using Nwc.XmlRpc;
38using OpenMetaverse; 37using OpenMetaverse;
@@ -77,8 +76,7 @@ using OpenSim.Region.Framework.Scenes;
77 76
78namespace OpenSim.Region.CoreModules.Scripting.XMLRPC 77namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
79{ 78{
80 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 79 public class XMLRPCModule : IRegionModule, IXMLRPC
81 public class XMLRPCModule : ISharedRegionModule, IXMLRPC
82 { 80 {
83 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 81 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
84 82
@@ -96,9 +94,9 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
96 private int RemoteReplyScriptWait = 300; 94 private int RemoteReplyScriptWait = 300;
97 private object XMLRPCListLock = new object(); 95 private object XMLRPCListLock = new object();
98 96
99 #region ISharedRegionModule Members 97 #region IRegionModule Members
100 98
101 public void Initialise(IConfigSource config) 99 public void Initialise(Scene scene, IConfigSource config)
102 { 100 {
103 // We need to create these early because the scripts might be calling 101 // We need to create these early because the scripts might be calling
104 // But since this gets called for every region, we need to make sure they 102 // But since this gets called for every region, we need to make sure they
@@ -118,14 +116,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
118 { 116 {
119 } 117 }
120 } 118 }
121 }
122
123 public void PostInitialise()
124 {
125 }
126 119
127 public void AddRegion(Scene scene)
128 {
129 if (!m_scenes.Contains(scene)) 120 if (!m_scenes.Contains(scene))
130 { 121 {
131 m_scenes.Add(scene); 122 m_scenes.Add(scene);
@@ -134,12 +125,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
134 } 125 }
135 } 126 }
136 127
137 public Type ReplaceableInterface 128 public void PostInitialise()
138 {
139 get { return null; }
140 }
141 private Dictionary<Scene, BaseHttpServer> m_HttpServers = new Dictionary<Scene, BaseHttpServer>();
142 public void RegionLoaded(Scene scene)
143 { 129 {
144 if (IsEnabled()) 130 if (IsEnabled())
145 { 131 {
@@ -147,31 +133,9 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
147 // Attach xmlrpc handlers 133 // Attach xmlrpc handlers
148 m_log.Info("[REMOTE_DATA]: " + 134 m_log.Info("[REMOTE_DATA]: " +
149 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); 135 "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
150 BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort); 136 BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort);
151 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); 137 httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData);
152 httpServer.Start(); 138 httpServer.Start();
153 m_HttpServers.Add(scene, httpServer);
154 }
155 }
156
157 public void RemoveRegion(Scene scene)
158 {
159 if (m_scenes.Contains(scene))
160 m_scenes.Remove(scene);
161 scene.UnregisterModuleInterface<IXMLRPC>(this);
162 if (IsEnabled())
163 {
164 // Start http server
165 // Attach xmlrpc handlers
166 if (m_HttpServers.ContainsKey(scene))
167 {
168 BaseHttpServer httpServer;
169 m_HttpServers.TryGetValue(scene, out httpServer);
170 m_log.Info("[REMOTE_DATA]: " +
171 "Stopping XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands.");
172 httpServer.RemoveXmlRPCHandler("llRemoteData");
173 httpServer.Stop();
174 }
175 } 139 }
176 } 140 }
177 141
@@ -184,6 +148,11 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
184 get { return m_name; } 148 get { return m_name; }
185 } 149 }
186 150
151 public bool IsSharedModule
152 {
153 get { return true; }
154 }
155
187 public int Port 156 public int Port
188 { 157 {
189 get { return m_remoteDataPort; } 158 get { return m_remoteDataPort; }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
index d3e2db7..879cc70 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset
47 private IConfigSource m_Config; 47 private IConfigSource m_Config;
48 bool m_Registered = false; 48 bool m_Registered = false;
49 49
50 #region ISharedRegionModule interface 50 #region IRegionModule interface
51 51
52 public void Initialise(IConfigSource config) 52 public void Initialise(IConfigSource config)
53 { 53 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
index a895a3f..b12d778 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
51 bool m_Registered = false; 51 bool m_Registered = false;
52 HypergridServiceInConnector m_HypergridHandler; 52 HypergridServiceInConnector m_HypergridHandler;
53 53
54 #region ISharedRegionModule interface 54 #region IRegionModule interface
55 55
56 public void Initialise(IConfigSource config) 56 public void Initialise(IConfigSource config)
57 { 57 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
index 4c74725..54c6d89 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
47 private IConfigSource m_Config; 47 private IConfigSource m_Config;
48 bool m_Registered = false; 48 bool m_Registered = false;
49 49
50 #region ISharedRegionModule interface 50 #region IRegionModule interface
51 51
52 public void Initialise(IConfigSource config) 52 public void Initialise(IConfigSource config)
53 { 53 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
index dcc6dec..bce160a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
50 private IConfigSource m_Config; 50 private IConfigSource m_Config;
51 private List<Scene> m_Scenes = new List<Scene>(); 51 private List<Scene> m_Scenes = new List<Scene>();
52 52
53 #region ISharedRegionModule interface 53 #region IRegionModule 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 a5c5ef6..8a90370 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour
50 private IConfigSource m_Config; 50 private IConfigSource m_Config;
51 private List<Scene> m_Scenes = new List<Scene>(); 51 private List<Scene> m_Scenes = new List<Scene>();
52 52
53 #region ISharedRegionModule interface 53 #region IRegionModule interface
54 54
55 public void Initialise(IConfigSource config) 55 public void Initialise(IConfigSource config)
56 { 56 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
index c2cea16..f28a318 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation
49 private IConfigSource m_Config; 49 private IConfigSource m_Config;
50 bool m_Registered = false; 50 bool m_Registered = false;
51 51
52 #region ISharedRegionModule interface 52 #region IRegionModule interface
53 53
54 public void Initialise(IConfigSource config) 54 public void Initialise(IConfigSource config)
55 { 55 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
index 71d7993..d68c683 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
48 48
49 #endregion /* Events */ 49 #endregion /* Events */
50 50
51 #region ISharedRegionModule 51 #region IRegionModule
52 52
53 public void Initialise(IConfigSource config) 53 public void Initialise(IConfigSource config)
54 { 54 {
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
136 } 136 }
137 } 137 }
138 138
139 #endregion 139 #endregion /* IRegionModule */
140 140
141 #region IInterregionComms 141 #region IInterregionComms
142 142
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index 24d35e1..44458d1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
66 protected bool m_safemode; 66 protected bool m_safemode;
67 protected IPAddress m_thisIP; 67 protected IPAddress m_thisIP;
68 68
69 #region ISharedRegionModule 69 #region IRegionModule
70 70
71 public virtual void Initialise(IConfigSource config) 71 public virtual void Initialise(IConfigSource config)
72 { 72 {
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
149 MainServer.Instance.AddHTTPHandler("/object/", ObjectHandler); 149 MainServer.Instance.AddHTTPHandler("/object/", ObjectHandler);
150 } 150 }
151 151
152 #endregion 152 #endregion /* IRegionModule */
153 153
154 #region IInterregionComms 154 #region IInterregionComms
155 155
@@ -436,12 +436,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
436 } 436 }
437 437
438 OSDMap resp = new OSDMap(2); 438 OSDMap resp = new OSDMap(2);
439 string reason = String.Empty; 439 string reason = String.Empty;
440 uint teleportFlags = 0; 440 uint teleportFlags = 0;
441 if (args.ContainsKey("teleport_flags")) 441 if (args.ContainsKey("teleport_flags"))
442 { 442 {
443 teleportFlags = args["teleport_flags"].AsUInteger(); 443 teleportFlags = args["teleport_flags"].AsUInteger();
444 } 444 }
445 445
446 // This is the meaning of POST agent 446 // This is the meaning of POST agent
447 m_regionClient.AdjustUserInformation(aCircuit); 447 m_regionClient.AdjustUserInformation(aCircuit);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index c738b65..fc8d4e1 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -81,7 +81,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
81 81
82 public void RemoveRegion(Scene scene) 82 public void RemoveRegion(Scene scene)
83 { 83 {
84 scene.UnregisterModuleInterface<IRegionArchiverModule>(this);
85 } 84 }
86 85
87 public void Close() 86 public void Close()
diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
index a2cfce6..5fa3dc2 100644
--- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
+++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
@@ -27,7 +27,6 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Mono.Addins;
31using Nini.Config; 30using Nini.Config;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
@@ -36,7 +35,6 @@ using OpenSim.Region.Framework.Scenes;
36 35
37namespace OpenSim.Region.CoreModules 36namespace OpenSim.Region.CoreModules
38{ 37{
39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
40 public class CloudModule : ICloudModule 38 public class CloudModule : ICloudModule
41 { 39 {
42// private static readonly log4net.ILog m_log 40// private static readonly log4net.ILog m_log
@@ -50,7 +48,7 @@ namespace OpenSim.Region.CoreModules
50 private float m_cloudDensity = 1.0F; 48 private float m_cloudDensity = 1.0F;
51 private float[] cloudCover = new float[16 * 16]; 49 private float[] cloudCover = new float[16 * 16];
52 50
53 public void Initialise(IConfigSource config) 51 public void Initialise(Scene scene, IConfigSource config)
54 { 52 {
55 IConfig cloudConfig = config.Configs["Cloud"]; 53 IConfig cloudConfig = config.Configs["Cloud"];
56 54
@@ -60,17 +58,10 @@ namespace OpenSim.Region.CoreModules
60 m_cloudDensity = cloudConfig.GetFloat("density", 0.5F); 58 m_cloudDensity = cloudConfig.GetFloat("density", 0.5F);
61 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); 59 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000);
62 } 60 }
63 }
64
65 public Type ReplaceableInterface
66 {
67 get { return null; }
68 }
69 61
70 public void AddRegion(Scene scene)
71 {
72 if (m_enabled) 62 if (m_enabled)
73 { 63 {
64
74 m_scene = scene; 65 m_scene = scene;
75 66
76 scene.EventManager.OnNewClient += CloudsToClient; 67 scene.EventManager.OnNewClient += CloudsToClient;
@@ -80,18 +71,9 @@ namespace OpenSim.Region.CoreModules
80 GenerateCloudCover(); 71 GenerateCloudCover();
81 72
82 m_ready = true; 73 m_ready = true;
83 }
84 }
85 74
86 public void RegionLoaded(Scene scene) 75 }
87 {
88 }
89 76
90 public void RemoveRegion(Scene scene)
91 {
92 scene.EventManager.OnNewClient -= CloudsToClient;
93 scene.UnregisterModuleInterface<ICloudModule>(this);
94 scene.EventManager.OnFrame -= CloudUpdate;
95 } 77 }
96 78
97 public void PostInitialise() 79 public void PostInitialise()
@@ -114,6 +96,12 @@ namespace OpenSim.Region.CoreModules
114 get { return "CloudModule"; } 96 get { return "CloudModule"; }
115 } 97 }
116 98
99 public bool IsSharedModule
100 {
101 get { return false; }
102 }
103
104
117 public float CloudCover(int x, int y, int z) 105 public float CloudCover(int x, int y, int z)
118 { 106 {
119 float cover = 0f; 107 float cover = 0f;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 39836ae..695cced 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -30,7 +30,6 @@ using System.IO;
30using System.Reflection; 30using System.Reflection;
31using System.Security; 31using System.Security;
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenSim.Framework; 35using OpenSim.Framework;
@@ -39,7 +38,6 @@ using OpenSim.Region.Framework.Scenes;
39 38
40namespace OpenSim.Region.CoreModules.World.Estate 39namespace OpenSim.Region.CoreModules.World.Estate
41{ 40{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
43 public class EstateManagementModule : IEstateModule 41 public class EstateManagementModule : IEstateModule
44 { 42 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -900,16 +898,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
900 898
901 #region IRegionModule Members 899 #region IRegionModule Members
902 900
903 public void Initialise(IConfigSource source) 901 public void Initialise(Scene scene, IConfigSource source)
904 {
905 }
906
907 public Type ReplaceableInterface
908 {
909 get { return null; }
910 }
911
912 public void AddRegion(Scene scene)
913 { 902 {
914 m_scene = scene; 903 m_scene = scene;
915 m_scene.RegisterModuleInterface<IEstateModule>(this); 904 m_scene.RegisterModuleInterface<IEstateModule>(this);
@@ -931,29 +920,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
931 consoleSetTerrainHeights); 920 consoleSetTerrainHeights);
932 } 921 }
933 922
934 public void RegionLoaded(Scene scene)
935 {
936 // Sets up the sun module based on the saved Estate and Region Settings
937 // DO NOT REMOVE or the sun will stop working
938 TriggerEstateToolsSunUpdate();
939 }
940
941 public void RemoveRegion(Scene scene)
942 {
943 scene.UnregisterModuleInterface<IEstateModule>(this);
944 scene.EventManager.OnNewClient -= EventManager_OnNewClient;
945 scene.EventManager.OnRequestChangeWaterHeight -= changeWaterHeight;
946 }
947
948 public void Close()
949 {
950 }
951
952 public string Name
953 {
954 get { return "EstateManagementModule"; }
955 }
956
957 #region Console Commands 923 #region Console Commands
958 924
959 public void consoleSetTerrainTexture(string module, string[] args) 925 public void consoleSetTerrainTexture(string module, string[] args)
@@ -1040,6 +1006,28 @@ namespace OpenSim.Region.CoreModules.World.Estate
1040 } 1006 }
1041 1007
1042 #endregion 1008 #endregion
1009
1010 public void PostInitialise()
1011 {
1012 // Sets up the sun module based no the saved Estate and Region Settings
1013 // DO NOT REMOVE or the sun will stop working
1014 TriggerEstateToolsSunUpdate();
1015 }
1016
1017 public void Close()
1018 {
1019 }
1020
1021 public string Name
1022 {
1023 get { return "EstateManagementModule"; }
1024 }
1025
1026 public bool IsSharedModule
1027 {
1028 get { return false; }
1029 }
1030
1043 #endregion 1031 #endregion
1044 1032
1045 #region Other Functions 1033 #region Other Functions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 5b15065..1533462 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
@@ -90,8 +89,7 @@ enum GroupPowers : long
90 89
91namespace OpenSim.Region.CoreModules.World.Permissions 90namespace OpenSim.Region.CoreModules.World.Permissions
92{ 91{
93 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 92 public class PermissionsModule : IRegionModule
94 public class PermissionsModule : INonSharedRegionModule
95 { 93 {
96 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 94 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
97 95
@@ -151,10 +149,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
151 149
152 #endregion 150 #endregion
153 151
154 #region INonSharedRegionModule Members 152 #region IRegionModule Members
155 153
156 public void Initialise(IConfigSource config) 154 public void Initialise(Scene scene, IConfigSource config)
157 { 155 {
156 m_scene = scene;
157
158 IConfig myConfig = config.Configs["Startup"]; 158 IConfig myConfig = config.Configs["Startup"];
159 159
160 string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); 160 string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule");
@@ -179,57 +179,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
179 if (m_bypassPermissions) 179 if (m_bypassPermissions)
180 m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks"); 180 m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks");
181 else 181 else
182 m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); 182 m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks");
183
184 string grant = myConfig.GetString("GrantLSL","");
185 if (grant.Length > 0) {
186 foreach (string uuidl in grant.Split(',')) {
187 string uuid = uuidl.Trim(" \t".ToCharArray());
188 GrantLSL.Add(uuid, true);
189 }
190 }
191
192 grant = myConfig.GetString("GrantCS","");
193 if (grant.Length > 0) {
194 foreach (string uuidl in grant.Split(',')) {
195 string uuid = uuidl.Trim(" \t".ToCharArray());
196 GrantCS.Add(uuid, true);
197 }
198 }
199
200 grant = myConfig.GetString("GrantVB","");
201 if (grant.Length > 0) {
202 foreach (string uuidl in grant.Split(',')) {
203 string uuid = uuidl.Trim(" \t".ToCharArray());
204 GrantVB.Add(uuid, true);
205 }
206 }
207
208 grant = myConfig.GetString("GrantJS", "");
209 if (grant.Length > 0)
210 {
211 foreach (string uuidl in grant.Split(','))
212 {
213 string uuid = uuidl.Trim(" \t".ToCharArray());
214 GrantJS.Add(uuid, true);
215 }
216 }
217
218 grant = myConfig.GetString("GrantYP", "");
219 if (grant.Length > 0)
220 {
221 foreach (string uuidl in grant.Split(','))
222 {
223 string uuid = uuidl.Trim(" \t".ToCharArray());
224 GrantYP.Add(uuid, true);
225 }
226 }
227
228 }
229
230 public void AddRegion(Scene scene)
231 {
232 m_scene = scene;
233 183
234 //Register functions with Scene External Checks! 184 //Register functions with Scene External Checks!
235 m_scene.Permissions.OnBypassPermissions += BypassPermissions; 185 m_scene.Permissions.OnBypassPermissions += BypassPermissions;
@@ -262,23 +212,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
262 m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED 212 m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED
263 m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED 213 m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED
264 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED 214 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED
265 215
266 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED 216 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED
267 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED 217 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED
268 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED 218 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED
269 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED 219 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED
270 220
271 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE 221 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE
272 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED 222 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
273 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED 223 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED
274 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED 224 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED
275 m_scene.Permissions.OnResetScript += CanResetScript; 225 m_scene.Permissions.OnResetScript += CanResetScript;
276 226
277 m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED 227 m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED
278 m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED 228 m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED
279 m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED 229 m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED
280 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED 230 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED
281 231
282 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED 232 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED
283 m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED 233 m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED
284 234
@@ -296,87 +246,52 @@ namespace OpenSim.Region.CoreModules.World.Permissions
296 "debug permissions <true / false>", 246 "debug permissions <true / false>",
297 "Enable permissions debugging", 247 "Enable permissions debugging",
298 HandleDebugPermissions); 248 HandleDebugPermissions);
299 } 249
300 250
301 public Type ReplaceableInterface 251 string grant = myConfig.GetString("GrantLSL","");
302 { 252 if (grant.Length > 0) {
303 get { return null; } 253 foreach (string uuidl in grant.Split(',')) {
304 } 254 string uuid = uuidl.Trim(" \t".ToCharArray());
305 255 GrantLSL.Add(uuid, true);
306 public void RegionLoaded(Scene scene) 256 }
307 { 257 }
308 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
309 258
310 if (m_friendsModule == null) 259 grant = myConfig.GetString("GrantCS","");
311 m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); 260 if (grant.Length > 0) {
312 else 261 foreach (string uuidl in grant.Split(',')) {
313 m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); 262 string uuid = uuidl.Trim(" \t".ToCharArray());
314 } 263 GrantCS.Add(uuid, true);
264 }
265 }
315 266
316 public void RemoveRegion(Scene scene) 267 grant = myConfig.GetString("GrantVB","");
317 { 268 if (grant.Length > 0) {
318 scene.Permissions.OnBypassPermissions -= BypassPermissions; 269 foreach (string uuidl in grant.Split(',')) {
319 scene.Permissions.OnSetBypassPermissions -= SetBypassPermissions; 270 string uuid = uuidl.Trim(" \t".ToCharArray());
320 scene.Permissions.OnPropagatePermissions -= PropagatePermissions; 271 GrantVB.Add(uuid, true);
321 scene.Permissions.OnGenerateClientFlags -= GenerateClientFlags; 272 }
322 scene.Permissions.OnAbandonParcel -= CanAbandonParcel; 273 }
323 scene.Permissions.OnReclaimParcel -= CanReclaimParcel;
324 scene.Permissions.OnDeedParcel -= CanDeedParcel;
325 scene.Permissions.OnDeedObject -= CanDeedObject;
326 scene.Permissions.OnIsGod -= IsGod;
327 scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
328 scene.Permissions.OnDeleteObject -= CanDeleteObject; //MAYBE FULLY IMPLEMENTED
329 scene.Permissions.OnEditObject -= CanEditObject; //MAYBE FULLY IMPLEMENTED
330 scene.Permissions.OnEditParcel -= CanEditParcel; //MAYBE FULLY IMPLEMENTED
331 scene.Permissions.OnInstantMessage -= CanInstantMessage;
332 scene.Permissions.OnInventoryTransfer -= CanInventoryTransfer; //NOT YET IMPLEMENTED
333 scene.Permissions.OnIssueEstateCommand -= CanIssueEstateCommand; //FULLY IMPLEMENTED
334 scene.Permissions.OnMoveObject -= CanMoveObject; //MAYBE FULLY IMPLEMENTED
335 scene.Permissions.OnObjectEntry -= CanObjectEntry;
336 scene.Permissions.OnReturnObject -= CanReturnObject; //NOT YET IMPLEMENTED
337 scene.Permissions.OnRezObject -= CanRezObject; //MAYBE FULLY IMPLEMENTED
338 scene.Permissions.OnRunConsoleCommand -= CanRunConsoleCommand;
339 scene.Permissions.OnRunScript -= CanRunScript; //NOT YET IMPLEMENTED
340 scene.Permissions.OnCompileScript -= CanCompileScript;
341 scene.Permissions.OnSellParcel -= CanSellParcel;
342 scene.Permissions.OnTakeObject -= CanTakeObject;
343 scene.Permissions.OnTakeCopyObject -= CanTakeCopyObject;
344 scene.Permissions.OnTerraformLand -= CanTerraformLand;
345 scene.Permissions.OnLinkObject -= CanLinkObject; //NOT YET IMPLEMENTED
346 scene.Permissions.OnDelinkObject -= CanDelinkObject; //NOT YET IMPLEMENTED
347 scene.Permissions.OnBuyLand -= CanBuyLand; //NOT YET IMPLEMENTED
348
349 scene.Permissions.OnViewNotecard -= CanViewNotecard; //NOT YET IMPLEMENTED
350 scene.Permissions.OnViewScript -= CanViewScript; //NOT YET IMPLEMENTED
351 scene.Permissions.OnEditNotecard -= CanEditNotecard; //NOT YET IMPLEMENTED
352 scene.Permissions.OnEditScript -= CanEditScript; //NOT YET IMPLEMENTED
353
354 scene.Permissions.OnCreateObjectInventory -= CanCreateObjectInventory; //NOT IMPLEMENTED HERE
355 scene.Permissions.OnEditObjectInventory -= CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
356 scene.Permissions.OnCopyObjectInventory -= CanCopyObjectInventory; //NOT YET IMPLEMENTED
357 scene.Permissions.OnDeleteObjectInventory -= CanDeleteObjectInventory; //NOT YET IMPLEMENTED
358 scene.Permissions.OnResetScript -= CanResetScript;
359
360 scene.Permissions.OnCreateUserInventory -= CanCreateUserInventory; //NOT YET IMPLEMENTED
361 scene.Permissions.OnCopyUserInventory -= CanCopyUserInventory; //NOT YET IMPLEMENTED
362 scene.Permissions.OnEditUserInventory -= CanEditUserInventory; //NOT YET IMPLEMENTED
363 scene.Permissions.OnDeleteUserInventory -= CanDeleteUserInventory; //NOT YET IMPLEMENTED
364
365 scene.Permissions.OnTeleport -= CanTeleport; //NOT YET IMPLEMENTED
366 scene.Permissions.OnUseObjectReturn -= CanUseObjectReturn; //NOT YET IMPLEMENTED
367 }
368 274
369 public void PostInitialise() 275 grant = myConfig.GetString("GrantJS", "");
370 { 276 if (grant.Length > 0)
371 } 277 {
278 foreach (string uuidl in grant.Split(','))
279 {
280 string uuid = uuidl.Trim(" \t".ToCharArray());
281 GrantJS.Add(uuid, true);
282 }
283 }
372 284
373 public void Close() 285 grant = myConfig.GetString("GrantYP", "");
374 { 286 if (grant.Length > 0)
375 } 287 {
288 foreach (string uuidl in grant.Split(','))
289 {
290 string uuid = uuidl.Trim(" \t".ToCharArray());
291 GrantYP.Add(uuid, true);
292 }
293 }
376 294
377 public string Name
378 {
379 get { return "PermissionsModule"; }
380 } 295 }
381 296
382 public void HandleBypassPermissions(string module, string[] args) 297 public void HandleBypassPermissions(string module, string[] args)
@@ -449,6 +364,31 @@ namespace OpenSim.Region.CoreModules.World.Permissions
449 m_log.InfoFormat("[PERMISSIONS] Set permissions debugging to {0} in {1}", m_debugPermissions, m_scene.RegionInfo.RegionName); 364 m_log.InfoFormat("[PERMISSIONS] Set permissions debugging to {0} in {1}", m_debugPermissions, m_scene.RegionInfo.RegionName);
450 } 365 }
451 } 366 }
367
368 public void PostInitialise()
369 {
370 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
371
372 if (m_friendsModule == null)
373 m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work");
374 else
375 m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled");
376 }
377
378 public void Close()
379 {
380 }
381
382 public string Name
383 {
384 get { return "PermissionsModule"; }
385 }
386
387 public bool IsSharedModule
388 {
389 get { return false; }
390 }
391
452 #endregion 392 #endregion
453 393
454 #region Helper Functions 394 #region Helper Functions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index ed7bfe1..37f1f2e 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -26,7 +26,6 @@
26 */ 26 */
27 27
28using System; 28using System;
29using Mono.Addins;
30using Nini.Config; 29using Nini.Config;
31using OpenMetaverse; 30using OpenMetaverse;
32using OpenSim.Framework; 31using OpenSim.Framework;
@@ -35,44 +34,26 @@ using OpenSim.Region.Framework.Scenes;
35 34
36namespace OpenSim.Region.CoreModules.World.Sound 35namespace OpenSim.Region.CoreModules.World.Sound
37{ 36{
38 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 37 public class SoundModule : IRegionModule, ISoundModule
39 public class SoundModule : INonSharedRegionModule, ISoundModule
40 { 38 {
41 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 40
43 protected Scene m_scene; 41 protected Scene m_scene;
44 42
45 public void Initialise(IConfigSource source) 43 public void Initialise(Scene scene, IConfigSource source)
46 {
47 }
48
49 public void AddRegion(Scene scene)
50 { 44 {
51 m_scene = scene; 45 m_scene = scene;
52 46
53 m_scene.EventManager.OnNewClient += OnNewClient; 47 m_scene.EventManager.OnNewClient += OnNewClient;
54 48
55 m_scene.RegisterModuleInterface<ISoundModule>(this); 49 m_scene.RegisterModuleInterface<ISoundModule>(this);
56 } 50 }
57
58 public Type ReplaceableInterface
59 {
60 get { return null; }
61 }
62
63 public void RegionLoaded(Scene scene)
64 {
65 }
66
67 public void RemoveRegion(Scene scene)
68 {
69 scene.EventManager.OnNewClient -= OnNewClient;
70 scene.UnregisterModuleInterface<ISoundModule>(this);
71 }
72 51
52 public void PostInitialise() {}
73 public void Close() {} 53 public void Close() {}
74 public string Name { get { return "Sound Module"; } } 54 public string Name { get { return "Sound Module"; } }
75 55 public bool IsSharedModule { get { return false; } }
56
76 private void OnNewClient(IClientAPI client) 57 private void OnNewClient(IClientAPI client)
77 { 58 {
78 client.OnSoundTrigger += TriggerSound; 59 client.OnSoundTrigger += TriggerSound;
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index 948c47c..0712a7f 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
@@ -38,7 +37,6 @@ using OpenSim.Region.Framework.Scenes;
38 37
39namespace OpenSim.Region.CoreModules 38namespace OpenSim.Region.CoreModules
40{ 39{
41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
42 public class SunModule : ISunModule 40 public class SunModule : ISunModule
43 { 41 {
44 /// <summary> 42 /// <summary>
@@ -280,12 +278,27 @@ namespace OpenSim.Region.CoreModules
280 return GetCurrentSunHour() + 6.0f; 278 return GetCurrentSunHour() + 6.0f;
281 } 279 }
282 280
283 #region INonSharedRegionModule Methods 281 #region IRegion Methods
284 282
285 // Called immediately after the module is loaded for a given region 283 // Called immediately after the module is loaded for a given region
286 // i.e. Immediately after instance creation. 284 // i.e. Immediately after instance creation.
287 public void Initialise(IConfigSource config) 285 public void Initialise(Scene scene, IConfigSource config)
288 { 286 {
287 m_scene = scene;
288 m_frame = 0;
289
290 // This one puts an entry in the main help screen
291 m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
292
293 // This one enables the ability to type just "sun" without any parameters
294 m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand);
295 foreach (KeyValuePair<string, string> kvp in GetParamList())
296 {
297 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
298 }
299
300
301
289 TimeZone local = TimeZone.CurrentTimeZone; 302 TimeZone local = TimeZone.CurrentTimeZone;
290 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; 303 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
291 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); 304 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset);
@@ -333,43 +346,7 @@ namespace OpenSim.Region.CoreModules
333 // m_latitude = d_latitude; 346 // m_latitude = d_latitude;
334 // m_longitude = d_longitude; 347 // m_longitude = d_longitude;
335 } 348 }
336 }
337
338 public void Close()
339 {
340 ready = false;
341
342 // Remove our hooks
343 m_scene.EventManager.OnFrame -= SunUpdate;
344 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
345 m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
346 m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
347 }
348
349 public string Name
350 {
351 get { return "SunModule"; }
352 }
353
354 public Type ReplaceableInterface
355 {
356 get { return null; }
357 }
358
359 public void AddRegion(Scene scene)
360 {
361 m_scene = scene;
362 m_frame = 0;
363
364 // This one puts an entry in the main help screen
365 m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
366 349
367 // This one enables the ability to type just "sun" without any parameters
368 m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand);
369 foreach (KeyValuePair<string, string> kvp in GetParamList())
370 {
371 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
372 }
373 switch (m_RegionMode) 350 switch (m_RegionMode)
374 { 351 {
375 case "T1": 352 case "T1":
@@ -377,8 +354,8 @@ namespace OpenSim.Region.CoreModules
377 case "SL": 354 case "SL":
378 // Time taken to complete a cycle (day and season) 355 // Time taken to complete a cycle (day and season)
379 356
380 SecondsPerSunCycle = (uint)(m_DayLengthHours * 60 * 60); 357 SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60);
381 SecondsPerYear = (uint)(SecondsPerSunCycle * m_YearLengthDays); 358 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays);
382 359
383 // Ration of real-to-virtual time 360 // Ration of real-to-virtual time
384 361
@@ -387,17 +364,17 @@ namespace OpenSim.Region.CoreModules
387 // Speed of rotation needed to complete a cycle in the 364 // Speed of rotation needed to complete a cycle in the
388 // designated period (day and season) 365 // designated period (day and season)
389 366
390 SunSpeed = m_SunCycle / SecondsPerSunCycle; 367 SunSpeed = m_SunCycle/SecondsPerSunCycle;
391 SeasonSpeed = m_SeasonalCycle / SecondsPerYear; 368 SeasonSpeed = m_SeasonalCycle/SecondsPerYear;
392 369
393 // Horizon translation 370 // Horizon translation
394 371
395 HorizonShift = m_HorizonShift; // Z axis translation 372 HorizonShift = m_HorizonShift; // Z axis translation
396 // HoursToRadians = (SunCycle/24)*VWTimeRatio; 373 // HoursToRadians = (SunCycle/24)*VWTimeRatio;
397 374
398 // Insert our event handling hooks 375 // Insert our event handling hooks
399 376
400 scene.EventManager.OnFrame += SunUpdate; 377 scene.EventManager.OnFrame += SunUpdate;
401 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 378 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
402 scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; 379 scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
403 scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; 380 scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
@@ -414,21 +391,34 @@ namespace OpenSim.Region.CoreModules
414 } 391 }
415 392
416 scene.RegisterModuleInterface<ISunModule>(this); 393 scene.RegisterModuleInterface<ISunModule>(this);
394
417 } 395 }
418 396
419 public void RegionLoaded(Scene scene) 397
398 public void PostInitialise()
420 { 399 {
421 } 400 }
422 401
423 public void RemoveRegion(Scene scene) 402 public void Close()
424 { 403 {
425 scene.RegisterModuleInterface<ISunModule>(this); 404 ready = false;
426 scene.EventManager.OnFrame -= SunUpdate; 405
427 scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; 406 // Remove our hooks
428 scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; 407 m_scene.EventManager.OnFrame -= SunUpdate;
429 scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; 408 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
409 m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
410 m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
411 }
412
413 public string Name
414 {
415 get { return "SunModule"; }
430 } 416 }
431 417
418 public bool IsSharedModule
419 {
420 get { return false; }
421 }
432 #endregion 422 #endregion
433 423
434 #region EventManager Events 424 #region EventManager Events
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index 0b487ed..c2ad7b8 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using log4net; 30using log4net;
31using Mono.Addins;
32using Nini.Config; 31using Nini.Config;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenSim.Framework; 33using OpenSim.Framework;
@@ -37,8 +36,7 @@ using OpenSim.Region.Framework.Scenes;
37 36
38namespace OpenSim.Region.CoreModules.Avatar.Vegetation 37namespace OpenSim.Region.CoreModules.Avatar.Vegetation
39{ 38{
40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 39 public class VegetationModule : IRegionModule, IVegetationModule
41 public class VegetationModule : INonSharedRegionModule, IVegetationModule
42 { 40 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 42
@@ -47,34 +45,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
47 protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree }; 45 protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree };
48 public PCode[] CreationCapabilities { get { return creationCapabilities; } } 46 public PCode[] CreationCapabilities { get { return creationCapabilities; } }
49 47
50 public void Initialise(IConfigSource source) 48 public void Initialise(Scene scene, IConfigSource source)
51 {
52 }
53
54 public void AddRegion(Scene scene)
55 { 49 {
56 m_scene = scene; 50 m_scene = scene;
57 m_scene.RegisterModuleInterface<IVegetationModule>(this); 51 m_scene.RegisterModuleInterface<IVegetationModule>(this);
58 } 52 }
59
60 public Type ReplaceableInterface
61 {
62 get { return null; }
63 }
64
65 public void RegionLoaded(Scene scene)
66 {
67 }
68
69 public void RemoveRegion(Scene scene)
70 {
71 scene.UnregisterModuleInterface<IVegetationModule>(this);
72 }
73 53
74 public void PostInitialise() {} 54 public void PostInitialise() {}
75 public void Close() {} 55 public void Close() {}
76 public string Name { get { return "Vegetation Module"; } } 56 public string Name { get { return "Vegetation Module"; } }
77 57 public bool IsSharedModule { get { return false; } }
58
78 public SceneObjectGroup AddTree( 59 public SceneObjectGroup AddTree(
79 UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree) 60 UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree)
80 { 61 {
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index cd3706d..3283c1f 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -55,19 +55,17 @@ namespace OpenSim.Region.CoreModules
55 55
56 private IWindModelPlugin m_activeWindPlugin = null; 56 private IWindModelPlugin m_activeWindPlugin = null;
57 private const string m_dWindPluginName = "SimpleRandomWind"; 57 private const string m_dWindPluginName = "SimpleRandomWind";
58 private string m_desiredWindPlugin = "SimpleRandomWind";
59 private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>(); 58 private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>();
60 59
61 // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m 60 // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m
62 private Vector2[] windSpeeds = new Vector2[16 * 16]; 61 private Vector2[] windSpeeds = new Vector2[16 * 16];
63 private IConfig windConfig;
64 62
65 #region IRegion Methods 63 #region IRegion Methods
66 64
67 public void Initialise(IConfigSource config) 65 public void Initialise(Scene scene, IConfigSource config)
68 { 66 {
69 windConfig = config.Configs["Wind"]; 67 IConfig windConfig = config.Configs["Wind"];
70 m_desiredWindPlugin = m_dWindPluginName; 68 string desiredWindPlugin = m_dWindPluginName;
71 69
72 if (windConfig != null) 70 if (windConfig != null)
73 { 71 {
@@ -78,18 +76,10 @@ namespace OpenSim.Region.CoreModules
78 // Determine which wind model plugin is desired 76 // Determine which wind model plugin is desired
79 if (windConfig.Contains("wind_plugin")) 77 if (windConfig.Contains("wind_plugin"))
80 { 78 {
81 m_desiredWindPlugin = windConfig.GetString("wind_plugin"); 79 desiredWindPlugin = windConfig.GetString("wind_plugin");
82 } 80 }
83 } 81 }
84 }
85
86 public Type ReplaceableInterface
87 {
88 get { return null; }
89 }
90 82
91 public void AddRegion(Scene scene)
92 {
93 if (m_enabled) 83 if (m_enabled)
94 { 84 {
95 m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); 85 m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);
@@ -105,30 +95,30 @@ namespace OpenSim.Region.CoreModules
105 } 95 }
106 96
107 // Check for desired plugin 97 // Check for desired plugin
108 if (m_availableWindPlugins.ContainsKey(m_desiredWindPlugin)) 98 if (m_availableWindPlugins.ContainsKey(desiredWindPlugin))
109 { 99 {
110 m_activeWindPlugin = m_availableWindPlugins[m_desiredWindPlugin]; 100 m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin];
111 101
112 m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_desiredWindPlugin); 102 m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin);
113 103
114 if (windConfig != null) 104 if (windConfig != null)
115 { 105 {
116 m_activeWindPlugin.Initialise(); 106 m_activeWindPlugin.Initialise();
117 m_activeWindPlugin.WindConfig(m_scene, windConfig); 107 m_activeWindPlugin.WindConfig(m_scene, windConfig);
118 } 108 }
119 } 109 }
120 110
121 111
122 // if the plug-in wasn't found, default to no wind. 112 // if the plug-in wasn't found, default to no wind.
123 if (m_activeWindPlugin == null) 113 if (m_activeWindPlugin == null)
124 { 114 {
125 m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_desiredWindPlugin); 115 m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin);
126 m_log.ErrorFormat("[WIND] Defaulting to no wind."); 116 m_log.ErrorFormat("[WIND] Defaulting to no wind.");
127 } 117 }
128 118
129 // This one puts an entry in the main help screen 119 // This one puts an entry in the main help screen
130 m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); 120 m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
131 121
132 // This one enables the ability to type just the base command without any parameters 122 // This one enables the ability to type just the base command without any parameters
133 m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); 123 m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand);
134 124
@@ -137,7 +127,7 @@ namespace OpenSim.Region.CoreModules
137 { 127 {
138 m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); 128 m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
139 m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); 129 m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand);
140 130
141 foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) 131 foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams())
142 { 132 {
143 m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); 133 m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand);
@@ -159,17 +149,11 @@ namespace OpenSim.Region.CoreModules
159 m_ready = true; 149 m_ready = true;
160 150
161 } 151 }
162 }
163 152
164 public void RegionLoaded(Scene scene)
165 {
166 } 153 }
167 154
168 public void RemoveRegion(Scene scene) 155 public void PostInitialise()
169 { 156 {
170 scene.EventManager.OnFrame -= WindUpdate;
171 scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion;
172 scene.UnregisterModuleInterface<IWindModule>(this);
173 } 157 }
174 158
175 public void Close() 159 public void Close()
@@ -198,6 +182,11 @@ namespace OpenSim.Region.CoreModules
198 get { return "WindModule"; } 182 get { return "WindModule"; }
199 } 183 }
200 184
185 public bool IsSharedModule
186 {
187 get { return false; }
188 }
189
201 190
202 #endregion 191 #endregion
203 192
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 6bda1e9..285d36a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenMetaverse.Imaging; 35using OpenMetaverse.Imaging;
@@ -60,8 +59,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
60 public face[] trns; 59 public face[] trns;
61 } 60 }
62 61
63 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 62 public class MapImageModule : IMapImageGenerator, IRegionModule
64 public class MapImageModule : IMapImageGenerator, INonSharedRegionModule
65 { 63 {
66 private static readonly ILog m_log = 64 private static readonly ILog m_log =
67 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 65 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -130,38 +128,25 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
130 128
131 #endregion 129 #endregion
132 130
133 #region INonSharedRegionModule Members 131 #region IRegionModule Members
134 132
135 public void Initialise(IConfigSource source) 133 public void Initialise(Scene scene, IConfigSource source)
136 { 134 {
135 m_scene = scene;
137 m_config = source; 136 m_config = source;
138 137
139 IConfig startupConfig = m_config.Configs["Startup"]; 138 IConfig startupConfig = m_config.Configs["Startup"];
140 if (startupConfig.GetString("MapImageModule", "MapImageModule") != 139 if (startupConfig.GetString("MapImageModule", "MapImageModule") !=
141 "MapImageModule") 140 "MapImageModule")
142 return; 141 return;
143 }
144 142
145 public void AddRegion(Scene scene)
146 {
147 m_scene = scene;
148 m_scene.RegisterModuleInterface<IMapImageGenerator>(this); 143 m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
149 } 144 }
150 145
151 public Type ReplaceableInterface 146 public void PostInitialise()
152 {
153 get { return null; }
154 }
155
156 public void RegionLoaded(Scene scene)
157 { 147 {
158 } 148 }
159 149
160 public void RemoveRegion(Scene scene)
161 {
162 scene.UnregisterModuleInterface<IMapImageGenerator>(this);
163 }
164
165 public void Close() 150 public void Close()
166 { 151 {
167 } 152 }
@@ -171,6 +156,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
171 get { return "MapImageModule"; } 156 get { return "MapImageModule"; }
172 } 157 }
173 158
159 public bool IsSharedModule
160 {
161 get { return false; }
162 }
163
174 #endregion 164 #endregion
175 165
176// TODO: unused: 166// TODO: unused:
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index dd33673..be46fa5 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -24,12 +24,9 @@
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
28using System;
29using System.Collections.Generic; 27using System.Collections.Generic;
30using System.Reflection; 28using System.Reflection;
31using log4net; 29using log4net;
32using Mono.Addins;
33using Nini.Config; 30using Nini.Config;
34using OpenMetaverse; 31using OpenMetaverse;
35using OpenSim.Framework; 32using OpenSim.Framework;
@@ -41,8 +38,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41 38
42namespace OpenSim.Region.CoreModules.World.WorldMap 39namespace OpenSim.Region.CoreModules.World.WorldMap
43{ 40{
44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 41 public class MapSearchModule : IRegionModule
45 public class MapSearchModule : ISharedRegionModule
46 { 42 {
47 private static readonly ILog m_log = 43 private static readonly ILog m_log =
48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -50,12 +46,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
50 Scene m_scene = null; // only need one for communication with GridService 46 Scene m_scene = null; // only need one for communication with GridService
51 List<Scene> m_scenes = new List<Scene>(); 47 List<Scene> m_scenes = new List<Scene>();
52 48
53 #region ISharedRegionModule Members 49 #region IRegionModule Members
54 public void Initialise(IConfigSource source) 50 public void Initialise(Scene scene, IConfigSource source)
55 {
56 }
57
58 public void AddRegion(Scene scene)
59 { 51 {
60 if (m_scene == null) 52 if (m_scene == null)
61 { 53 {
@@ -66,22 +58,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
66 scene.EventManager.OnNewClient += OnNewClient; 58 scene.EventManager.OnNewClient += OnNewClient;
67 } 59 }
68 60
69 public Type ReplaceableInterface
70 {
71 get { return null; }
72 }
73
74 public void RegionLoaded(Scene scene)
75 {
76 }
77
78 public void RemoveRegion(Scene scene)
79 {
80 if(m_scenes.Contains(scene))
81 m_scenes.Remove(scene);
82 scene.EventManager.OnNewClient -= OnNewClient;
83 }
84
85 public void PostInitialise() 61 public void PostInitialise()
86 { 62 {
87 } 63 }
@@ -97,6 +73,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
97 get { return "MapSearchModule"; } 73 get { return "MapSearchModule"; }
98 } 74 }
99 75
76 public bool IsSharedModule
77 {
78 get { return true; }
79 }
80
100 #endregion 81 #endregion
101 82
102 private void OnNewClient(IClientAPI client) 83 private void OnNewClient(IClientAPI client)
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
index b0cefc3..4df9094 100644
--- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
+++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs
@@ -33,7 +33,6 @@ using System.Net;
33using System.Reflection; 33using System.Reflection;
34using System.Xml; 34using System.Xml;
35using log4net; 35using log4net;
36using Mono.Addins;
37using Nini.Config; 36using Nini.Config;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenSim.Framework; 38using OpenSim.Framework;
@@ -44,8 +43,7 @@ using OpenSim.Region.Framework.Scenes;
44 43
45namespace OpenSim.Region.DataSnapshot 44namespace OpenSim.Region.DataSnapshot
46{ 45{
47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 46 public class DataSnapshotManager : IRegionModule, IDataSnapshot
48 public class DataSnapshotManager : ISharedRegionModule, IDataSnapshot
49 { 47 {
50 #region Class members 48 #region Class members
51 //Information from config 49 //Information from config
@@ -91,7 +89,7 @@ namespace OpenSim.Region.DataSnapshot
91 89
92 #region IRegionModule 90 #region IRegionModule
93 91
94 public void Initialise(IConfigSource config) 92 public void Initialise(Scene scene, IConfigSource config)
95 { 93 {
96 if (!m_configLoaded) 94 if (!m_configLoaded)
97 { 95 {
@@ -142,29 +140,24 @@ namespace OpenSim.Region.DataSnapshot
142 return; 140 return;
143 } 141 }
144 } 142 }
145 }
146 }
147
148 public Type ReplaceableInterface
149 {
150 get { return null; }
151 }
152 143
153 public void AddRegion(Scene scene) 144 if (m_enabled)
154 { 145 {
155 if (m_enabled) 146 //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer
156 { 147 new DataRequestHandler(scene, this);
157 //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer
158 new DataRequestHandler(scene, this);
159 148
160 m_hostname = scene.RegionInfo.ExternalHostName; 149 m_hostname = scene.RegionInfo.ExternalHostName;
161 m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname); 150 m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname);
162 151
163 MakeEverythingStale(); 152 MakeEverythingStale();
164 153
165 if (m_dataServices != "" && m_dataServices != "noservices") 154 if (m_dataServices != "" && m_dataServices != "noservices")
166 NotifyDataServices(m_dataServices, "online"); 155 NotifyDataServices(m_dataServices, "online");
156 }
157 }
167 158
159 if (m_enabled)
160 {
168 m_log.Info("[DATASNAPSHOT]: Scene added to module."); 161 m_log.Info("[DATASNAPSHOT]: Scene added to module.");
169 162
170 m_snapStore.AddScene(scene); 163 m_snapStore.AddScene(scene);
@@ -198,25 +191,20 @@ namespace OpenSim.Region.DataSnapshot
198 } 191 }
199 else 192 else
200 { 193 {
201 m_log.Info("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else)."); 194 m_log.Warn("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else).");
202 } 195 }
203 } 196 }
204 197
205 public void RegionLoaded(Scene scene) 198 public void Close()
206 { 199 {
200 if (m_enabled && m_dataServices != "" && m_dataServices != "noservices")
201 NotifyDataServices(m_dataServices, "offline");
207 } 202 }
208 203
209 public void RemoveRegion(Scene scene)
210 {
211 if (m_scenes.Contains(scene))
212 m_scenes.Remove(scene);
213 m_snapStore.RemoveScene(scene);
214 }
215 204
216 public void Close() 205 public bool IsSharedModule
217 { 206 {
218 if (m_enabled && m_dataServices != "" && m_dataServices != "noservices") 207 get { return true; }
219 NotifyDataServices(m_dataServices, "offline");
220 } 208 }
221 209
222 public string Name 210 public string Name
@@ -226,6 +214,7 @@ namespace OpenSim.Region.DataSnapshot
226 214
227 public void PostInitialise() 215 public void PostInitialise()
228 { 216 {
217
229 } 218 }
230 219
231 #endregion 220 #endregion
diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
index 879114b..f8a5bad 100644
--- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs
@@ -28,7 +28,7 @@
28 28
29namespace OpenSim.Region.Framework.Interfaces 29namespace OpenSim.Region.Framework.Interfaces
30{ 30{
31 public interface ICloudModule : INonSharedRegionModule 31 public interface ICloudModule : IRegionModule
32 { 32 {
33 /// <summary> 33 /// <summary>
34 /// Retrieves the cloud density at the given region coordinates 34 /// Retrieves the cloud density at the given region coordinates
diff --git a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
index bdad0b4..3a2c423 100644
--- a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces
38 public int numLeft; 38 public int numLeft;
39 } 39 }
40 40
41 public interface IEmailModule : ISharedRegionModule 41 public interface IEmailModule : IRegionModule
42 { 42 {
43 void SendEmail(UUID objectID, string address, string subject, string body); 43 void SendEmail(UUID objectID, string address, string subject, string body);
44 Email GetNextEmail(UUID objectID, string sender, string subject); 44 Email GetNextEmail(UUID objectID, string sender, string subject);
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
index 347818c..890fa31 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29 29
30namespace OpenSim.Region.Framework.Interfaces 30namespace OpenSim.Region.Framework.Interfaces
31{ 31{
32 public interface IEstateModule : INonSharedRegionModule 32 public interface IEstateModule : IRegionModule
33 { 33 {
34 uint GetRegionFlags(); 34 uint GetRegionFlags();
35 bool IsManager(UUID avatarID); 35 bool IsManager(UUID avatarID);
diff --git a/OpenSim/Region/Framework/Interfaces/ISunModule.cs b/OpenSim/Region/Framework/Interfaces/ISunModule.cs
index 8231716..819ae11 100644
--- a/OpenSim/Region/Framework/Interfaces/ISunModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISunModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29 29
30namespace OpenSim.Region.Framework.Interfaces 30namespace OpenSim.Region.Framework.Interfaces
31{ 31{
32 public interface ISunModule : INonSharedRegionModule 32 public interface ISunModule : IRegionModule
33 { 33 {
34 double GetSunParameter(string param); 34 double GetSunParameter(string param);
35 35
diff --git a/OpenSim/Region/Framework/Interfaces/IWindModule.cs b/OpenSim/Region/Framework/Interfaces/IWindModule.cs
index 4a26a71..10ecc32 100644
--- a/OpenSim/Region/Framework/Interfaces/IWindModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWindModule.cs
@@ -29,7 +29,7 @@ using OpenMetaverse;
29 29
30namespace OpenSim.Region.Framework.Interfaces 30namespace OpenSim.Region.Framework.Interfaces
31{ 31{
32 public interface IWindModule : INonSharedRegionModule 32 public interface IWindModule : IRegionModule
33 { 33 {
34 34
35 /// <summary> 35 /// <summary>
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs
index ec040db..cfe1278 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs
@@ -25,11 +25,9 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Net; 28using System.Net;
30using System.Reflection; 29using System.Reflection;
31using log4net; 30using log4net;
32using Mono.Addins;
33using Nini.Config; 31using Nini.Config;
34using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
@@ -37,23 +35,24 @@ using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server;
37 35
38namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView 36namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
39{ 37{
40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 38 public class IRCStackModule : IRegionModule
41 public class IRCStackModule : INonSharedRegionModule
42 { 39 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 41
45 private IRCServer m_server; 42 private IRCServer m_server;
46// private Scene m_scene; 43// private Scene m_scene;
47 private int portNo;
48 44
49 #region Implementation of ISharedRegionModule 45 #region Implementation of IRegionModule
50 46
51 public void Initialise(IConfigSource source) 47 public void Initialise(Scene scene, IConfigSource source)
52 { 48 {
53 if (null != source.Configs["IRCd"] && 49 if (null != source.Configs["IRCd"] &&
54 source.Configs["IRCd"].GetBoolean("Enabled",false)) 50 source.Configs["IRCd"].GetBoolean("Enabled",false))
55 { 51 {
56 portNo = source.Configs["IRCd"].GetInt("Port",6666); 52 int portNo = source.Configs["IRCd"].GetInt("Port",6666);
53// m_scene = scene;
54 m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene);
55 m_server.OnNewIRCClient += m_server_OnNewIRCClient;
57 } 56 }
58 } 57 }
59 58
@@ -69,20 +68,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
69 m_log.Info("[IRCd] Added user to Scene"); 68 m_log.Info("[IRCd] Added user to Scene");
70 } 69 }
71 70
72 public void AddRegion(Scene scene) 71 public void PostInitialise()
73 {
74 if (portNo != null)
75 {
76 m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene);
77 m_server.OnNewIRCClient += m_server_OnNewIRCClient;
78 }
79 }
80 public void RegionLoaded(Scene scene)
81 { 72 {
82 }
83 73
84 public void RemoveRegion(Scene scene)
85 {
86 } 74 }
87 75
88 public void Close() 76 public void Close()
@@ -95,9 +83,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView
95 get { return "IRCClientStackModule"; } 83 get { return "IRCClientStackModule"; }
96 } 84 }
97 85
98 public Type ReplaceableInterface 86 public bool IsSharedModule
99 { 87 {
100 get { return null; } 88 get { return false; }
101 } 89 }
102 90
103 #endregion 91 #endregion
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 23ae307..b04b076 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -38,7 +38,6 @@ using System.Collections.Generic;
38using System.Reflection; 38using System.Reflection;
39using OpenMetaverse; 39using OpenMetaverse;
40using log4net; 40using log4net;
41using Mono.Addins;
42using Nini.Config; 41using Nini.Config;
43using Nwc.XmlRpc; 42using Nwc.XmlRpc;
44using OpenSim.Framework; 43using OpenSim.Framework;
@@ -54,8 +53,7 @@ using System.Text.RegularExpressions;
54 53
55namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice 54namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
56{ 55{
57 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 56 public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule
58 public class FreeSwitchVoiceModule : ISharedRegionModule, IVoiceModule
59 { 57 {
60 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
61 59
@@ -110,8 +108,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
110 108
111 private IConfig m_config; 109 private IConfig m_config;
112 110
113 public void Initialise(IConfigSource config) 111 public void Initialise(Scene scene, IConfigSource config)
114 { 112 {
113 m_scene = scene;
115 m_config = config.Configs["FreeSwitchVoice"]; 114 m_config = config.Configs["FreeSwitchVoice"];
116 115
117 if (null == m_config) 116 if (null == m_config)
@@ -225,21 +224,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
225 return; 224 return;
226 } 225 }
227 } 226 }
228 }
229 227
230 public void AddRegion(Scene scene) 228 if (m_pluginEnabled)
231 {
232 m_scene = scene;
233 if (m_pluginEnabled)
234 { 229 {
235 // we need to capture scene in an anonymous method 230 // we need to capture scene in an anonymous method
236 // here as we need it later in the callbacks 231 // here as we need it later in the callbacks
237 scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps) 232 scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps)
238 { 233 {
239 OnRegisterCaps(scene, agentID, caps); 234 OnRegisterCaps(scene, agentID, caps);
240 }; 235 };
241 236
242 237
243 238
244 try 239 try
245 { 240 {
@@ -259,53 +254,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
259 m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions."); 254 m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions.");
260 } 255 }
261 } 256 }
262 257
263 } 258 }
259 }
260
261 public void PostInitialise()
262 {
264 if (m_pluginEnabled) 263 if (m_pluginEnabled)
265 { 264 {
266 m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); 265 m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
267 266
268 // register the voice interface for this module, so the script engine can call us 267 // register the voice interface for this module, so the script engine can call us
269 m_scene.RegisterModuleInterface<IVoiceModule>(this); 268 m_scene.RegisterModuleInterface<IVoiceModule>(this);
270 } 269 }
271 } 270 }
272 271
273 public void RegionLoaded(Scene scene)
274 {
275 }
276
277 public void RemoveRegion(Scene scene)
278 {
279 if (UseProxy)
280 {
281 MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/", m_freeSwitchAPIPrefix));
282 }
283 else
284 {
285 MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix));
286
287 MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix));
288
289 MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix));
290
291 MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix));
292 }
293 scene.EventManager.OnRegisterCaps -= delegate(UUID agentID, Caps caps)
294 {
295 OnRegisterCaps(scene, agentID, caps);
296 };
297 scene.UnregisterModuleInterface<IVoiceModule>(this);
298 }
299
300 public Type ReplaceableInterface
301 {
302 get { return null; }
303 }
304
305 public void PostInitialise()
306 {
307 }
308
309 public void Close() 272 public void Close()
310 { 273 {
311 } 274 }
@@ -314,6 +277,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
314 { 277 {
315 get { return "FreeSwitchVoiceModule"; } 278 get { return "FreeSwitchVoiceModule"; }
316 } 279 }
280
281 public bool IsSharedModule
282 {
283 get { return true; }
284 }
317 285
318 // <summary> 286 // <summary>
319 // implementation of IVoiceModule, called by osSetParcelSIPAddress script function 287 // implementation of IVoiceModule, called by osSetParcelSIPAddress script function
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs
index 6769d59..3d1c346 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.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 *
@@ -38,7 +38,6 @@ using System.Threading;
38 38
39using OpenMetaverse; 39using OpenMetaverse;
40 40
41using Mono.Addins;
42using Nini.Config; 41using Nini.Config;
43 42
44using OpenSim; 43using OpenSim;
@@ -51,8 +50,7 @@ using log4net;
51 50
52namespace OpenSim.Region.OptionalModules.ContentManagement 51namespace OpenSim.Region.OptionalModules.ContentManagement
53{ 52{
54 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 53 public class ContentManagementModule : IRegionModule
55 public class ContentManagementModule : ISharedRegionModule
56 { 54 {
57 #region Static Fields 55 #region Static Fields
58 56
@@ -62,20 +60,22 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
62 60
63 #region Fields 61 #region Fields
64 62
65 private bool initialised = false; 63 bool initialised = false;
66 private CMController m_control = null; 64 CMController m_control = null;
67 private bool m_enabled = false; 65 bool m_enabled = false;
68 private CMModel m_model = null; 66 CMModel m_model = null;
69 private bool m_posted = false; 67 bool m_posted = false;
70 private CMView m_view = null; 68 CMView m_view = null;
71 private string databaseDir = "./";
72 private string database = "FileSystemDatabase";
73 private int channel = 345;
74 69
75 #endregion Fields 70 #endregion Fields
76 71
77 #region Public Properties 72 #region Public Properties
78 73
74 public bool IsSharedModule
75 {
76 get { return true; }
77 }
78
79 public string Name 79 public string Name
80 { 80 {
81 get { return "ContentManagementModule"; } 81 get { return "ContentManagementModule"; }
@@ -89,8 +89,11 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
89 { 89 {
90 } 90 }
91 91
92 public void Initialise(IConfigSource source) 92 public void Initialise(Scene scene, IConfigSource source)
93 { 93 {
94 string databaseDir = "./";
95 string database = "FileSystemDatabase";
96 int channel = 345;
94 try 97 try
95 { 98 {
96 if (source.Configs["CMS"] == null) 99 if (source.Configs["CMS"] == null)
@@ -112,15 +115,13 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
112 m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e); 115 m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e);
113 m_enabled = false; 116 m_enabled = false;
114 } 117 }
115 }
116 118
117 public void AddRegion(Scene scene)
118 {
119 if (!m_enabled) 119 if (!m_enabled)
120 { 120 {
121 m_log.Info("[Content Management]: Content Management System is not Enabled."); 121 m_log.Info("[Content Management]: Content Management System is not Enabled.");
122 return; 122 return;
123 } 123 }
124
124 lock (this) 125 lock (this)
125 { 126 {
126 if (!initialised) //only init once 127 if (!initialised) //only init once
@@ -141,18 +142,6 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
141 } 142 }
142 } 143 }
143 } 144 }
144 public void RegionLoaded(Scene scene)
145 {
146 }
147
148 public void RemoveRegion(Scene scene)
149 {
150 }
151
152 public Type ReplaceableInterface
153 {
154 get { return null; }
155 }
156 145
157 public void PostInitialise() 146 public void PostInitialise()
158 { 147 {
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index f24bcdc..4521f8e 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -38,7 +38,6 @@ using System.Security.Policy;
38using System.Text; 38using System.Text;
39using log4net; 39using log4net;
40using Microsoft.CSharp; 40using Microsoft.CSharp;
41using Mono.Addins;
42using Nini.Config; 41using Nini.Config;
43using OpenMetaverse; 42using OpenMetaverse;
44using OpenSim.Framework; 43using OpenSim.Framework;
@@ -47,8 +46,7 @@ using OpenSim.Region.Framework.Scenes;
47 46
48namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 47namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
49{ 48{
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 49 public class MRMModule : IRegionModule, IMRMModule
51 public class MRMModule : INonSharedRegionModule, IMRMModule
52 { 50 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 private Scene m_scene; 52 private Scene m_scene;
@@ -64,14 +62,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
64 62
65 private IConfig m_config; 63 private IConfig m_config;
66 64
67 private bool m_hidden = true;
68
69 public void RegisterExtension<T>(T instance) 65 public void RegisterExtension<T>(T instance)
70 { 66 {
71 m_extensions[typeof (T)] = instance; 67 m_extensions[typeof (T)] = instance;
72 } 68 }
73 69
74 public void Initialise(IConfigSource source) 70 public void Initialise(Scene scene, IConfigSource source)
75 { 71 {
76 if (source.Configs["MRM"] != null) 72 if (source.Configs["MRM"] != null)
77 { 73 {
@@ -80,10 +76,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
80 if (source.Configs["MRM"].GetBoolean("Enabled", false)) 76 if (source.Configs["MRM"].GetBoolean("Enabled", false))
81 { 77 {
82 m_log.Info("[MRM] Enabling MRM Module"); 78 m_log.Info("[MRM] Enabling MRM Module");
83 79 m_scene = scene;
80
84 // when hidden, we don't listen for client initiated script events 81 // when hidden, we don't listen for client initiated script events
85 // only making the MRM engine available for region modules 82 // only making the MRM engine available for region modules
86 m_hidden = source.Configs["MRM"].GetBoolean("Hidden", false); 83 if (!source.Configs["MRM"].GetBoolean("Hidden", false))
84 {
85 scene.EventManager.OnRezScript += EventManager_OnRezScript;
86 scene.EventManager.OnStopScript += EventManager_OnStopScript;
87 }
88
89 scene.EventManager.OnFrame += EventManager_OnFrame;
90
91 scene.RegisterModuleInterface<IMRMModule>(this);
87 } 92 }
88 else 93 else
89 { 94 {
@@ -96,39 +101,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
96 } 101 }
97 } 102 }
98 103
99 public Type ReplaceableInterface
100 {
101 get { return null; }
102 }
103
104 public void AddRegion(Scene scene)
105 {
106 m_scene = scene;
107 if (!m_hidden)
108 {
109 scene.EventManager.OnRezScript += EventManager_OnRezScript;
110 scene.EventManager.OnStopScript += EventManager_OnStopScript;
111 }
112 scene.EventManager.OnFrame += EventManager_OnFrame;
113
114 scene.RegisterModuleInterface<IMRMModule>(this);
115 }
116 public void RegionLoaded(Scene scene)
117 {
118 }
119
120 public void RemoveRegion(Scene scene)
121 {
122 if (!m_hidden)
123 {
124 scene.EventManager.OnRezScript -= EventManager_OnRezScript;
125 scene.EventManager.OnStopScript -= EventManager_OnStopScript;
126 }
127 scene.EventManager.OnFrame -= EventManager_OnFrame;
128
129 scene.UnregisterModuleInterface<IMRMModule>(this);
130 }
131
132 void EventManager_OnStopScript(uint localID, UUID itemID) 104 void EventManager_OnStopScript(uint localID, UUID itemID)
133 { 105 {
134 if (m_scripts.ContainsKey(itemID)) 106 if (m_scripts.ContainsKey(itemID))
@@ -330,6 +302,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
330 mmb.InitMiniModule(world, host, itemID); 302 mmb.InitMiniModule(world, host, itemID);
331 } 303 }
332 304
305 public void PostInitialise()
306 {
307
308 }
309
333 public void Close() 310 public void Close()
334 { 311 {
335 foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts) 312 foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts)
@@ -343,6 +320,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
343 get { return "MiniRegionModule"; } 320 get { return "MiniRegionModule"; }
344 } 321 }
345 322
323 public bool IsSharedModule
324 {
325 get { return false; }
326 }
327
346 /// <summary> 328 /// <summary>
347 /// Stolen from ScriptEngine Common 329 /// Stolen from ScriptEngine Common
348 /// </summary> 330 /// </summary>
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 999756a..c653e98 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -100,10 +100,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
100 if (!m_enabled) 100 if (!m_enabled)
101 return; 101 return;
102 102
103 scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; 103 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
104 scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; 104 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
105 105
106 scene = null; 106 m_scene = null;
107 } 107 }
108 108
109 public void Close() 109 public void Close()
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
index df01938..44c9ada 100644
--- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
@@ -58,7 +58,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
58 58
59 public void RemoveRegion(Scene scene) 59 public void RemoveRegion(Scene scene)
60 { 60 {
61 scene.UnregisterModuleInterface<IScriptModuleComms>(this);
62 } 61 }
63 62
64 public void RegionLoaded(Scene scene) 63 public void RegionLoaded(Scene scene)
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
index f2a0e53..d18ac0a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31 31
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using OpenMetaverse; 34using OpenMetaverse;
36 35
@@ -50,8 +49,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
50 public string uri; 49 public string uri;
51 } 50 }
52 51
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 52 public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter
54 public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter
55 { 53 {
56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
57 55
@@ -61,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
61 private bool m_Enabled = false; 59 private bool m_Enabled = false;
62 private string m_ServerURI = String.Empty; 60 private string m_ServerURI = String.Empty;
63 61
64 public void Initialise(IConfigSource config) 62 public void Initialise(Scene scene, IConfigSource config)
65 { 63 {
66 IConfig startupConfig = config.Configs["Startup"]; 64 IConfig startupConfig = config.Configs["Startup"];
67 if (startupConfig == null) 65 if (startupConfig == null)
@@ -77,26 +75,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
77 return; 75 return;
78 } 76 }
79 77
78 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
80 m_Enabled = true; 79 m_Enabled = true;
81 } 80 }
82 } 81 }
83 82
84 public void AddRegion(Scene scene) 83 public void PostInitialise()
85 { 84 {
86 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
87 }
88 public void RegionLoaded(Scene scene)
89 {
90 }
91
92 public void RemoveRegion(Scene scene)
93 {
94 scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
95 }
96
97 public Type ReplaceableInterface
98 {
99 get { return null; }
100 } 85 }
101 86
102 public void Close() 87 public void Close()
@@ -108,6 +93,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
108 get { return "XmlRpcGridRouterModule"; } 93 get { return "XmlRpcGridRouterModule"; }
109 } 94 }
110 95
96 public bool IsSharedModule
97 {
98 get { return false; }
99 }
100
111 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) 101 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
112 { 102 {
113 if (!m_Channels.ContainsKey(itemID)) 103 if (!m_Channels.ContainsKey(itemID))
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
index 4d39345..32659c8 100644
--- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Reflection; 29using System.Reflection;
30 30
31using log4net; 31using log4net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenMetaverse; 33using OpenMetaverse;
35 34
@@ -40,12 +39,11 @@ using OpenSim.Region.Framework.Scenes;
40 39
41namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule 40namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
42{ 41{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 42 public class XmlRpcRouter : IRegionModule, IXmlRpcRouter
44 public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter
45 { 43 {
46 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private bool m_enabled = false; 45
48 public void Initialise(IConfigSource config) 46 public void Initialise(Scene scene, IConfigSource config)
49 { 47 {
50 IConfig startupConfig = config.Configs["Startup"]; 48 IConfig startupConfig = config.Configs["Startup"];
51 if (startupConfig == null) 49 if (startupConfig == null)
@@ -54,25 +52,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
54 if (startupConfig.GetString("XmlRpcRouterModule", 52 if (startupConfig.GetString("XmlRpcRouterModule",
55 "XmlRpcRouterModule") == "XmlRpcRouterModule") 53 "XmlRpcRouterModule") == "XmlRpcRouterModule")
56 { 54 {
57 m_enabled = true; 55 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
58 } 56 }
59 } 57 }
60 public void AddRegion(Scene scene)
61 {
62 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
63 }
64 public void RegionLoaded(Scene scene)
65 {
66 }
67
68 public void RemoveRegion(Scene scene)
69 {
70 scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
71 }
72 58
73 public Type ReplaceableInterface 59 public void PostInitialise()
74 { 60 {
75 get { return null; }
76 } 61 }
77 62
78 public void Close() 63 public void Close()
@@ -84,6 +69,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
84 get { return "XmlRpcRouterModule"; } 69 get { return "XmlRpcRouterModule"; }
85 } 70 }
86 71
72 public bool IsSharedModule
73 {
74 get { return false; }
75 }
76
87 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) 77 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
88 { 78 {
89 scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri}); 79 scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri});
diff --git a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs
index 801f1f8..97fa63c 100644
--- a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Freeswitch
47 private IConfigSource m_Config; 47 private IConfigSource m_Config;
48 bool m_Registered = false; 48 bool m_Registered = false;
49 49
50 #region ISharedRegionModule interface 50 #region IRegionModule interface
51 51
52 public void Initialise(IConfigSource config) 52 public void Initialise(IConfigSource config)
53 { 53 {
diff --git a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
index fa5878d..3490a8b 100644
--- a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
+++ b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs
@@ -31,7 +31,6 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Timers; 32using System.Timers;
33using log4net; 33using log4net;
34using Mono.Addins;
35using Nini.Config; 34using Nini.Config;
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.CoreModules.World.Serialiser; 36using OpenSim.Region.CoreModules.World.Serialiser;
@@ -43,8 +42,7 @@ using Slash = System.IO.Path;
43 42
44namespace OpenSim.Region.Modules.SvnSerialiser 43namespace OpenSim.Region.Modules.SvnSerialiser
45{ 44{
46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 45 public class SvnBackupModule : IRegionModule
47 public class SvnBackupModule : ISharedRegionModule
48 { 46 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 48
@@ -202,9 +200,9 @@ namespace OpenSim.Region.Modules.SvnSerialiser
202 200
203 #endregion 201 #endregion
204 202
205 #region ISharedRegionModule Members 203 #region IRegionModule Members
206 204
207 public void Initialise(IConfigSource source) 205 public void Initialise(Scene scene, IConfigSource source)
208 { 206 {
209 m_scenes = new List<Scene>(); 207 m_scenes = new List<Scene>();
210 m_timer = new Timer(); 208 m_timer = new Timer();
@@ -227,10 +225,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser
227 catch (Exception) 225 catch (Exception)
228 { 226 {
229 } 227 }
230 }
231 228
232 public void AddRegion(Scene scene)
233 {
234 lock (m_scenes) 229 lock (m_scenes)
235 { 230 {
236 m_scenes.Add(scene); 231 m_scenes.Add(scene);
@@ -241,18 +236,6 @@ namespace OpenSim.Region.Modules.SvnSerialiser
241 scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; 236 scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
242 } 237 }
243 } 238 }
244 public void RegionLoaded(Scene scene)
245 {
246 }
247
248 public void RemoveRegion(Scene scene)
249 {
250 }
251
252 public Type ReplaceableInterface
253 {
254 get { return null; }
255 }
256 239
257 public void PostInitialise() 240 public void PostInitialise()
258 { 241 {
@@ -294,6 +277,11 @@ namespace OpenSim.Region.Modules.SvnSerialiser
294 get { return "SvnBackupModule"; } 277 get { return "SvnBackupModule"; }
295 } 278 }
296 279
280 public bool IsSharedModule
281 {
282 get { return true; }
283 }
284
297 #endregion 285 #endregion
298 286
299 private void EventManager_OnPluginConsole(string[] args) 287 private void EventManager_OnPluginConsole(string[] args)
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 521d01a..ac39a53 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -25,11 +25,9 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using System.Collections.Generic; 28using System.Collections.Generic;
30using System.Threading; 29using System.Threading;
31using OpenMetaverse; 30using OpenMetaverse;
32using Mono.Addins;
33using Nini.Config; 31using Nini.Config;
34using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
@@ -39,8 +37,7 @@ using Timer=System.Timers.Timer;
39 37
40namespace OpenSim.Region.OptionalModules.World.NPC 38namespace OpenSim.Region.OptionalModules.World.NPC
41{ 39{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 40 public class NPCModule : IRegionModule, INPCModule
43 public class NPCModule : ISharedRegionModule, INPCModule
44 { 41 {
45 // private const bool m_enabled = false; 42 // private const bool m_enabled = false;
46 43
@@ -137,13 +134,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
137 } 134 }
138 135
139 136
140 public void Initialise(IConfigSource source) 137 public void Initialise(Scene scene, IConfigSource source)
141 { 138 {
142 m_createMutex = new Mutex(false); 139 m_createMutex = new Mutex(false);
143 140
144 m_timer = new Timer(500); 141 m_timer = new Timer(500);
145 m_timer.Elapsed += m_timer_Elapsed; 142 m_timer.Elapsed += m_timer_Elapsed;
146 m_timer.Start(); 143 m_timer.Start();
144
145 scene.RegisterModuleInterface<INPCModule>(this);
147 } 146 }
148 147
149 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 148 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
@@ -174,19 +173,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
174 } 173 }
175 } 174 }
176 175
177 public void AddRegion(Scene scene)
178 {
179 scene.RegisterModuleInterface<INPCModule>(this);
180 }
181 public void RegionLoaded(Scene scene)
182 {
183 }
184
185 public void RemoveRegion(Scene scene)
186 {
187 scene.UnregisterModuleInterface<INPCModule>(this);
188 }
189
190 public void PostInitialise() 176 public void PostInitialise()
191 { 177 {
192 } 178 }
@@ -200,9 +186,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
200 get { return "NPCModule"; } 186 get { return "NPCModule"; }
201 } 187 }
202 188
203 public Type ReplaceableInterface 189 public bool IsSharedModule
204 { 190 {
205 get { return null; } 191 get { return true; }
206 } 192 }
207 } 193 }
208} 194}
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index b59d07a..e3fbb6e 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -31,7 +31,6 @@ using System.Reflection;
31using System.Timers; 31using System.Timers;
32using OpenMetaverse; 32using OpenMetaverse;
33using log4net; 33using log4net;
34using Mono.Addins;
35using Nini.Config; 34using Nini.Config;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 36using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
@@ -47,8 +46,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
47 /// <summary> 46 /// <summary>
48 /// Version 2.02 - Still hacky 47 /// Version 2.02 - Still hacky
49 /// </summary> 48 /// </summary>
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 49 public class TreePopulatorModule : IRegionModule, ICommandableModule, IVegetationModule
51 public class TreePopulatorModule : INonSharedRegionModule, ICommandableModule, IVegetationModule
52 { 50 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 private readonly Commander m_commander = new Commander("tree"); 52 private readonly Commander m_commander = new Commander("tree");
@@ -170,10 +168,15 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
170 168
171 #endregion 169 #endregion
172 170
173 #region ISharedRegionModule Members 171 #region IRegionModule Members
174 172
175 public void Initialise(IConfigSource config) 173 public void Initialise(Scene scene, IConfigSource config)
176 { 174 {
175
176 m_scene = scene;
177 m_scene.RegisterModuleInterface<IRegionModule>(this);
178 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
179
177 // ini file settings 180 // ini file settings
178 try 181 try
179 { 182 {
@@ -193,18 +196,12 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
193 m_log.Debug("[TREES]: ini failure for update_rate - using default"); 196 m_log.Debug("[TREES]: ini failure for update_rate - using default");
194 } 197 }
195 198
196 m_log.Debug("[TREES]: Initialised tree module");
197 }
198
199 public void AddRegion(Scene scene)
200 {
201 m_scene = scene;
202 m_scene.RegisterModuleInterface<INonSharedRegionModule>(this);
203 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
204 InstallCommands(); 199 InstallCommands();
200
201 m_log.Debug("[TREES]: Initialised tree module");
205 } 202 }
206 203
207 public void RegionLoaded(Scene scene) 204 public void PostInitialise()
208 { 205 {
209 ReloadCopse(); 206 ReloadCopse();
210 if (m_copse.Count > 0) 207 if (m_copse.Count > 0)
@@ -214,17 +211,6 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
214 activeizeTreeze(true); 211 activeizeTreeze(true);
215 } 212 }
216 213
217 public void RemoveRegion(Scene scene)
218 {
219 scene.UnregisterModuleInterface<INonSharedRegionModule>(this);
220 scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
221 }
222
223 public Type ReplaceableInterface
224 {
225 get { return null; }
226 }
227
228 public void Close() 214 public void Close()
229 { 215 {
230 } 216 }
@@ -234,6 +220,11 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
234 get { return "TreePopulatorModule"; } 220 get { return "TreePopulatorModule"; }
235 } 221 }
236 222
223 public bool IsSharedModule
224 {
225 get { return false; }
226 }
227
237 #endregion 228 #endregion
238 229
239 //-------------------------------------------------------------- 230 //--------------------------------------------------------------
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 9b53d06..a03cc4c 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -34,7 +34,6 @@ using System.Reflection;
34using System.Text; 34using System.Text;
35using System.Threading; 35using System.Threading;
36using log4net; 36using log4net;
37using Mono.Addins;
38using Nini.Config; 37using Nini.Config;
39using OpenMetaverse; 38using OpenMetaverse;
40using OpenMetaverse.StructuredData; 39using OpenMetaverse.StructuredData;
@@ -53,8 +52,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap;
53 52
54namespace OpenSim.Region.UserStatistics 53namespace OpenSim.Region.UserStatistics
55{ 54{
56 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 55 public class WebStatsModule : IRegionModule
57 public class WebStatsModule : ISharedRegionModule
58 { 56 {
59 private static readonly ILog m_log = 57 private static readonly ILog m_log =
60 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -72,7 +70,7 @@ namespace OpenSim.Region.UserStatistics
72 private string m_loglines = String.Empty; 70 private string m_loglines = String.Empty;
73 private volatile int lastHit = 12000; 71 private volatile int lastHit = 12000;
74 72
75 public virtual void Initialise(IConfigSource config) 73 public virtual void Initialise(Scene scene, IConfigSource config)
76 { 74 {
77 IConfig cnfg; 75 IConfig cnfg;
78 try 76 try
@@ -84,17 +82,11 @@ namespace OpenSim.Region.UserStatistics
84 { 82 {
85 enabled = false; 83 enabled = false;
86 } 84 }
87 } 85
88
89 public Type ReplaceableInterface
90 {
91 get { return null; }
92 }
93
94 public void AddRegion(Scene scene)
95 {
96 if (!enabled) 86 if (!enabled)
87 {
97 return; 88 return;
89 }
98 90
99 lock (m_scene) 91 lock (m_scene)
100 { 92 {
@@ -138,7 +130,7 @@ namespace OpenSim.Region.UserStatistics
138 MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest); 130 MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest);
139 MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest); 131 MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest);
140 } 132 }
141 133
142 m_scene.Add(scene); 134 m_scene.Add(scene);
143 if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID)) 135 if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID))
144 m_simstatsCounters.Remove(scene.RegionInfo.RegionID); 136 m_simstatsCounters.Remove(scene.RegionInfo.RegionID);
@@ -148,14 +140,6 @@ namespace OpenSim.Region.UserStatistics
148 } 140 }
149 } 141 }
150 142
151 public void RegionLoaded(Scene scene)
152 {
153 }
154
155 public void RemoveRegion(Scene scene)
156 {
157 }
158
159 public void ReceiveClassicSimStatsPacket(SimStats stats) 143 public void ReceiveClassicSimStatsPacket(SimStats stats)
160 { 144 {
161 if (!enabled) 145 if (!enabled)
@@ -324,6 +308,11 @@ namespace OpenSim.Region.UserStatistics
324 get { return "ViewerStatsModule"; } 308 get { return "ViewerStatsModule"; }
325 } 309 }
326 310
311 public bool IsSharedModule
312 {
313 get { return true; }
314 }
315
327 public void OnRegisterCaps(UUID agentID, Caps caps) 316 public void OnRegisterCaps(UUID agentID, Caps caps)
328 { 317 {
329 m_log.DebugFormat("[VC]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 318 m_log.DebugFormat("[VC]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);